Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Created is the initial task state. Created = "created" // Pending state is when a worker has marked the task for processing // indicating to other workers that they should not process the task. Pending = "pending" // Done state is when the task is completed. // TODO(penkovski): do we need this state if task is deleted after it is done? Done = "done" // Failed state is when the task execution failed but the task is part // of a group and later execution is not possible, so it could not be "Unack"-ed Failed = "failed" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GroupTemplate ¶
type Queue ¶
type Queue interface { // Task related methods Add(ctx context.Context, task *Task) error Poll(ctx context.Context) (*Task, error) Ack(ctx context.Context, task *Task) error Unack(ctx context.Context, task *Task) error // TaskList related methods AddTaskList(ctx context.Context, taskList *TaskList, tasks []*Task) error PollList(ctx context.Context) (*TaskList, error) AckList(ctx context.Context, taskList *TaskList) error AckGroupTasks(ctx context.Context, group *Group) error }
type Storage ¶
type Storage interface { // Task related methods Task(ctx context.Context, taskID string) (*Task, error) TaskTemplate(ctx context.Context, taskName string) (*Task, error) TaskHistory(ctx context.Context, taskID string) (*Task, error) SaveTaskHistory(ctx context.Context, task *Task) error // TaskList related methods TaskList(ctx context.Context, taskListID string) (*TaskList, error) TaskListTemplate(ctx context.Context, taskListName string) (*Template, error) TaskTemplates(ctx context.Context, names []string) (map[string]*Task, error) TaskListHistory(ctx context.Context, taskListID string) (*TaskList, error) GetGroupTasks(ctx context.Context, group *Group) ([]*Task, error) SaveTaskListHistory(ctx context.Context, task *TaskList) error // EventTask related methods EventTask(ctx context.Context, key, namespace, scope string) (*EventTask, error) }
type Task ¶
type Task struct { ID string `json:"id"` // ID is unique task identifier. GroupID string `json:"groupID"` // GroupID is set when the task is part of `tasklist.Group`. Name string `json:"name"` // Name is used by external callers use to create tasks. State State `json:"state"` // State of the task. URL string `json:"url"` // URL against which the task request will be executed (optional). Method string `json:"method"` // HTTP method of the task request (optional). Request []byte `json:"request"` // Request body which will be sent in the task request. Response []byte `json:"response"` // Response received after the task request is executed. ResponseCode int `json:"responseCode"` // ResponseCode received after task request is executed. RequestPolicy string `json:"requestPolicy"` // RequestPolicy to be executed before task request execution. ResponsePolicy string `json:"responsePolicy"` // ResponsePolicy to be executed on the task response. FinalPolicy string `json:"finalPolicy"` // FinalPolicy to be executed on the task response. CacheNamespace string `json:"cacheNamespace"` // CacheNamespace if set, is used for constructing cache key. CacheScope string `json:"cacheScope"` // CacheScope if set, is used for constructing cache key. Retries int `json:"retries"` // Retries is the number of failed attempts to execute this task CreatedAt time.Time `json:"createdAt"` // CreatedAt specifies task creation time. StartedAt time.Time `json:"startedAt"` // StartedAt specifies task execution start time. FinishedAt time.Time `json:"finishedAt"` // FinishedAt specifies the time when the task is done. }
type TaskList ¶
type TaskList struct { ID string `json:"id"` Name string `json:"name"` State State `json:"state"` Groups []Group `json:"groups"` Request []byte `json:"request"` CacheNamespace string `json:"cacheNamespace"` CacheScope string `json:"cacheScope"` CreatedAt time.Time `json:"createdAt"` StartedAt time.Time `json:"startedAt"` FinishedAt time.Time `json:"finishedAt"` }
Directories
¶
Path | Synopsis |
---|---|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
taskfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
tasklistfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Click to show internal directories.
Click to hide internal directories.