stateview

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerStatus

type ServerStatus struct {
	Name           string
	Config         *config.ServerConfig
	State          string // Actor state: idle, connecting, connected, error, etc.
	Enabled        bool
	Quarantined    bool
	Connected      bool
	LastError      string
	LastErrorTime  *time.Time
	ConnectedAt    *time.Time
	DisconnectedAt *time.Time
	RetryCount     int
	ToolCount      int
	Tools          []ToolInfo // Phase 7.1: Cached tool list for lock-free reads
	Metadata       map[string]interface{}
}

ServerStatus represents the runtime status of an upstream server.

type ServerStatusSnapshot

type ServerStatusSnapshot struct {
	Servers   map[string]*ServerStatus
	Timestamp time.Time
}

ServerStatusSnapshot is an immutable snapshot of all server statuses.

type ToolInfo

type ToolInfo struct {
	Name        string
	Description string
	InputSchema map[string]interface{}
	Annotations *config.ToolAnnotations
}

ToolInfo represents a cached tool definition.

type View

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

View provides a read-only view of server statuses. It maintains an in-memory snapshot updated via supervisor events.

func New

func New() *View

New creates a new state view.

func (*View) Count

func (v *View) Count() int

Count returns the number of servers in the view (lock-free).

func (*View) CountByState

func (v *View) CountByState(state string) int

CountByState returns the number of servers in a specific state (lock-free).

func (*View) CountConnected

func (v *View) CountConnected() int

CountConnected returns the number of connected servers (lock-free).

func (*View) GetAll

func (v *View) GetAll() map[string]*ServerStatus

GetAll returns all server statuses (lock-free).

func (*View) GetServer

func (v *View) GetServer(name string) (*ServerStatus, bool)

GetServer returns the status for a specific server (lock-free).

func (*View) RemoveServer

func (v *View) RemoveServer(name string)

RemoveServer removes a server from the view.

func (*View) Snapshot

func (v *View) Snapshot() *ServerStatusSnapshot

Snapshot returns the current immutable snapshot of all server statuses. This is a lock-free read operation.

func (*View) UpdateServer

func (v *View) UpdateServer(name string, fn func(*ServerStatus))

UpdateServer updates or creates a server status entry.

Jump to

Keyboard shortcuts

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