Documentation
¶
Overview ¶
Package actorify lets you transform a parallel operation into a serialized operation via the Actor pattern1.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrActorDied is returned when the actor inbox or reply channel was closed. ErrActorDied = errors.New("actorify: the actor inbox or reply channel was closed") )
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor[Input, Output any] struct { // contains filtered or unexported fields }
Actor is a serializing wrapper that runs a function in a background goroutine. Whenever the Call method is invoked, a message is sent to the actor's inbox and then the callee waits for a response. Depending on how busy the actor is, this may take a moment.
func New ¶
func New[Input, Output any](ctx context.Context, handler Handler[Input, Output]) *Actor[Input, Output]
New constructs a new Actor and starts its background thread. Cancel the context and you cancel the Actor.
Click to show internal directories.
Click to hide internal directories.