pools

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pools contains pool and worker structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BusPool

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

BusPool is a pool of workers.

func NewBusPool

func NewBusPool(
	threadsCnt, queueSize int, wg *sync.WaitGroup, decorators ...pipelines.TaskDecorator,
) *BusPool

NewBusPool creates a pool of workers.

func (*BusPool) Close

func (p *BusPool) Close() (err error)

Close is stopping pool and workers.

func (*BusPool) Push

func (p *BusPool) Push(task pipelines.Task) (err error)

Push is pushing task into pool.

func (*BusPool) Wait

func (p *BusPool) Wait()

Wait blocks until tasks are completed.

type Delayer

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

Delayer is a struct for delayed tasks execution.

func NewDelayer

func NewDelayer(ctx context.Context, ttl time.Duration) *Delayer

NewDelayer is a factory method for Delayer.

func (*Delayer) Close

func (d *Delayer) Close() error

Close is stopping Delayer.

func (*Delayer) Push

func (d *Delayer) Push(task pipelines.Task) error

Push is pushing a task into pool.

func (*Delayer) Wait

func (d *Delayer) Wait()

Wait blocks until tasks are completed.

type HashPool

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

HashPool is a pool of "sticky" workers.

func NewHashPool

func NewHashPool(threadsCnt, queueSize int,
	wg *sync.WaitGroup, hasher pipelines.Hasher, decorators ...pipelines.TaskDecorator,
) *HashPool

NewHashPool creates pool of "sticky" workers.

func (*HashPool) Close

func (p *HashPool) Close() (err error)

Close is stopping pool and workers.

func (*HashPool) Push

func (p *HashPool) Push(task pipelines.Task) (err error)

Push is putting task into pool.

func (*HashPool) Wait

func (p *HashPool) Wait()

Wait blocks until tasks are completed.

type Semaphore

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

Semaphore is a struct for tasks parallel execution.

func NewSemaphore

func NewSemaphore(
	threadsCnt int, wg *sync.WaitGroup, decorators ...pipelines.TaskDecorator,
) *Semaphore

NewSemaphore is a factory for Semaphore.

func (*Semaphore) Close

func (p *Semaphore) Close() (err error)

Close is stopping Semaphore.

func (*Semaphore) Push

func (p *Semaphore) Push(task pipelines.Task) (err error)

Push is pushing task into semaphore.

func (*Semaphore) Wait

func (p *Semaphore) Wait()

Wait blocks until tasks are completed.

Jump to

Keyboard shortcuts

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