More informative return value for task.Process

This commit is contained in:
Lorenzo Bolla
2021-09-20 09:43:44 +02:00
parent 0914cd16af
commit ff51c46915
11 changed files with 156 additions and 127 deletions
+13 -8
View File
@@ -20,8 +20,13 @@ type PublishDetail struct {
RemainingNumberOfPackages int64
}
type ProcessReturnValue struct {
Code int
Value interface{}
}
// Process is a function implementing the actual task logic
type Process func(out aptly.Progress, detail *Detail) (int, error)
type Process func(out aptly.Progress, detail *Detail) (*ProcessReturnValue, error)
const (
// IDLE when task is waiting
@@ -36,13 +41,13 @@ const (
// Task represents as task in a queue encapsulates process code
type Task struct {
output *Output
detail *Detail
process Process
processReturnCode int
Name string
ID int
State State
output *Output
detail *Detail
process Process
processReturnValue *ProcessReturnValue
Name string
ID int
State State
}
// NewTask creates new task