session

package
v0.9.8-dev.9 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: GPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SnapshotCapability

func SnapshotCapability(kind EventKind) string

SnapshotCapability identifies the existing daemon capability for a resource.

Types

type Demand

type Demand struct {
	Page            string
	PreferencesOpen bool
}

Demand describes the visible page, independently of keyboard or modal focus.

type Event

type Event struct {
	Onboarding  protocol.OnboardingStatus
	Resource    EventKind
	Generation  uint64
	Scheduled   bool
	Discarded   bool
	SystemProxy protocol.SystemProxyStatus
	TUN         protocol.TunStatus
	Egress      protocol.EgressStatus
	Batch       []Event
	Diagnostics protocol.DiagnosticList
	// DiagnosticQuery distinguishes history lookup errors from stream failures.
	DiagnosticQuery bool
	Kind            EventKind
	ObservedAt      time.Time
	Attempt         int
	// Status identifies the daemon that supplied a resource or stream event.
	Status        protocol.Status
	Core          protocol.CoreStatus
	Subscriptions protocol.SubscriptionList
	Proxies       protocol.ProxyGroups
	Routing       protocol.RoutingStatus
	Preferences   protocol.TUIPreferences
	Rules         protocol.RuleList
	RuleProviders protocol.RuleProviderList
	WebGUI        protocol.WebGUIStatus
	// Logging contains the daemon logging status associated with the event.
	Logging     protocol.LoggingStatus
	Traffic     protocol.TrafficSample
	Memory      protocol.MemorySample
	Log         protocol.LogEntry
	Connections protocol.ConnectionList
	// Epoch is the snapshot synchronization epoch produced only by Session.
	Epoch uint64
	Err   error
}

type EventKind

type EventKind string
const (
	EventSnapshotLoading EventKind = "snapshot-loading"
	EventSystemProxy     EventKind = "system-proxy"
	EventTUN             EventKind = "tun"
	EventEgress          EventKind = "egress"
	EventOnboarding      EventKind = "onboarding"
	EventDiagnostics     EventKind = "diagnostics"
	EventStatus          EventKind = "status"
	EventCore            EventKind = "core"
	EventSubscriptions   EventKind = "subscriptions"
	EventProxies         EventKind = "proxies"
	EventRouting         EventKind = "routing"
	EventPreferences     EventKind = "preferences"
	EventRules           EventKind = "rules"
	EventRuleProviders   EventKind = "rule-providers"
	EventWebGUI          EventKind = "web-gui"
	// EventLogging carries an epoch-tagged daemon Logging snapshot.
	EventLogging       EventKind = "logging"
	EventTraffic       EventKind = "traffic"
	EventMemory        EventKind = "memory"
	EventLog           EventKind = "log"
	EventConnections   EventKind = "connections"
	EventReconnecting  EventKind = "reconnecting"
	EventConnected     EventKind = "connected"
	EventTerminalError EventKind = "terminal-error"
)

type Options

type Options struct {

	// Reporter is the optional owner-provided diagnostic output.
	Reporter         diagnostics.Reporter
	Backoff          func(attempt int) time.Duration
	OrderedQueueSize int
	EventBufferSize  int
	// PollInterval is the cadence for re-polling status snapshots (status, core,
	// proxies, subscriptions, ...) while the push streams stay connected.
	PollInterval    time.Duration
	SnapshotTimeout time.Duration
	// contains filtered or unexported fields
}

type Session

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

func New

func New(client Client, options Options) *Session

func (*Session) Close

func (s *Session) Close()

func (*Session) Invalidate

func (s *Session) Invalidate(kinds ...EventKind)

Invalidate retires observations started before an operation or owner change.

func (*Session) Refresh

func (s *Session) Refresh(kinds ...EventKind)

Refresh requests immediate reads and may share equivalent in-flight reads.

func (*Session) SetDemand

func (s *Session) SetDemand(next Demand)

SetDemand updates resource consumers. Requests without consumers are retired.

func (*Session) Start

func (s *Session) Start(parent context.Context) <-chan Event

func (*Session) Valid

func (s *Session) Valid(event Event) bool

Valid rejects a queued result retired after it was fetched.

Jump to

Keyboard shortcuts

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