Documentation
¶
Overview ¶
Package task is a generated GoMock package.
Index ¶
- type BreakableResult
- type Context
- type ContinuableResult
- type MockBreakableResult
- type MockBreakableResultMockRecorder
- type MockContext
- type MockContextMockRecorder
- func (mr *MockContextMockRecorder[T]) Deadline() *gomock.Call
- func (mr *MockContextMockRecorder[T]) Done() *gomock.Call
- func (mr *MockContextMockRecorder[T]) Err() *gomock.Call
- func (mr *MockContextMockRecorder[T]) Self() *gomock.Call
- func (mr *MockContextMockRecorder[T]) Value(key any) *gomock.Call
- type MockContinuableResult
- type MockContinuableResultMockRecorder
- type MockResult
- type MockResultMockRecorder
- type MockTask
- type MockTaskMockRecorder
- type MockTaskReporter
- type MockTaskReporterMockRecorder
- type MockTaskRunner
- type MockTaskRunnerMockRecorder
- type MockWithMessage
- type MockWithMessageMockRecorder
- type Result
- type Task
- type TaskReporter
- type TaskRunner
- type WithMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BreakableResult ¶
type BreakableResult interface {
WithMessage
// Break will stop task execution
Break() WithMessage
}
BreakableResult defines a result which can stop task execution
func Complete ¶
func Complete() BreakableResult
Complete means complete the current task and run the next one
func Retry ¶
func Retry(dur time.Duration) BreakableResult
Retry means continue all next tasks and retry after dur
type Context ¶
Context is a wrapper of any struct which can return its self It's defined to avoid calling ctx.Value()
type ContinuableResult ¶
type ContinuableResult interface {
WithMessage
// Continue ignores errs of the current task and will continue task execution
Continue() WithMessage
}
ContinuableResult defines a result which can continue task execution
type MockBreakableResult ¶
type MockBreakableResult struct {
// contains filtered or unexported fields
}
MockBreakableResult is a mock of BreakableResult interface.
func NewMockBreakableResult ¶
func NewMockBreakableResult(ctrl *gomock.Controller) *MockBreakableResult
NewMockBreakableResult creates a new mock instance.
func (*MockBreakableResult) Break ¶
func (m *MockBreakableResult) Break() WithMessage
Break mocks base method.
func (*MockBreakableResult) EXPECT ¶
func (m *MockBreakableResult) EXPECT() *MockBreakableResultMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockBreakableResultMockRecorder ¶
type MockBreakableResultMockRecorder struct {
// contains filtered or unexported fields
}
MockBreakableResultMockRecorder is the mock recorder for MockBreakableResult.
func (*MockBreakableResultMockRecorder) Break ¶
func (mr *MockBreakableResultMockRecorder) Break() *gomock.Call
Break indicates an expected call of Break.
type MockContext ¶
type MockContext[T any] struct { // contains filtered or unexported fields }
MockContext is a mock of Context interface.
func NewMockContext ¶
func NewMockContext[T any](ctrl *gomock.Controller) *MockContext[T]
NewMockContext creates a new mock instance.
func (*MockContext[T]) Deadline ¶
func (m *MockContext[T]) Deadline() (time.Time, bool)
Deadline mocks base method.
func (*MockContext[T]) Done ¶
func (m *MockContext[T]) Done() <-chan struct{}
Done mocks base method.
func (*MockContext[T]) EXPECT ¶
func (m *MockContext[T]) EXPECT() *MockContextMockRecorder[T]
EXPECT returns an object that allows the caller to indicate expected use.
type MockContextMockRecorder ¶
type MockContextMockRecorder[T any] struct { // contains filtered or unexported fields }
MockContextMockRecorder is the mock recorder for MockContext.
func (*MockContextMockRecorder[T]) Deadline ¶
func (mr *MockContextMockRecorder[T]) Deadline() *gomock.Call
Deadline indicates an expected call of Deadline.
func (*MockContextMockRecorder[T]) Done ¶
func (mr *MockContextMockRecorder[T]) Done() *gomock.Call
Done indicates an expected call of Done.
func (*MockContextMockRecorder[T]) Err ¶
func (mr *MockContextMockRecorder[T]) Err() *gomock.Call
Err indicates an expected call of Err.
func (*MockContextMockRecorder[T]) Self ¶
func (mr *MockContextMockRecorder[T]) Self() *gomock.Call
Self indicates an expected call of Self.
type MockContinuableResult ¶
type MockContinuableResult struct {
// contains filtered or unexported fields
}
MockContinuableResult is a mock of ContinuableResult interface.
func NewMockContinuableResult ¶
func NewMockContinuableResult(ctrl *gomock.Controller) *MockContinuableResult
NewMockContinuableResult creates a new mock instance.
func (*MockContinuableResult) Continue ¶
func (m *MockContinuableResult) Continue() WithMessage
Continue mocks base method.
func (*MockContinuableResult) EXPECT ¶
func (m *MockContinuableResult) EXPECT() *MockContinuableResultMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockContinuableResultMockRecorder ¶
type MockContinuableResultMockRecorder struct {
// contains filtered or unexported fields
}
MockContinuableResultMockRecorder is the mock recorder for MockContinuableResult.
func (*MockContinuableResultMockRecorder) Continue ¶
func (mr *MockContinuableResultMockRecorder) Continue() *gomock.Call
Continue indicates an expected call of Continue.
type MockResult ¶
type MockResult struct {
// contains filtered or unexported fields
}
MockResult is a mock of Result interface.
func NewMockResult ¶
func NewMockResult(ctrl *gomock.Controller) *MockResult
NewMockResult creates a new mock instance.
func (*MockResult) EXPECT ¶
func (m *MockResult) EXPECT() *MockResultMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockResult) RequeueAfter ¶
func (m *MockResult) RequeueAfter() time.Duration
RequeueAfter mocks base method.
func (*MockResult) ShouldContinue ¶
func (m *MockResult) ShouldContinue() bool
ShouldContinue mocks base method.
type MockResultMockRecorder ¶
type MockResultMockRecorder struct {
// contains filtered or unexported fields
}
MockResultMockRecorder is the mock recorder for MockResult.
func (*MockResultMockRecorder) IsFailed ¶
func (mr *MockResultMockRecorder) IsFailed() *gomock.Call
IsFailed indicates an expected call of IsFailed.
func (*MockResultMockRecorder) Message ¶
func (mr *MockResultMockRecorder) Message() *gomock.Call
Message indicates an expected call of Message.
func (*MockResultMockRecorder) RequeueAfter ¶
func (mr *MockResultMockRecorder) RequeueAfter() *gomock.Call
RequeueAfter indicates an expected call of RequeueAfter.
func (*MockResultMockRecorder) ShouldContinue ¶
func (mr *MockResultMockRecorder) ShouldContinue() *gomock.Call
ShouldContinue indicates an expected call of ShouldContinue.
type MockTask ¶
type MockTask[T any] struct { // contains filtered or unexported fields }
MockTask is a mock of Task interface.
func NewMockTask ¶
func NewMockTask[T any](ctrl *gomock.Controller) *MockTask[T]
NewMockTask creates a new mock instance.
func (*MockTask[T]) EXPECT ¶
func (m *MockTask[T]) EXPECT() *MockTaskMockRecorder[T]
EXPECT returns an object that allows the caller to indicate expected use.
type MockTaskMockRecorder ¶
type MockTaskMockRecorder[T any] struct { // contains filtered or unexported fields }
MockTaskMockRecorder is the mock recorder for MockTask.
func (*MockTaskMockRecorder[T]) Name ¶
func (mr *MockTaskMockRecorder[T]) Name() *gomock.Call
Name indicates an expected call of Name.
type MockTaskReporter ¶
type MockTaskReporter struct {
// contains filtered or unexported fields
}
MockTaskReporter is a mock of TaskReporter interface.
func NewMockTaskReporter ¶
func NewMockTaskReporter(ctrl *gomock.Controller) *MockTaskReporter
NewMockTaskReporter creates a new mock instance.
func (*MockTaskReporter) AddResult ¶
func (m *MockTaskReporter) AddResult(name, status, msg string)
AddResult mocks base method.
func (*MockTaskReporter) EXPECT ¶
func (m *MockTaskReporter) EXPECT() *MockTaskReporterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTaskReporter) Summary ¶
func (m *MockTaskReporter) Summary() string
Summary mocks base method.
type MockTaskReporterMockRecorder ¶
type MockTaskReporterMockRecorder struct {
// contains filtered or unexported fields
}
MockTaskReporterMockRecorder is the mock recorder for MockTaskReporter.
func (*MockTaskReporterMockRecorder) AddResult ¶
func (mr *MockTaskReporterMockRecorder) AddResult(name, status, msg any) *gomock.Call
AddResult indicates an expected call of AddResult.
func (*MockTaskReporterMockRecorder) Summary ¶
func (mr *MockTaskReporterMockRecorder) Summary() *gomock.Call
Summary indicates an expected call of Summary.
type MockTaskRunner ¶
type MockTaskRunner[T any] struct { // contains filtered or unexported fields }
MockTaskRunner is a mock of TaskRunner interface.
func NewMockTaskRunner ¶
func NewMockTaskRunner[T any](ctrl *gomock.Controller) *MockTaskRunner[T]
NewMockTaskRunner creates a new mock instance.
func (*MockTaskRunner[T]) AddTasks ¶
func (m *MockTaskRunner[T]) AddTasks(tasks ...Task[T])
AddTasks mocks base method.
func (*MockTaskRunner[T]) EXPECT ¶
func (m *MockTaskRunner[T]) EXPECT() *MockTaskRunnerMockRecorder[T]
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTaskRunner[T]) Run ¶
func (m *MockTaskRunner[T]) Run(ctx Context[T]) (controller_runtime.Result, error)
Run mocks base method.
type MockTaskRunnerMockRecorder ¶
type MockTaskRunnerMockRecorder[T any] struct { // contains filtered or unexported fields }
MockTaskRunnerMockRecorder is the mock recorder for MockTaskRunner.
type MockWithMessage ¶
type MockWithMessage struct {
// contains filtered or unexported fields
}
MockWithMessage is a mock of WithMessage interface.
func NewMockWithMessage ¶
func NewMockWithMessage(ctrl *gomock.Controller) *MockWithMessage
NewMockWithMessage creates a new mock instance.
func (*MockWithMessage) EXPECT ¶
func (m *MockWithMessage) EXPECT() *MockWithMessageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockWithMessageMockRecorder ¶
type MockWithMessageMockRecorder struct {
// contains filtered or unexported fields
}
MockWithMessageMockRecorder is the mock recorder for MockWithMessage.
type Result ¶
type Result interface {
IsFailed() bool
ShouldContinue() bool
RequeueAfter() time.Duration
Message() string
}
Result defines the result of a task
type TaskReporter ¶
TaskReporter appends results of tasks and output a summary
func NewTableTaskReporter ¶
func NewTableTaskReporter() TaskReporter
type TaskRunner ¶
type TaskRunner[T any] interface { AddTasks(tasks ...Task[T]) Run(ctx Context[T]) (ctrl.Result, error) }
TaskRunner is an executor to run a series of tasks sequentially
func NewTaskRunner ¶
func NewTaskRunner[T any](reporter TaskReporter) TaskRunner[T]
NewTaskRunner creates a TaskRunner with the given reporter and tasks. There are five status of tasks - Complete: means this task is complete and all is expected - Failed: means an err occurred - Retry: means this task need to wait an interval and retry - NotRun: means this task is not run - Skip: means this task is skipped And five results of reconiling 1. All tasks are complete, the key will not be re-added 2. Some tasks are failed, return err and wait with backoff 3. Some tasks need retry, requeue after an interval 4. Some tasks are not run, return err and wait with backoff 5. Particular tasks are complete and left are skipped, the key will not be re-added
type WithMessage ¶
WithMessage defines an interface to set message into task result