blob: ce5011c0fa699e631d9c130eb6752ddc15fcb70b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package worker_watcher //nolint:golint,stylecheck
import (
"context"
"github.com/spiral/roadrunner/v2/pkg/worker"
)
// Watcher is an interface for the Sync workers lifecycle
type Watcher interface {
// Watch used to add workers to the stack
Watch(workers []worker.SyncWorker) error
// Get provide first free worker
Get(ctx context.Context) (worker.SyncWorker, error)
// Push enqueues worker back
Push(w worker.SyncWorker)
// Allocate - allocates new worker and put it into the WorkerWatcher
Allocate() error
// Destroy destroys the underlying stack
Destroy(ctx context.Context)
// WorkersList return all stack w/o removing it from internal storage
List() []worker.SyncWorker
// RemoveWorker remove worker from the stack
Remove(wb worker.SyncWorker) error
}
|