diff options
Diffstat (limited to 'pkg/worker_watcher/interface.go')
-rw-r--r-- | pkg/worker_watcher/interface.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/pkg/worker_watcher/interface.go b/pkg/worker_watcher/interface.go index 927aa270..ce5011c0 100644 --- a/pkg/worker_watcher/interface.go +++ b/pkg/worker_watcher/interface.go @@ -6,25 +6,26 @@ import ( "github.com/spiral/roadrunner/v2/pkg/worker" ) +// Watcher is an interface for the Sync workers lifecycle type Watcher interface { - // AddToWatch used to add stack to wait its state - AddToWatch(workers []worker.SyncWorker) error + // Watch used to add workers to the stack + Watch(workers []worker.SyncWorker) error - // GetFreeWorker provide first free worker - GetFreeWorker(ctx context.Context) (worker.SyncWorker, error) + // Get provide first free worker + Get(ctx context.Context) (worker.SyncWorker, error) - // PutWorker enqueues worker back - PushWorker(w worker.SyncWorker) + // Push enqueues worker back + Push(w worker.SyncWorker) - // AllocateNew used to allocate new worker and put in into the WorkerWatcher - AllocateNew() error + // 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 - WorkersList() []worker.SyncWorker + List() []worker.SyncWorker // RemoveWorker remove worker from the stack - RemoveWorker(wb worker.SyncWorker) error + Remove(wb worker.SyncWorker) error } |