Versions in this module Expand all Collapse all v0 v0.0.13 Jul 6, 2026 v0.0.11 Jun 29, 2026 v0.0.10 Jun 16, 2026 v0.0.9 Jun 15, 2026 v0.0.8 Jun 12, 2026 v0.0.7 Jun 12, 2026 v0.0.6 Jun 4, 2026 v0.0.5 Jun 4, 2026 Changes in this version + const DefaultAskTimeout + const DefaultMailboxCapacity + const LifecycleTopic + var ErrActorNotFound = errors.New("actorlayer: actor not found") + var ErrAskTimeout = errors.New("actorlayer: ask timeout") + var ErrMailboxClosed = errors.New("actorlayer: mailbox closed") + var ErrMailboxDrop = errors.New("actorlayer: message dropped") + var ErrMailboxFull = errors.New("actorlayer: mailbox full") + var ErrMessageTypeMismatch = errors.New("actorlayer: message type mismatch") + var ErrRateLimited = errors.New("actorlayer: rate limited") + var ErrResponseTypeMismatch = errors.New("actorlayer: response type mismatch") + var ErrScheduleCanceled = errors.New("actorlayer: scheduled delivery canceled") + var ErrShuttingDown = errors.New("actorlayer: shutting down") + var ErrUnhandled = errors.New("actorlayer: unhandled message") + type Actor interface + Receive func(ctx Context, env TypedEnvelope[M]) error + func AdaptEventActor[M any](eventActor EventActor[M]) Actor[M] + func AdaptRequestActor[Req any, Resp any](requestActor RequestActor[Req, Resp]) Actor[Req] + type ActorFunc func(ctx Context, env TypedEnvelope[M]) error + func (f ActorFunc[M]) Receive(ctx Context, env TypedEnvelope[M]) error + type ActorID string + type ActorRef struct + func SpawnTyped[M any](ctx context.Context, sys *System, name string, props TypedProps[M], ...) (ActorRef[M], error) + func (r ActorRef[M]) ID() ActorID + func (r ActorRef[M]) Tell(ctx context.Context, msg M, opts ...TellOption) error + func (r ActorRef[M]) Untyped() Ref + type AskOption interface + func WithAskCorrelationID(id CorrelationID) AskOption + func WithAskFrom(from Ref) AskOption + func WithAskHeader(key, value string) AskOption + func WithAskHeaders(headers map[string]string) AskOption + func WithTimeout(timeout time.Duration) AskOption + type Behavior interface + Receive func(ctx Context, env Envelope) error + type BoundedMailboxConfig struct + Capacity int + FullPolicy MailboxFullPolicy + type Clock interface + Now func() time.Time + type Config struct + Clock Clock + DeadLetters DeadLetterSink + DefaultAskLimit time.Duration + DefaultMailbox MailboxFactory + MaxActors int + MaxTotalQueued int + NodeID string + Observer Observer + ShutdownPolicy ShutdownPolicy + ShutdownPollInterval time.Duration + Supervision SupervisorStrategy + TellRateLimitPerSecond int + Tracer Tracer + type Context interface + Ask func(ctx context.Context, to Ref, payload any, opts ...AskOption) (Envelope, error) + Parent func() *Ref + Publish func(ctx context.Context, topic string, payload any) error + Self func() Ref + Sender func() *Ref + Spawn func(ctx context.Context, name string, props Props, opts ...SpawnOption) (Ref, error) + State func() State + Stop func(ctx context.Context, ref Ref) error + Tell func(ctx context.Context, to Ref, payload any, opts ...TellOption) error + TellAfter func(ctx context.Context, delay time.Duration, to Ref, payload any, ...) (Scheduled, error) + Watch func(ctx context.Context, ref Ref) error + type CorrelationID string + type DeadLetter struct + Envelope Envelope + Err error + Reason string + type DeadLetterSink interface + HandleDeadLetter func(ctx context.Context, letter DeadLetter) + type DefaultSupervisor struct + func (DefaultSupervisor) Decide(_ SupervisionContext, failure Failure) Directive + type Directive int + const Escalate + const Restart + const Resume + const Stop + type Envelope struct + CorrelationID CorrelationID + Deadline time.Time + From Ref + Headers map[string]string + ID MessageID + Payload any + ReplyTo *Ref + SentAt time.Time + To Ref + func Ask(ctx context.Context, sys *System, to Ref, payload any, opts ...AskOption) (resp Envelope, err error) + type EnvelopeMeta struct + CorrelationID CorrelationID + Deadline time.Time + From Ref + Headers map[string]string + ID MessageID + ReplyTo *Ref + SentAt time.Time + To Ref + type EventActor interface + OnEvent func(ctx Context, env TypedEnvelope[M]) error + type EventActorFunc func(ctx Context, env TypedEnvelope[M]) error + func (f EventActorFunc[M]) OnEvent(ctx Context, env TypedEnvelope[M]) error + type Failure struct + Actor Ref + At time.Time + Err error + Message Envelope + Panic any + type Mailbox interface + Close func() error + Dequeue func(ctx context.Context) (Envelope, error) + Enqueue func(ctx context.Context, env Envelope) error + Len func() int + type MailboxFactory interface + NewMailbox func(actorID ActorID) (Mailbox, error) + func NewBoundedMailboxFactory(cfg BoundedMailboxConfig) MailboxFactory + type MailboxFullPolicy int + const BlockUntilSpace + const DropNewest + const DropOldest + const FailFast + type MessageID string + type NopDeadLetterSink struct + func (NopDeadLetterSink) HandleDeadLetter(_ context.Context, _ DeadLetter) + type NopObserver struct + func (NopObserver) OnActorSpawn(ActorID) + func (NopObserver) OnActorStop(ActorID) + func (NopObserver) OnAskDone(ActorID, error) + func (NopObserver) OnAskStart(ActorID) + func (NopObserver) OnDeadLetter(DeadLetter) + func (NopObserver) OnReceive(ActorID, time.Duration, error, any) + func (NopObserver) OnRestart(ActorID) + func (NopObserver) OnTellEnqueue(ActorID) + type NopTracer struct + func (NopTracer) Start(ctx context.Context, _ string, _ TraceAttrs) (context.Context, Span) + type Observer interface + OnActorSpawn func(actorID ActorID) + OnActorStop func(actorID ActorID) + OnAskDone func(actorID ActorID, err error) + OnAskStart func(actorID ActorID) + OnDeadLetter func(letter DeadLetter) + OnReceive func(actorID ActorID, duration time.Duration, err error, panicValue any) + OnRestart func(actorID ActorID) + OnTellEnqueue func(actorID ActorID) + type Props struct + Kind string + Mailbox MailboxFactory + NewBehavior func(ctx SpawnContext) (Behavior, error) + Supervisor SupervisorStrategy + type PublishedMessage struct + Payload any + Topic string + type ReceiveFunc func(ctx Context, env Envelope) error + func (f ReceiveFunc) Receive(ctx Context, env Envelope) error + type Ref struct + func (r Ref) Ask(ctx context.Context, payload any, opts ...AskOption) (Envelope, error) + func (r Ref) ID() ActorID + func (r Ref) Tell(ctx context.Context, payload any, opts ...TellOption) error + type RequestActor interface + Handle func(ctx Context, env TypedEnvelope[Req]) (Resp, error) + type RequestActorFunc func(ctx Context, env TypedEnvelope[Req]) (Resp, error) + func (f RequestActorFunc[Req, Resp]) Handle(ctx Context, env TypedEnvelope[Req]) (Resp, error) + type Scheduled interface + Cancel func() bool + Done func() <-chan error + type ShutdownPolicy int + const ShutdownDrain + const ShutdownImmediate + type Span interface + AddEvent func(name string, attrs TraceAttrs) + End func(err error) + type SpawnContext struct + Parent *Ref + Self Ref + type SpawnOption interface + func WithActorID(id string) SpawnOption + type Started struct + Actor Ref + type State interface + Delete func(key string) + Get func(key string) (any, bool) + Set func(key string, value any) + type StatsObserver struct + func (s *StatsObserver) OnActorSpawn(ActorID) + func (s *StatsObserver) OnActorStop(ActorID) + func (s *StatsObserver) OnAskDone(_ ActorID, err error) + func (s *StatsObserver) OnAskStart(ActorID) + func (s *StatsObserver) OnDeadLetter(DeadLetter) + func (s *StatsObserver) OnReceive(_ ActorID, duration time.Duration, err error, panicValue any) + func (s *StatsObserver) OnRestart(ActorID) + func (s *StatsObserver) OnTellEnqueue(ActorID) + func (s *StatsObserver) Snapshot() StatsSnapshot + type StatsSnapshot struct + ActorSpawns int64 + ActorStops int64 + AskFailures int64 + AskStarts int64 + DeadLetters int64 + ReceiveDurTotal time.Duration + ReceiveFailures int64 + ReceivePanics int64 + Receives int64 + Restarts int64 + TellEnqueues int64 + type Stopped struct + Actor Ref + type SupervisionContext struct + System *System + type SupervisorStrategy interface + Decide func(ctx SupervisionContext, failure Failure) Directive + type System struct + func NewSystem(cfg Config) (*System, error) + func (s *System) Publish(ctx context.Context, topic string, payload any) error + func (s *System) Ref(id ActorID) Ref + func (s *System) Shutdown(ctx context.Context) error + func (s *System) Spawn(ctx context.Context, name string, props Props, opts ...SpawnOption) (Ref, error) + func (s *System) Stop(ctx context.Context, ref Ref) error + func (s *System) Subscribe(topic string, subscriber Ref) error + func (s *System) Tell(ctx context.Context, to Ref, payload any, opts ...TellOption) (err error) + func (s *System) TellAfter(ctx context.Context, delay time.Duration, to Ref, payload any, ...) (Scheduled, error) + func (s *System) Unsubscribe(topic string, subscriber Ref) error + func (s *System) Watch(_ context.Context, watcher Ref, target Ref) error + type TellOption interface + func WithCorrelationID(id CorrelationID) TellOption + func WithDeadline(deadline time.Time) TellOption + func WithFrom(from Ref) TellOption + func WithHeader(key, value string) TellOption + func WithHeaders(headers map[string]string) TellOption + func WithMessageID(id MessageID) TellOption + func WithReplyTo(replyTo Ref) TellOption + type Terminated struct + ActorID ActorID + type ThresholdSupervisor struct + func NewThresholdSupervisor(cfg ThresholdSupervisorConfig) *ThresholdSupervisor + func (s *ThresholdSupervisor) Decide(ctx SupervisionContext, failure Failure) Directive + type ThresholdSupervisorConfig struct + Base SupervisorStrategy + MaxRestarts int + OnExceeded Directive + Window time.Duration + type TraceAttrs map[string]string + type Tracer interface + Start func(ctx context.Context, name string, attrs TraceAttrs) (context.Context, Span) + type TypedEnvelope struct + Message M + Meta EnvelopeMeta + func AskTyped[Req any, Resp any](ctx context.Context, sys *System, to ActorRef[Req], msg Req, opts ...AskOption) (TypedEnvelope[Resp], error) + type TypedProps struct + Kind string + Mailbox MailboxFactory + NewActor func(ctx SpawnContext) (Actor[M], error) + Supervisor SupervisorStrategy Other modules containing this package github.com/normahq/norma/v2