Documentation
¶
Index ¶
- type Allocator
- type WorkerWatcher
- func (ww *WorkerWatcher) AddWorker() error
- func (ww *WorkerWatcher) Allocate() error
- func (ww *WorkerWatcher) Destroy(ctx context.Context)
- func (ww *WorkerWatcher) FreeWorkers() int
- func (ww *WorkerWatcher) List() []*worker.Process
- func (ww *WorkerWatcher) NumWorkers() uint64
- func (ww *WorkerWatcher) Release(w *worker.Process)
- func (ww *WorkerWatcher) RemoveWorker(ctx context.Context) error
- func (ww *WorkerWatcher) Reset(ctx context.Context) uint64
- func (ww *WorkerWatcher) Take(ctx context.Context) (*worker.Process, error)
- func (ww *WorkerWatcher) Watch(workers []*worker.Process)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WorkerWatcher ¶
type WorkerWatcher struct {
// contains filtered or unexported fields
}
func NewSyncWorkerWatcher ¶
func NewSyncWorkerWatcher(allocator Allocator, log *slog.Logger, numWorkers uint64, allocateTimeout time.Duration) *WorkerWatcher
NewSyncWorkerWatcher is a constructor for the Watcher
func (*WorkerWatcher) AddWorker ¶
func (ww *WorkerWatcher) AddWorker() error
func (*WorkerWatcher) Allocate ¶
func (ww *WorkerWatcher) Allocate() error
func (*WorkerWatcher) Destroy ¶
func (ww *WorkerWatcher) Destroy(ctx context.Context)
Destroy all underlying containers (but let them complete the task)
func (*WorkerWatcher) FreeWorkers ¶
func (ww *WorkerWatcher) FreeWorkers() int
FreeWorkers returns the number of workers currently idling in the container.
func (*WorkerWatcher) List ¶
func (ww *WorkerWatcher) List() []*worker.Process
List - this is O(n) operation, and it will return copy of the actual workers
func (*WorkerWatcher) NumWorkers ¶
func (ww *WorkerWatcher) NumWorkers() uint64
NumWorkers returns the live number of workers tracked by the watcher.
func (*WorkerWatcher) Release ¶
func (ww *WorkerWatcher) Release(w *worker.Process)
Release O(1) operation
func (*WorkerWatcher) RemoveWorker ¶
func (ww *WorkerWatcher) RemoveWorker(ctx context.Context) error
func (*WorkerWatcher) Watch ¶
func (ww *WorkerWatcher) Watch(workers []*worker.Process)
Click to show internal directories.
Click to hide internal directories.