Documentation
¶
Index ¶
Constants ¶
const ( // AllCurrent Condition means all the provided resources // has reached (and remains in) the Current status. AllCurrent condition = "AllCurrent" // AllNotFound Condition means all the provided resources // has reached the NotFound status, i.e. they are all deleted // from the cluster. AllNotFound condition = "AllNotFound" )
Variables ¶
This section is empty.
Functions ¶
func IsTimeoutError ¶
IsTimeoutError checks whether a given error is a timeoutError.
func NewTaskRunner ¶
func NewTaskRunner() *taskRunner
NewTaskRunner returns a new taskRunner. It can process taskqueues that does not contain any wait tasks.
func NewTaskStatusRunner ¶
func NewTaskStatusRunner(identifiers []object.ObjMetadata, statusPoller poller.Poller) *taskStatusRunner
NewTaskStatusRunner returns a new TaskStatusRunner.
Types ¶
type Task ¶
type Task interface { Start(taskContext *TaskContext) ClearTimeout() }
Task is the interface that must be implemented by all tasks that will be executed by the taskrunner.
type TaskContext ¶ added in v0.7.0
type TaskContext struct {
// contains filtered or unexported fields
}
TaskContext defines a context that is passed between all the tasks that is in a taskqueue.
func NewTaskContext ¶ added in v0.7.0
func NewTaskContext(eventChannel chan event.Event) *TaskContext
NewTaskContext returns a new TaskContext
func (*TaskContext) EventChannel ¶ added in v0.7.0
func (tc *TaskContext) EventChannel() chan event.Event
func (*TaskContext) ResourceApplied ¶ added in v0.8.0
func (tc *TaskContext) ResourceApplied(id object.ObjMetadata, gen int64)
ResourceApplied updates the context with information about the resource identified by the provided id. Currently, we keep information about the generation of the resource after the apply operation completed.
func (*TaskContext) ResourceGeneration ¶ added in v0.8.0
func (tc *TaskContext) ResourceGeneration(id object.ObjMetadata) int64
ResourceGeneration looks up the generation of the given resource after it was applied.
func (*TaskContext) TaskChannel ¶ added in v0.7.0
func (tc *TaskContext) TaskChannel() chan TaskResult
type TaskResult ¶
type TaskResult struct {
Err error
}
TaskResult is the type returned from tasks once they have completed or failed. If it has failed or timed out, the Err property will be set.
type WaitTask ¶
type WaitTask struct { // Identifiers is the list of resources that we are waiting for. Identifiers []object.ObjMetadata // Condition defines the status we want all resources to reach Condition condition // Timeout defines how long we are willing to wait for the condition // to be met. Timeout time.Duration // contains filtered or unexported fields }
WaitTask is an implementation of the Task interface that is used to wait for a set of resources (identified by a slice of ObjMetadata) will all meet the condition specified. It also specifies a timeout for how long we are willing to wait for this to happen. Unlike other implementations of the Task interface, the wait task is handled in a special way to the taskrunner and is a part of the core package.
func NewWaitTask ¶
func NewWaitTask(ids []object.ObjMetadata, cond condition, timeout time.Duration) *WaitTask
NewWaitTask creates a new wait task where we will wait until the resources specifies by ids all meet the specified condition.
func (*WaitTask) ClearTimeout ¶
func (w *WaitTask) ClearTimeout()
ClearTimeout cancels the timeout for the wait task.
func (*WaitTask) Start ¶
func (w *WaitTask) Start(taskContext *TaskContext)
Start kicks off the task. For the wait task, this just means setting up the timeout timer.