Documentation ¶
Index ¶
- Constants
- func StopAllControllers()
- type Controller
- type Delegator
- type EventProcessStatus
- func (eps EventProcessStatus) CreateChildEvent(ctx context.Context, ...) (childContext context.Context, childStatusChan chan EventProcessStatus)
- func (eps EventProcessStatus) Send(statusChan chan EventProcessStatus) EventStatus
- func (eps EventProcessStatus) SendClose(statusChan chan EventProcessStatus) EventStatus
- func (eps EventProcessStatus) SkipClose(statusChan chan EventProcessStatus) EventStatus
- func (eps EventProcessStatus) WithError(err error) EventProcessStatus
- func (eps EventProcessStatus) WithMaxRetry(count int) EventProcessStatus
- func (eps EventProcessStatus) WithMessage(key string, value string) EventProcessStatus
- func (eps EventProcessStatus) WithRetry() EventProcessStatus
- func (eps EventProcessStatus) WithStatus(status EventStatus) EventProcessStatus
- type EventStatus
- type InformerCacheObj
- type Opts
- type TerminatingEventStatus
Constants ¶
const ( DefaultMaxRetryCount = 5 DefaultEventStatusBufferedChannelSize = 5 )
Variables ¶
This section is empty.
Functions ¶
func StopAllControllers ¶
func StopAllControllers()
Types ¶
type Controller ¶
type Controller struct { Delegator // contains filtered or unexported fields }
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context)
Run starts the controller's informer and the starts processing the items in the queue.
type Delegator ¶
type Delegator interface { Added(context.Context, interface{}, chan EventProcessStatus) Updated(context.Context, interface{}, interface{}, chan EventProcessStatus) Deleted(context.Context, interface{}, chan EventProcessStatus) GetInformer() cache.SharedIndexInformer Status(context.Context, EventProcessStatus) }
Delegator interface contains the methods that are required.
func NewController ¶
NewController creates a new controller with the given name, informer, and stop channel.
type EventProcessStatus ¶
type EventProcessStatus struct { MaxRetryCount int Status EventStatus RetryCount int Retry bool RetryAfter time.Duration Message map[string]string Error error ChildEventContext context.Context ChildEventChan chan EventProcessStatus ChildOnStatus func(ctx context.Context, status EventProcessStatus) }
func NewEventProcessStatus ¶
func NewEventProcessStatus() EventProcessStatus
NewEventProcessStatus returns a new EventProcessStatus with default values
Default values: ¶
Status: EventSuccess MaxRetryCount: DefaultMaxRetryCount=5
func NewEventProcessStatusWithStatus ¶
func NewEventProcessStatusWithStatus(eventStatus EventProcessStatus) EventProcessStatus
func (EventProcessStatus) CreateChildEvent ¶
func (eps EventProcessStatus) CreateChildEvent(ctx context.Context, childOnStatus func(ctx context.Context, status EventProcessStatus), statusChan chan EventProcessStatus) (childContext context.Context, childStatusChan chan EventProcessStatus)
CreateChildEvent creates a child event with childEventId and returns the child event status channel. If statusChan is nil, it will return nil for childStatusChan. If childOnStatus is nil, it will use the parent event's OnStatus function.
func (EventProcessStatus) Send ¶
func (eps EventProcessStatus) Send(statusChan chan EventProcessStatus) EventStatus
Send sends the event status to the event status channel It does not close the event status channel and can be used to send multiple event statuses NOTE: Send can be called multiple times for a given event but SendClose can be called only once.
func (EventProcessStatus) SendClose ¶
func (eps EventProcessStatus) SendClose(statusChan chan EventProcessStatus) EventStatus
SendClose must be called for every event only once to send the final event status and close the channel Calling SendClose more than once will result in a panic Use Send() if you do not want to close the channel and want to send multiple event statuses NOTE: Send() can be called multiple times for a given event but SendClose() can be called only once.
func (EventProcessStatus) SkipClose ¶
func (eps EventProcessStatus) SkipClose(statusChan chan EventProcessStatus) EventStatus
SkipClose must be called for a event only once to send skip status and close the channel.
func (EventProcessStatus) WithError ¶
func (eps EventProcessStatus) WithError(err error) EventProcessStatus
func (EventProcessStatus) WithMaxRetry ¶
func (eps EventProcessStatus) WithMaxRetry(count int) EventProcessStatus
func (EventProcessStatus) WithMessage ¶
func (eps EventProcessStatus) WithMessage(key string, value string) EventProcessStatus
func (EventProcessStatus) WithRetry ¶
func (eps EventProcessStatus) WithRetry() EventProcessStatus
func (EventProcessStatus) WithStatus ¶
func (eps EventProcessStatus) WithStatus(status EventStatus) EventProcessStatus
type EventStatus ¶
type EventStatus string
const ( EventCreateChild EventStatus = "CreateChildEvent" EventSkip EventStatus = "Skip" EventRetry EventStatus = "Retry" EventMaxRetryReached EventStatus = "MaxRetryReached" EventCompleted EventStatus = "Completed" EventFailure EventStatus = "Failure" EventProcessing EventStatus = "Processing" EventPartialCompleted EventStatus = "PartialCompleted" )
func (EventStatus) String ¶
func (es EventStatus) String() string
type InformerCacheObj ¶
type InformerCacheObj struct {
// contains filtered or unexported fields
}
type Opts ¶
type Opts struct { Name string Context context.Context Delegator Delegator Informer cache.SharedIndexInformer Queue workqueue.RateLimitingInterface WorkerConcurrency int // Number of workers to run for the controller }
type TerminatingEventStatus ¶
type TerminatingEventStatus EventStatus