Documentation
¶
Index ¶
- type Actor
- func (l *Actor) Bootstrap() []gen.ProcessID
- func (l *Actor) Broadcast(message any)
- func (l *Actor) BroadcastBootstrap(message any)
- func (l *Actor) ClusterID() string
- func (l *Actor) HandleCall(from gen.PID, ref gen.Ref, request any) (any, error)
- func (l *Actor) HandleInspect(from gen.PID, item ...string) map[string]string
- func (l *Actor) HandleMessage(from gen.PID, message any) error
- func (l *Actor) HandlePeerJoined(peer gen.PID) error
- func (l *Actor) HandlePeerLeft(peer gen.PID) error
- func (l *Actor) HandleTermChanged(oldTerm, newTerm uint64) error
- func (l *Actor) HasPeer(pid gen.PID) bool
- func (l *Actor) IsLeader() bool
- func (l *Actor) Join(peer gen.ProcessID)
- func (l *Actor) Leader() gen.PID
- func (l *Actor) PeerCount() int
- func (l *Actor) Peers() []gen.PID
- func (l *Actor) ProcessInit(process gen.Process, args ...any) (rr error)
- func (l *Actor) ProcessRun() (rr error)
- func (l *Actor) ProcessTerminate(reason error)
- func (l *Actor) Term() uint64
- func (l *Actor) Terminate(reason error)
- type ActorBehavior
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
func (*Actor) BroadcastBootstrap ¶
BroadcastBootstrap sends a message to all bootstrap peers (excluding self)
func (*Actor) HandleCall ¶
func (*Actor) HandleInspect ¶
func (*Actor) HandleTermChanged ¶
func (*Actor) Join ¶
Join adds a peer to the cluster Use this to manually add known peers or for dynamic cluster growth
func (*Actor) ProcessInit ¶
func (*Actor) ProcessRun ¶
func (*Actor) ProcessTerminate ¶
type ActorBehavior ¶
type ActorBehavior interface {
gen.ProcessBehavior
Init(args ...any) (Options, error)
HandleMessage(from gen.PID, message any) error
HandleCall(from gen.PID, ref gen.Ref, request any) (any, error)
Terminate(reason error)
HandleInspect(from gen.PID, item ...string) map[string]string
// Leadership callbacks
HandleBecomeLeader() error
HandleBecomeFollower(leader gen.PID) error
// Peer management callbacks
HandlePeerJoined(peer gen.PID) error
HandlePeerLeft(peer gen.PID) error
// Term management callback
HandleTermChanged(oldTerm, newTerm uint64) error
}
type Options ¶
type Options struct {
ClusterID string
Bootstrap []gen.ProcessID
ElectionTimeoutMin int // Minimum election timeout (ms, default: 150)
ElectionTimeoutMax int // Maximum election timeout (ms, default: 300)
HeartbeatInterval int // Heartbeat interval (ms, default: 50)
}
Options for leader election
Click to show internal directories.
Click to hide internal directories.