static_pool

package
v3.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 15 Imported by: 10

Documentation

Index

Constants

View Source
const (
	MB = 1024 * 1024

	// NSEC_IN_SEC nanoseconds in second
	NSEC_IN_SEC int64 = 1000000000 //nolint:stylecheck
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options func(p *Pool)

func WithLogger

func WithLogger(z *zap.Logger) Options

type Pool

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

Pool controls worker creation, destruction and task routing. Pool uses fixed amount of stack.

func NewPool

func NewPool(ctx context.Context, cmd pool.Command, factory pool.Factory, cfg *pool.Config, log *zap.Logger) (*Pool, error)

NewPool creates new worker pool and task multiplexer. Pool will initiate with one worker. If supervisor configuration is provided -> pool will be turned into a supervisedExec mode

func (*Pool) Destroy

func (sp *Pool) Destroy(ctx context.Context)

Destroy all underlying stack (but let them complete the task).

func (*Pool) Exec

func (sp *Pool) Exec(ctx context.Context, p *payload.Payload) (*payload.Payload, error)

Exec executes provided payload on the worker

func (*Pool) GetConfig

func (sp *Pool) GetConfig() *pool.Config

GetConfig returns associated pool configuration. Immutable.

func (*Pool) QueueSize

func (sp *Pool) QueueSize() uint64

func (*Pool) RemoveWorker

func (sp *Pool) RemoveWorker(wb *worker.Process) error

RemoveWorker function should not be used outside the `Wait` function

func (*Pool) Reset

func (sp *Pool) Reset(ctx context.Context) error

func (*Pool) Start

func (sp *Pool) Start()

func (*Pool) Stop

func (sp *Pool) Stop()

func (*Pool) Workers

func (sp *Pool) Workers() (workers []*worker.Process)

Workers returns worker list associated with the pool.

Jump to

Keyboard shortcuts

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