diff options
author | Valery Piashchynski <[email protected]> | 2020-12-17 03:16:55 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-17 03:16:55 +0300 |
commit | 40cfd9f6b44dfe987bfbf010bf67b32abdc64208 (patch) | |
tree | 10e3c3cd0805619ac30533078eb7d2585877a1b3 /interfaces/worker/watcher.go | |
parent | 9d5fe4f6a98b30fd73be8259f84fa595ac994a71 (diff) |
Now better
Diffstat (limited to 'interfaces/worker/watcher.go')
-rw-r--r-- | interfaces/worker/watcher.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/interfaces/worker/watcher.go b/interfaces/worker/watcher.go new file mode 100644 index 00000000..ce2c1c5a --- /dev/null +++ b/interfaces/worker/watcher.go @@ -0,0 +1,26 @@ +package worker + +import "context" + +type Watcher interface { + // AddToWatch used to add stack to wait its state + AddToWatch(workers []BaseProcess) error + + // GetFreeWorker provide first free worker + GetFreeWorker(ctx context.Context) (BaseProcess, error) + + // PutWorker enqueues worker back + PushWorker(w BaseProcess) + + // 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() []BaseProcess + + // RemoveWorker remove worker from the stack + RemoveWorker(wb BaseProcess) error +} |