Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
Actor represents a single server actor with its own goroutine and state machine. Each actor manages the lifecycle of one upstream server connection independently.
func (*Actor) SendCommand ¶
SendCommand sends a command to the actor.
func (*Actor) Start ¶
func (a *Actor) Start()
Start begins the actor's event loop in a dedicated goroutine.
func (*Actor) UpdateClient ¶
UpdateClient updates the underlying managed client (used during reconfiguration).
type ActorConfig ¶
type ActorConfig struct {
Name string
ServerConfig *config.ServerConfig
MaxRetries int
RetryInterval time.Duration
ConnectTimeout time.Duration
}
ActorConfig holds the configuration for an actor
type Command ¶
type Command struct {
Type CommandType
Data map[string]interface{}
}
Command represents a command sent to the actor
type CommandType ¶
type CommandType string
CommandType describes the kind of command
const ( // CommandConnect tells the actor to connect CommandConnect CommandType = "connect" // CommandDisconnect tells the actor to disconnect CommandDisconnect CommandType = "disconnect" // CommandStop tells the actor to stop CommandStop CommandType = "stop" // CommandUpdateConfig tells the actor to update its configuration CommandUpdateConfig CommandType = "update_config" )
type Event ¶
type Event struct {
Type EventType
State State
Timestamp time.Time
Error error
Data map[string]interface{}
}
Event represents an actor lifecycle event
type EventType ¶
type EventType string
EventType describes the kind of actor event
const ( // EventStateChanged means the actor changed state EventStateChanged EventType = "state_changed" // EventConnected means the actor successfully connected EventConnected EventType = "connected" // EventDisconnected means the actor disconnected EventDisconnected EventType = "disconnected" // EventError means the actor encountered an error EventError EventType = "error" // EventRetrying means the actor is retrying connection EventRetrying EventType = "retrying" )
type State ¶
type State string
State represents the actor's connection state
const ( // StateIdle means the actor is waiting for commands StateIdle State = "idle" // StateConnecting means the actor is attempting to connect StateConnecting State = "connecting" // StateConnected means the actor is connected and ready StateConnected State = "connected" // StateDisconnecting means the actor is disconnecting StateDisconnecting State = "disconnecting" // StateError means the actor encountered an error StateError State = "error" // StateStopped means the actor has been stopped StateStopped State = "stopped" )
Click to show internal directories.
Click to hide internal directories.