Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoNothingWithErrorsHandler ¶
type DoNothingWithErrorsHandler struct{}
DoNothingWithErrorsHandler does nothing with error values
var DoNothingWithErrors DoNothingWithErrorsHandler
DoNothingWithErrors is the default error handler if none is provided.
func (DoNothingWithErrorsHandler) HandleError ¶
func (dnwe DoNothingWithErrorsHandler) HandleError(err error) error
HandleError does nothing
type ErrorHandler ¶
ErrorHandler is an interface that can process errors.
type Job ¶
type Job struct { Name string Job func(context.Context, ...interface{}) error Retries uint RetryableErrors []error RetryableErrorSubstrings []string RetryFunc RetryFunc Logger interface { Printf(message string, args ...interface{}) } ErrorHandler ErrorHandler }
Job specifies the type of job JobManager can execute. A Job can be customized to have retry behavior.
type JobManager ¶
type JobManager struct { sync.Mutex // Options Identifier string Concurrency uint Logger *log.Logger ErrorHandler ErrorHandler // contains filtered or unexported fields }
JobManager handles the concurrent execution of jobs.
func (*JobManager) AddJob ¶
func (m *JobManager) AddJob(j *Job, args ...interface{})
AddJob adds a Job to the Job manager.
func (*JobManager) Err ¶
func (m *JobManager) Err() error
Err returns the all of the errors resulting from the execution of all jobs.
func (*JobManager) Printf ¶
func (m *JobManager) Printf(message string, args ...interface{})
Printf logs to the JobManager's logger.
func (*JobManager) Run ¶
func (m *JobManager) Run(ctx context.Context)
Run executes all jobs, waiting for them to complete.
Click to show internal directories.
Click to hide internal directories.