Documentation ¶
Index ¶
- type Stack
- func (stack *Stack) Destroy(ctx context.Context)
- func (stack *Stack) FindAndRemoveByPid(pid int64) bool
- func (stack *Stack) IsEmpty() bool
- func (stack *Stack) Pop() (*worker.SyncWorkerImpl, bool)
- func (stack *Stack) Push(w worker.BaseProcess)
- func (stack *Stack) Reset()
- func (stack *Stack) Workers() []worker.SyncWorker
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func NewWorkersStack ¶
func (*Stack) FindAndRemoveByPid ¶
func (*Stack) Push ¶
func (stack *Stack) Push(w worker.BaseProcess)
Push worker back to the stack If stack in destroy state, Push will provide 100ms window to unlock the mutex
func (*Stack) Workers ¶
func (stack *Stack) Workers() []worker.SyncWorker
Workers return copy of the workers in the stack
type Watcher ¶
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.SyncWorker, 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.SyncWorker // RemoveWorker remove worker from the stack RemoveWorker(wb worker.SyncWorker) error }
Click to show internal directories.
Click to hide internal directories.