12 lines
383 B
Go
12 lines
383 B
Go
|
|
package worker
|
||
|
|
|
||
|
|
// Provider dispatches tasks to the pool.
|
||
|
|
// Inject Provider into callers that only need to submit work;
|
||
|
|
// use Component at the launcher registration site.
|
||
|
|
type Provider interface {
|
||
|
|
// Dispatch queues a task. Returns false if the queue is full (backpressure).
|
||
|
|
Dispatch(task Task) bool
|
||
|
|
// Len returns the current number of tasks waiting in the queue.
|
||
|
|
Len() int
|
||
|
|
}
|