Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMailboxFull is returned when casting to a full mailbox ErrMailboxFull = errors.New("mailbox is full") // ErrMailboxClosed is returned when casting to a closed mailbox ErrMailboxClosed = errors.New("mailbox is closed") )
Functions ¶
Types ¶
type Mailbox ¶
type Mailbox[T any] struct { // contains filtered or unexported fields }
Mailbox is a generic, thread-safe message queue for actors.
func NewMailbox ¶
NewMailbox creates a new mailbox with the specified buffer size. A size of 0 means unbuffered (synchronous).
func (*Mailbox[T]) Cast ¶
Cast sends a message asynchronously. It returns an error if the mailbox is full or closed.
type RestartPolicy ¶
type RestartPolicy uint8
const ( Permanent RestartPolicy = iota // Always restart, even on clean exits Transient // Restart on errors/panics, but not on clean exits (nil) Temporary // Never restart )
type Supervisor ¶
type Supervisor struct {
Policy RestartPolicy
RestartDelay time.Duration
MaxRestarts int
RestartWindow time.Duration
OnError func(error) // Hook to trigger escalation (e.g., One-For-All)
// contains filtered or unexported fields
}
Supervisor manages the lifecycle of actor Run loops.
func (*Supervisor) Go ¶
Go starts the actor's Run function in a background goroutine and supervises it.
func (*Supervisor) Wait ¶
func (s *Supervisor) Wait()
Wait blocks until all actors managed by this supervisor have stopped.
Click to show internal directories.
Click to hide internal directories.