Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • v1.0.0
  • v1.0.1
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.12.0
  • v1.12.1
  • v1.12.2
  • v1.12.3
  • v1.12.4
  • v1.12.5
  • v1.12.6
  • v1.12.7
  • v1.12.8
  • v1.13.0
  • v1.13.1
  • v1.13.2
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.15.10
  • v1.15.11
  • v1.15.12
  • v1.15.13
  • v1.15.14
  • v1.15.15
  • v1.15.16
  • v1.15.17
  • v1.15.2
  • v1.15.3
  • v1.15.4
  • v1.15.5
  • v1.15.6
  • v1.15.7
  • v1.15.8
  • v1.15.9
  • v1.16.0
  • v1.16.1
  • v1.17.0
  • v1.18.0
  • v1.18.1
  • v1.18.2
  • v1.19.0
  • v1.19.1
  • v1.19.2
  • v1.19.3
  • v1.19.4
  • v1.2.0
  • v1.20.0
  • v1.20.1
  • v1.20.2
  • v1.20.3
  • v1.21.0
  • v1.21.1
  • v1.22.0
  • v1.23.0
  • v1.23.1
  • v1.23.2
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.6.0
  • v1.6.1
  • v1.7.0
  • v1.7.1
  • v1.7.2
  • v1.7.3
  • v1.8.0
  • v1.8.1
  • v1.9.0
76 results

Target

Select target project
  • oss/libraries/go/services/job-queues
1 result
Select Git revision
  • master
  • v1.0.0
  • v1.0.1
  • v1.1.0
  • v1.10.0
  • v1.10.1
  • v1.10.2
  • v1.11.0
  • v1.12.0
  • v1.12.1
  • v1.12.2
  • v1.12.3
  • v1.12.4
  • v1.12.5
  • v1.12.6
  • v1.12.7
  • v1.12.8
  • v1.13.0
  • v1.13.1
  • v1.13.2
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.15.10
  • v1.15.11
  • v1.15.12
  • v1.15.13
  • v1.15.14
  • v1.15.15
  • v1.15.16
  • v1.15.17
  • v1.15.2
  • v1.15.3
  • v1.15.4
  • v1.15.5
  • v1.15.6
  • v1.15.7
  • v1.15.8
  • v1.15.9
  • v1.16.0
  • v1.16.1
  • v1.17.0
  • v1.18.0
  • v1.18.1
  • v1.18.2
  • v1.19.0
  • v1.19.1
  • v1.19.2
  • v1.19.3
  • v1.19.4
  • v1.2.0
  • v1.20.0
  • v1.20.1
  • v1.20.2
  • v1.20.3
  • v1.21.0
  • v1.21.1
  • v1.22.0
  • v1.23.0
  • v1.23.1
  • v1.23.2
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.6.0
  • v1.6.1
  • v1.7.0
  • v1.7.1
  • v1.7.2
  • v1.7.3
  • v1.8.0
  • v1.8.1
  • v1.9.0
76 results
Show changes
Commits on Source (2)
......@@ -11,3 +11,5 @@ devenv.local.nix
smell.go
/.attach_*
.direnv/
.direnv/
......@@ -17,6 +17,10 @@ func (id JobID) String() string {
return string(id)
}
type GetResult interface {
GetResult() string
}
// Priority is the priority of a job
type Priority int
......@@ -260,12 +264,22 @@ func (j *Job[T]) Execute(ctx context.Context) (RunGenericResult, error) {
newLog.ErrorMsg = runnerError.Error()
}
newLog.Result = CheckAndCallGetResult(r.Data)
j.logs = append(j.logs, newLog)
genericResult := RunGenericResult(r)
return genericResult, runnerError
}
func CheckAndCallGetResult[T any](data T) string {
switch v := any(data).(type) {
case GetResult:
return v.GetResult()
}
return ""
}
// Cancel cancels the job, currently a no-op
func (j *Job[T]) Cancel() error {
return nil
......
......@@ -27,6 +27,10 @@ type CounterResult struct {
Count int
}
func (c *CounterResult) GetResult() string {
return fmt.Sprintf("Count: %d", c.Count)
}
// CounterRunnable is a runnable that counts
type CounterRunnable struct {
Count int `json:"count" yaml:"count"`
......
......@@ -37,6 +37,10 @@ type FileOperationResult struct {
Content string // Optional, je nach Operation
}
func (f *FileOperationResult) GetResult() string {
return f.Content
}
const (
FileOperationRead = "read"
FileOperationWrite = "write"
......@@ -130,16 +134,16 @@ func (f *FileOperationRunnable) GetType() string {
return "fileoperation"
}
func (c *FileOperationRunnable) GetPersistence() RunnableImport {
func (f *FileOperationRunnable) GetPersistence() RunnableImport {
data := JSONMap{
"operation": c.Operation,
"filepath": c.FilePath,
"content": c.Content,
"operation": f.Operation,
"filepath": f.FilePath,
"content": f.Content,
}
return RunnableImport{
Type: c.GetType(),
Type: f.GetType(),
Data: data,
}
}
......@@ -38,6 +38,10 @@ type DBResult struct {
RowsAffected int
}
func (d *DBResult) GetResult() string {
return fmt.Sprintf("RowsAffected: %d", d.RowsAffected)
}
type DBRunnable struct {
Type string
DSN string
......@@ -93,16 +97,16 @@ func (d *DBRunnable) GetType() string {
return "db"
}
func (c *DBRunnable) GetPersistence() RunnableImport {
func (d *DBRunnable) GetPersistence() RunnableImport {
data := JSONMap{
"type": c.Type,
"dsn": c.DSN,
"query": c.Query,
"type": d.Type,
"dsn": d.DSN,
"query": d.Query,
}
return RunnableImport{
Type: c.GetType(),
Type: d.GetType(),
Data: data,
}
}
......@@ -46,6 +46,10 @@ type HTTPResult struct {
Body string
}
func (h *HTTPResult) GetResult() string {
return fmt.Sprintf("StatusCode: %d\n\n%s", h.StatusCode, h.Body)
}
type HTTPRunnable struct {
URL string
Method string
......@@ -90,17 +94,17 @@ func (h *HTTPRunnable) GetType() string {
return "http"
}
func (c *HTTPRunnable) GetPersistence() RunnableImport {
func (h *HTTPRunnable) GetPersistence() RunnableImport {
data := JSONMap{
"url": c.URL,
"method": c.Method,
"header": c.Header,
"body": c.Body,
"url": h.URL,
"method": h.Method,
"header": h.Header,
"body": h.Body,
}
return RunnableImport{
Type: c.GetType(),
Type: h.GetType(),
Data: data,
}
}
......@@ -75,6 +75,10 @@ type MailResult struct {
SmtpStatusCode uint
}
func (m *MailResult) GetResult() string {
return fmt.Sprintf("Sent: %t\n\nServerReply: %s\n\nSmtpStatusCode: %d", m.Sent, m.ServerReply, m.SmtpStatusCode)
}
type MailRunnable struct {
To string
From string
......@@ -146,22 +150,22 @@ func (m *MailRunnable) GetType() string {
return "mail"
}
func (c *MailRunnable) GetPersistence() RunnableImport {
func (m *MailRunnable) GetPersistence() RunnableImport {
data := JSONMap{
"to": c.To,
"from": c.From,
"subject": c.Subject,
"body": c.Body,
"server": c.Server,
"port": c.Port,
"username": c.Username,
"password": c.Password,
"headers": c.Headers,
"to": m.To,
"from": m.From,
"subject": m.Subject,
"body": m.Body,
"server": m.Server,
"port": m.Port,
"username": m.Username,
"password": m.Password,
"headers": m.Headers,
}
return RunnableImport{
Type: c.GetType(),
Type: m.GetType(),
Data: data,
}
}
......@@ -82,6 +82,10 @@ type SFTPResult struct {
FilesCopied []string
}
func (s *SFTPResult) GetResult() string {
return fmt.Sprintf("FilesCopied: %v", s.FilesCopied)
}
const (
CredentialTypePassword = "password"
CredentialTypeKey = "key"
......@@ -282,23 +286,23 @@ func (s *SFTPRunnable) GetType() string {
return "sftp"
}
func (c *SFTPRunnable) GetPersistence() RunnableImport {
func (s *SFTPRunnable) GetPersistence() RunnableImport {
data := JSONMap{
"host": c.Host,
"port": c.Port,
"user": c.User,
"insecure": c.Insecure,
"credential": c.Credential,
"credential_type": c.CredentialType,
"hostkey": c.HostKey,
"src_dir": c.SrcDir,
"dst_dir": c.DstDir,
"transfer_direction": c.TransferDirection,
"host": s.Host,
"port": s.Port,
"user": s.User,
"insecure": s.Insecure,
"credential": s.Credential,
"credential_type": s.CredentialType,
"hostkey": s.HostKey,
"src_dir": s.SrcDir,
"dst_dir": s.DstDir,
"transfer_direction": s.TransferDirection,
}
return RunnableImport{
Type: c.GetType(),
Type: s.GetType(),
Data: data,
}
}
......@@ -37,6 +37,10 @@ type ShellResult struct {
ExitCode int
}
func (s *ShellResult) GetResult() string {
return s.Output
}
type ShellRunnable struct {
ScriptPath string
Script string
......@@ -117,15 +121,15 @@ func (s *ShellRunnable) GetType() string {
return "shell"
}
func (c *ShellRunnable) GetPersistence() RunnableImport {
func (s *ShellRunnable) GetPersistence() RunnableImport {
data := JSONMap{
"scriptPath": c.ScriptPath,
"script": c.Script,
"scriptPath": s.ScriptPath,
"script": s.Script,
}
return RunnableImport{
Type: c.GetType(),
Type: s.GetType(),
Data: data,
}
}