github.com/jacobsoderblom/buffalo@v0.11.0/worker/worker.go (about) 1 package worker 2 3 import ( 4 "context" 5 "time" 6 ) 7 8 // Handler function that will be run by the worker and given 9 // a slice of arguments 10 type Handler func(Args) error 11 12 // Worker interface that needs to be implemented to be considered 13 // a "worker" 14 type Worker interface { 15 // Start the worker with the given context 16 Start(context.Context) error 17 // Stop the worker 18 Stop() error 19 // Perform a job as soon as possibly 20 Perform(Job) error 21 // PerformAt performs a job at a particular time 22 PerformAt(Job, time.Time) error 23 // PerformIn performs a job after waiting for a specified amount of time 24 PerformIn(Job, time.Duration) error 25 // Register a Handler 26 Register(string, Handler) error 27 }