container

package
v2.0.0-RC.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewWorkersStack

func NewWorkersStack(initialNumOfWorkers uint64) *Stack

func (*Stack) Destroy

func (stack *Stack) Destroy(_ context.Context)

we also have to give a chance to pool to Push worker (return it)

func (*Stack) FindAndRemoveByPid

func (stack *Stack) FindAndRemoveByPid(pid int64) bool

func (*Stack) IsEmpty

func (stack *Stack) IsEmpty() bool

func (*Stack) Pop

func (stack *Stack) Pop() (worker.BaseProcess, bool)

func (*Stack) Push

func (stack *Stack) Push(w worker.BaseProcess)

Push worker back to the vec If vec in destroy state, Push will provide 100ms window to unlock the mutex

func (*Stack) Reset

func (stack *Stack) Reset()

func (*Stack) Workers

func (stack *Stack) Workers() []worker.BaseProcess

Workers return copy of the workers in the vec

type Vec

type Vec struct {
	// contains filtered or unexported fields
}

func (*Vec) Dequeue

func (v *Vec) Dequeue() (worker.BaseProcess, bool)

func (*Vec) Destroy

func (v *Vec) Destroy()

func (*Vec) Enqueue

func (v *Vec) Enqueue(w worker.BaseProcess)

type Vector

type Vector interface {
	// Enqueue used to put worker to the vector
	Enqueue(worker.BaseProcess)
	// Dequeue used to get worker from the vector
	Dequeue() (worker.BaseProcess, bool)
	// Destroy used to stop releasing the workers
	Destroy()
}

Vector interface represents vector container

func NewVector

func NewVector(initialNumOfWorkers uint64) Vector

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL