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 ...@@ -11,3 +11,5 @@ devenv.local.nix
smell.go smell.go
/.attach_* /.attach_*
.direnv/
.direnv/
...@@ -17,6 +17,10 @@ func (id JobID) String() string { ...@@ -17,6 +17,10 @@ func (id JobID) String() string {
return string(id) return string(id)
} }
type GetResult interface {
GetResult() string
}
// Priority is the priority of a job // Priority is the priority of a job
type Priority int type Priority int
...@@ -260,12 +264,22 @@ func (j *Job[T]) Execute(ctx context.Context) (RunGenericResult, error) { ...@@ -260,12 +264,22 @@ func (j *Job[T]) Execute(ctx context.Context) (RunGenericResult, error) {
newLog.ErrorMsg = runnerError.Error() newLog.ErrorMsg = runnerError.Error()
} }
newLog.Result = CheckAndCallGetResult(r.Data)
j.logs = append(j.logs, newLog) j.logs = append(j.logs, newLog)
genericResult := RunGenericResult(r) genericResult := RunGenericResult(r)
return genericResult, runnerError 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 // Cancel cancels the job, currently a no-op
func (j *Job[T]) Cancel() error { func (j *Job[T]) Cancel() error {
return nil return nil
......
...@@ -27,6 +27,10 @@ type CounterResult struct { ...@@ -27,6 +27,10 @@ type CounterResult struct {
Count int Count int
} }
func (c *CounterResult) GetResult() string {
return fmt.Sprintf("Count: %d", c.Count)
}
// CounterRunnable is a runnable that counts // CounterRunnable is a runnable that counts
type CounterRunnable struct { type CounterRunnable struct {
Count int `json:"count" yaml:"count"` Count int `json:"count" yaml:"count"`
......
...@@ -37,6 +37,10 @@ type FileOperationResult struct { ...@@ -37,6 +37,10 @@ type FileOperationResult struct {
Content string // Optional, je nach Operation Content string // Optional, je nach Operation
} }
func (f *FileOperationResult) GetResult() string {
return f.Content
}
const ( const (
FileOperationRead = "read" FileOperationRead = "read"
FileOperationWrite = "write" FileOperationWrite = "write"
...@@ -130,16 +134,16 @@ func (f *FileOperationRunnable) GetType() string { ...@@ -130,16 +134,16 @@ func (f *FileOperationRunnable) GetType() string {
return "fileoperation" return "fileoperation"
} }
func (c *FileOperationRunnable) GetPersistence() RunnableImport { func (f *FileOperationRunnable) GetPersistence() RunnableImport {
data := JSONMap{ data := JSONMap{
"operation": c.Operation, "operation": f.Operation,
"filepath": c.FilePath, "filepath": f.FilePath,
"content": c.Content, "content": f.Content,
} }
return RunnableImport{ return RunnableImport{
Type: c.GetType(), Type: f.GetType(),
Data: data, Data: data,
} }
} }
...@@ -38,6 +38,10 @@ type DBResult struct { ...@@ -38,6 +38,10 @@ type DBResult struct {
RowsAffected int RowsAffected int
} }
func (d *DBResult) GetResult() string {
return fmt.Sprintf("RowsAffected: %d", d.RowsAffected)
}
type DBRunnable struct { type DBRunnable struct {
Type string Type string
DSN string DSN string
...@@ -93,16 +97,16 @@ func (d *DBRunnable) GetType() string { ...@@ -93,16 +97,16 @@ func (d *DBRunnable) GetType() string {
return "db" return "db"
} }
func (c *DBRunnable) GetPersistence() RunnableImport { func (d *DBRunnable) GetPersistence() RunnableImport {
data := JSONMap{ data := JSONMap{
"type": c.Type, "type": d.Type,
"dsn": c.DSN, "dsn": d.DSN,
"query": c.Query, "query": d.Query,
} }
return RunnableImport{ return RunnableImport{
Type: c.GetType(), Type: d.GetType(),
Data: data, Data: data,
} }
} }
...@@ -46,6 +46,10 @@ type HTTPResult struct { ...@@ -46,6 +46,10 @@ type HTTPResult struct {
Body string Body string
} }
func (h *HTTPResult) GetResult() string {
return fmt.Sprintf("StatusCode: %d\n\n%s", h.StatusCode, h.Body)
}
type HTTPRunnable struct { type HTTPRunnable struct {
URL string URL string
Method string Method string
...@@ -90,17 +94,17 @@ func (h *HTTPRunnable) GetType() string { ...@@ -90,17 +94,17 @@ func (h *HTTPRunnable) GetType() string {
return "http" return "http"
} }
func (c *HTTPRunnable) GetPersistence() RunnableImport { func (h *HTTPRunnable) GetPersistence() RunnableImport {
data := JSONMap{ data := JSONMap{
"url": c.URL, "url": h.URL,
"method": c.Method, "method": h.Method,
"header": c.Header, "header": h.Header,
"body": c.Body, "body": h.Body,
} }
return RunnableImport{ return RunnableImport{
Type: c.GetType(), Type: h.GetType(),
Data: data, Data: data,
} }
} }
...@@ -75,6 +75,10 @@ type MailResult struct { ...@@ -75,6 +75,10 @@ type MailResult struct {
SmtpStatusCode uint 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 { type MailRunnable struct {
To string To string
From string From string
...@@ -146,22 +150,22 @@ func (m *MailRunnable) GetType() string { ...@@ -146,22 +150,22 @@ func (m *MailRunnable) GetType() string {
return "mail" return "mail"
} }
func (c *MailRunnable) GetPersistence() RunnableImport { func (m *MailRunnable) GetPersistence() RunnableImport {
data := JSONMap{ data := JSONMap{
"to": c.To, "to": m.To,
"from": c.From, "from": m.From,
"subject": c.Subject, "subject": m.Subject,
"body": c.Body, "body": m.Body,
"server": c.Server, "server": m.Server,
"port": c.Port, "port": m.Port,
"username": c.Username, "username": m.Username,
"password": c.Password, "password": m.Password,
"headers": c.Headers, "headers": m.Headers,
} }
return RunnableImport{ return RunnableImport{
Type: c.GetType(), Type: m.GetType(),
Data: data, Data: data,
} }
} }
...@@ -82,6 +82,10 @@ type SFTPResult struct { ...@@ -82,6 +82,10 @@ type SFTPResult struct {
FilesCopied []string FilesCopied []string
} }
func (s *SFTPResult) GetResult() string {
return fmt.Sprintf("FilesCopied: %v", s.FilesCopied)
}
const ( const (
CredentialTypePassword = "password" CredentialTypePassword = "password"
CredentialTypeKey = "key" CredentialTypeKey = "key"
...@@ -282,23 +286,23 @@ func (s *SFTPRunnable) GetType() string { ...@@ -282,23 +286,23 @@ func (s *SFTPRunnable) GetType() string {
return "sftp" return "sftp"
} }
func (c *SFTPRunnable) GetPersistence() RunnableImport { func (s *SFTPRunnable) GetPersistence() RunnableImport {
data := JSONMap{ data := JSONMap{
"host": c.Host, "host": s.Host,
"port": c.Port, "port": s.Port,
"user": c.User, "user": s.User,
"insecure": c.Insecure, "insecure": s.Insecure,
"credential": c.Credential, "credential": s.Credential,
"credential_type": c.CredentialType, "credential_type": s.CredentialType,
"hostkey": c.HostKey, "hostkey": s.HostKey,
"src_dir": c.SrcDir, "src_dir": s.SrcDir,
"dst_dir": c.DstDir, "dst_dir": s.DstDir,
"transfer_direction": c.TransferDirection, "transfer_direction": s.TransferDirection,
} }
return RunnableImport{ return RunnableImport{
Type: c.GetType(), Type: s.GetType(),
Data: data, Data: data,
} }
} }
...@@ -37,6 +37,10 @@ type ShellResult struct { ...@@ -37,6 +37,10 @@ type ShellResult struct {
ExitCode int ExitCode int
} }
func (s *ShellResult) GetResult() string {
return s.Output
}
type ShellRunnable struct { type ShellRunnable struct {
ScriptPath string ScriptPath string
Script string Script string
...@@ -117,15 +121,15 @@ func (s *ShellRunnable) GetType() string { ...@@ -117,15 +121,15 @@ func (s *ShellRunnable) GetType() string {
return "shell" return "shell"
} }
func (c *ShellRunnable) GetPersistence() RunnableImport { func (s *ShellRunnable) GetPersistence() RunnableImport {
data := JSONMap{ data := JSONMap{
"scriptPath": c.ScriptPath, "scriptPath": s.ScriptPath,
"script": c.Script, "script": s.Script,
} }
return RunnableImport{ return RunnableImport{
Type: c.GetType(), Type: s.GetType(),
Data: data, Data: data,
} }
} }