pool

package
v0.0.0-...-b112479 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorPool

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

ActorPool implements thread-pool like behavior in the actor system. It is given a function to handle tasks, and will call this function with each task submitted to the actor pool.

func NewActorPool

func NewActorPool(
	system *actor.System,
	queueLimit uint,
	workersLimit uint,
	name string,
	taskHandler func(actorId uint64, task interface{}, ctx *actor.Context) interface{},
	callback func(result interface{}),
) ActorPool

NewActorPool initializes a new actor pool and starts its manager actor.

func (*ActorPool) Receive

func (p *ActorPool) Receive(ctx *actor.Context) error

Receive handles all the messages for the actor pool manager.

func (*ActorPool) SubmitTask

func (p *ActorPool) SubmitTask(task interface{}) error

SubmitTask is a convenience function for sending a task to the actor pool's manager actor.

type QueueFullError

type QueueFullError struct{}

QueueFullError is returned by SubmitTask when the pool is so backed up that the queue is full.

func (QueueFullError) Error

func (e QueueFullError) Error() string

Jump to

Keyboard shortcuts

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