Skip to main content
A quick reference for the key interfaces implemented by users and collaborators. See the linked pages for detailed explanations.

Actor

type Actor interface {
    PreStart(ctx *Context) error
    Receive(ctx *ReceiveContext)
    PostStop(ctx *Context) error
}
Required for all actors. See Actor Model.

Grain

type Grain interface {
    OnActivate(ctx context.Context, props *GrainProps) error
    OnReceive(ctx *GrainContext)
    OnDeactivate(ctx context.Context, props *GrainProps) error
}
Required for virtual actors. See Grains.

Mailbox

type Mailbox interface {
    Enqueue(msg *ReceiveContext) error
    Dequeue() *ReceiveContext
    IsEmpty() bool
    Len() int64
    Dispose()
}
Optional; for custom mailbox implementations. See Extending GoAkt.

Serializer

type Serializer interface {
    Serialize(message any) ([]byte, error)
    Deserialize(data []byte) (any, error)
}
For custom message serialization over the wire. See Serialization.

Extension

type Extension interface {
    ID() string
}
System-wide plugin. See Extending GoAkt.

Dependency

type Dependency interface {
    Serializable  // BinaryMarshaler + BinaryUnmarshaler
    ID() string
}
Per-actor injected resource. Must be serializable for relocation. See Extending GoAkt.

Discovery Provider

type Provider interface {
    ID() string
    Initialize() error
    Register() error
    Deregister() error
    DiscoverPeers() ([]string, error)
    Close() error
}
For cluster peer discovery. See Extending GoAkt. For custom passivation behavior. See Passivation.

Path

type Path interface {
    Host() string
    HostPort() string
    Port() int
    Name() string
    Parent() Path
    String() string
    System() string
    Equals(other Path) bool
}
Returned by pid.Path(). Location-transparent actor identity. See Location Transparency.