Documentation ¶
Index ¶
- func NewTaskRunner() *taskRunner
- func NewTaskStatusRunner(identifiers []object.ObjMetadata, statusPoller poller.Poller) *taskStatusRunner
- type Condition
- type Options
- type Task
- type TaskContext
- func (tc *TaskContext) AllResourceUIDs() sets.String
- func (tc *TaskContext) CaptureResourceFailure(id object.ObjMetadata)
- func (tc *TaskContext) EventChannel() chan event.Event
- func (tc *TaskContext) ResourceApplied(id object.ObjMetadata, uid types.UID, gen int64)
- func (tc *TaskContext) ResourceFailed(id object.ObjMetadata) bool
- func (tc *TaskContext) ResourceGeneration(id object.ObjMetadata) (int64, bool)
- func (tc *TaskContext) ResourceUID(id object.ObjMetadata) (types.UID, bool)
- func (tc *TaskContext) TaskChannel() chan TaskResult
- type TaskResult
- type TimedOutResource
- type TimeoutError
- type WaitTask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 Condition ¶ added in v0.10.0
type Condition string
Condition is a type that defines the types of conditions which a WaitTask can use.
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" )
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) AllResourceUIDs ¶ added in v0.20.3
func (tc *TaskContext) AllResourceUIDs() sets.String
AllResourceUIDs returns a set with the UIDs of all the resources in the context.
func (*TaskContext) CaptureResourceFailure ¶ added in v0.22.4
func (tc *TaskContext) CaptureResourceFailure(id object.ObjMetadata)
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, uid types.UID, 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) ResourceFailed ¶ added in v0.22.4
func (tc *TaskContext) ResourceFailed(id object.ObjMetadata) bool
func (*TaskContext) ResourceGeneration ¶ added in v0.8.0
func (tc *TaskContext) ResourceGeneration(id object.ObjMetadata) (int64, bool)
ResourceGeneration looks up the generation of the given resource after it was applied.
func (*TaskContext) ResourceUID ¶ added in v0.20.3
func (tc *TaskContext) ResourceUID(id object.ObjMetadata) (types.UID, bool)
ResourceUID looks up the UID of the given resource
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 TimedOutResource ¶ added in v0.19.0
type TimedOutResource struct { Identifier object.ObjMetadata Status status.Status Message string }
type TimeoutError ¶ added in v0.10.0
type TimeoutError struct { // Identifiers contains the identifiers of all resources that the // WaitTask was waiting for. Identifiers []object.ObjMetadata // Timeout is the amount of time it took before it timed out. Timeout time.Duration // Condition defines the criteria for which the task was waiting. Condition Condition TimedOutResources []TimedOutResource }
TimeoutError is a special error used by tasks when they have timed out.
func IsTimeoutError ¶
func IsTimeoutError(err error) (*TimeoutError, bool)
IsTimeoutError checks whether a given error is a TimeoutError.
func (TimeoutError) Error ¶ added in v0.10.0
func (te TimeoutError) Error() string
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 ¶
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.