Documentation ¶
Index ¶
Constants ¶
View Source
const ( DuplicateWorkPolicyOverride = "override" DuplicateWorkPolicyDiscard = "discard" )
View Source
const WorkNameSeperator = "/"
WorkNameSeperator is used to assemble standard work-name and we have assumptions below, for work-name 'a/b/c': - 'a' and 'b' are specified identifiers for objects/triggers(etc.) on the action - 'c' is a general identifier for actions
Variables ¶
This section is empty.
Functions ¶
func EmitAsyncedMetrics ¶ added in v0.4.0
EmitAsyncedMetrics emit metrics through metricEmitter and metricName parsed from context
Types ¶
type AsyncLimitedWorkers ¶ added in v0.5.4
type AsyncLimitedWorkers struct {
// contains filtered or unexported fields
}
func NewAsyncLimitedWorkers ¶ added in v0.5.4
func NewAsyncLimitedWorkers(name string, limit int, emitter metrics.MetricEmitter) *AsyncLimitedWorkers
func (*AsyncLimitedWorkers) AddWork ¶ added in v0.5.4
func (alw *AsyncLimitedWorkers) AddWork(work *Work, policy DuplicateWorkPolicy) error
func (*AsyncLimitedWorkers) Start ¶ added in v0.5.4
func (alw *AsyncLimitedWorkers) Start(stopCh <-chan struct{}) error
type AsyncWorkers ¶
type AsyncWorkers struct {
// contains filtered or unexported fields
}
func NewAsyncWorkers ¶
func NewAsyncWorkers(name string, emitter metrics.MetricEmitter) *AsyncWorkers
func (*AsyncWorkers) AddWork ¶
func (aws *AsyncWorkers) AddWork(workName string, work *Work, policy DuplicateWorkPolicy) error
func (*AsyncWorkers) Start ¶
func (aws *AsyncWorkers) Start(stopCh <-chan struct{}) error
func (*AsyncWorkers) WorkExists ¶ added in v0.4.1
func (aws *AsyncWorkers) WorkExists(workName string) bool
type DuplicateWorkPolicy ¶ added in v0.4.1
type DuplicateWorkPolicy string
type Work ¶
type Work struct { Name string UID types.UID // Fn is the function to handle the work, // its first param must be of type context.Context, // it's allowed to have any number of other parameters of any type, // and can have only one return value with error type, // its prototype likes func(ctx context.Context, i int, s string, ...) error Fn interface{} // Params are parameters of the fn Params []interface{} // DeliverAt is the time at which the work is delivered DeliveredAt time.Time }
Work contains details to handle by workers
Click to show internal directories.
Click to hide internal directories.