2021-07-16 04:10:34 +00:00
|
|
|
package queue
|
|
|
|
|
|
|
|
// Worker interface
|
|
|
|
type Worker interface {
|
2021-07-17 12:14:19 +00:00
|
|
|
BeforeRun() error
|
2021-07-16 11:26:19 +00:00
|
|
|
Run(chan struct{}) error
|
2021-07-17 12:14:19 +00:00
|
|
|
AfterRun() error
|
|
|
|
|
2021-07-16 11:26:19 +00:00
|
|
|
Shutdown() error
|
2021-07-17 17:58:46 +00:00
|
|
|
Queue(job QueuedMessage) error
|
2021-07-16 04:10:34 +00:00
|
|
|
Capacity() int
|
|
|
|
Usage() int
|
|
|
|
}
|
2021-07-17 17:58:46 +00:00
|
|
|
|
|
|
|
// QueuedMessage ...
|
|
|
|
type QueuedMessage interface {
|
|
|
|
Bytes() []byte
|
|
|
|
}
|