lifecycle

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(reaper WorkerReaper) *Manager

func (*Manager) BeginRequest

func (m *Manager) BeginRequest(sessionID string)

BeginRequest is called by the proxy before routing. This is used for both REST and WebSockets.

func (*Manager) EndRequest

func (m *Manager) EndRequest(sessionID string, proxyErr error)

EndRequest is deferred by the proxy. It catches deadlocks.

func (*Manager) GetSession

func (m *Manager) GetSession(sessionID string) *SessionState

GetSession returns the session state if it exists (for testing or advanced logic) Returns nil if not found.

func (*Manager) Register

func (m *Manager) Register(sessionID string, config herd.TenantConfig)

Register explicitly creates the session lease.

func (*Manager) Remove

func (m *Manager) Remove(sessionID string)

Remove cleans up the registry after a kill.

func (*Manager) StartReaper

func (m *Manager) StartReaper(ctx context.Context)

StartReaper starts the background loop to clean up workers. It should be run in a goroutine.

func (*Manager) UnregisterAndKill

func (m *Manager) UnregisterAndKill(sessionID string, reason string) error

UnregisterAndKill removes the session from tracking and kills the worker. This is used for clean disconnects where we want to ensure no zombie processes.

func (*Manager) UpdateHeartbeat

func (m *Manager) UpdateHeartbeat(sessionID string)

UpdateHeartbeat is called by the gRPC stream when a Ping arrives.

type SessionState

type SessionState struct {
	SessionID            string
	CreatedAt            time.Time
	LastControlHeartbeat time.Time
	LastDataActivity     time.Time
	ActiveConns          int

	IdleTTL     time.Duration
	AbsoluteTTL time.Duration
	// contains filtered or unexported fields
}

type WorkerReaper

type WorkerReaper interface {
	KillWorker(sessionID string, reason string) error
}

WorkerReaper is the interface to your pool to execute a specific worker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL