Versions in this module Expand all Collapse all v0 v0.1.0 Aug 18, 2026 Changes in this version + const DefaultHeartbeatInterval + const DefaultMetricsInterval + const DefaultQueueSize + const DefaultReconnectMax + const DefaultReconnectMin + const DefaultServerHeartbeatInterval + const DefaultServerQueueSize + var ErrSessionClosed = errors.New("control session is closed") + type Client struct + func NewClient(cfg ClientConfig) (*Client, error) + func (c *Client) Connected() bool + func (c *Client) Dropped() uint64 + func (c *Client) Run(ctx context.Context) error + func (c *Client) Send(msg *loadwavev1.NodeUp) bool + func (c *Client) SendLog(event *loadwavev1.LogEvent) bool + func (c *Client) SendMetrics(batch *loadwavev1.MetricBatch) bool + func (c *Client) SendRunStatus(update *loadwavev1.RunStatusUpdate) bool + type ClientConfig struct + DialOptions []grpc.DialOption + Handler Handler + Heartbeat func() *loadwavev1.NodeHeartbeat + Hello *loadwavev1.NodeHello + Logger *slog.Logger + QueueSize int + ReconnectMax time.Duration + ReconnectMin time.Duration + Target string + type Handler interface + OnAccepted func(ctx context.Context, msg *loadwavev1.Accepted) error + OnSetQuota func(ctx context.Context, msg *loadwavev1.SetQuota) error + OnStartRun func(ctx context.Context, msg *loadwavev1.StartRun) error + OnStopRun func(ctx context.Context, msg *loadwavev1.StopRun) error + type Server struct + func NewServer(cfg ServerConfig) (*Server, error) + func (s *Server) Join(stream loadwavev1.ControlService_JoinServer) error + type ServerConfig struct + Handler SessionHandler + HeartbeatInterval time.Duration + Logger *slog.Logger + MetricsInterval time.Duration + QueueSize int + Version string + type Session struct + Hello *loadwavev1.NodeHello + ID string + JoinedAt time.Time + RemoteAddr string + func (s *Session) Close() + func (s *Session) Closed() bool + func (s *Session) LastSeen() time.Time + func (s *Session) Send(msg *loadwavev1.NodeDown) error + type SessionHandler interface + OnHeartbeat func(session *Session, beat *loadwavev1.NodeHeartbeat) + OnJoin func(ctx context.Context, session *Session) error + OnLeave func(session *Session) + OnLog func(session *Session, event *loadwavev1.LogEvent) + OnMetrics func(session *Session, batch *loadwavev1.MetricBatch) + OnRunStatus func(session *Session, update *loadwavev1.RunStatusUpdate) + type SessionRegistry struct + func NewSessionRegistry() *SessionRegistry + func (r *SessionRegistry) Add(session *Session) *Session + func (r *SessionRegistry) All() []*Session + func (r *SessionRegistry) Broadcast(msg *loadwavev1.NodeDown) error + func (r *SessionRegistry) Get(id string) (*Session, bool) + func (r *SessionRegistry) Len() int + func (r *SessionRegistry) Remove(session *Session) bool