summaryrefslogtreecommitdiff
path: root/pkg/worker_watcher/interface.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-23 23:38:10 +0300
committerValery Piashchynski <[email protected]>2021-01-23 23:38:10 +0300
commit7fb3cc3588cfde9260a6bb431330ce1e0a71f56d (patch)
tree3200cf2136f7413a7e1cfc6ecdaa83716f9655f9 /pkg/worker_watcher/interface.go
parentee5d34abde7f3931bf939498eb7a8cb170232f4f (diff)
interfaces folder deprecated
Diffstat (limited to 'pkg/worker_watcher/interface.go')
-rw-r--r--pkg/worker_watcher/interface.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/worker_watcher/interface.go b/pkg/worker_watcher/interface.go
new file mode 100644
index 00000000..13991541
--- /dev/null
+++ b/pkg/worker_watcher/interface.go
@@ -0,0 +1,30 @@
+package worker_watcher //nolint:golint,stylecheck
+
+import (
+ "context"
+
+ "github.com/spiral/roadrunner/v2/pkg/worker"
+)
+
+type Watcher interface {
+ // AddToWatch used to add stack to wait its state
+ AddToWatch(workers []worker.SyncWorker) error
+
+ // GetFreeWorker provide first free worker
+ GetFreeWorker(ctx context.Context) (*worker.SyncWorkerImpl, error)
+
+ // PutWorker enqueues worker back
+ PushWorker(w worker.SyncWorker)
+
+ // AllocateNew used to allocate new worker and put in into the WorkerWatcher
+ AllocateNew() error
+
+ // Destroy destroys the underlying stack
+ Destroy(ctx context.Context)
+
+ // WorkersList return all stack w/o removing it from internal storage
+ WorkersList() []*worker.SyncWorkerImpl
+
+ // RemoveWorker remove worker from the stack
+ RemoveWorker(wb worker.SyncWorker) error
+}