store

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntendedStateEnabled  = "enabled"
	IntendedStateDisabled = "disabled"

	StateRunning  = "running"
	StateStopped  = "stopped"
	StateStarting = "starting"
	StateFailed   = "failed"
	StatePaused   = "paused"
	StateStopping = "stopping"
)

State constants shared across all component types.

View Source
const (
	KindTargets             = "targets"
	KindOutputs             = "outputs"
	KindInputs              = "inputs"
	KindSubscriptions       = "subscriptions"
	KindProcessors          = "processors"
	KindAssignments         = "assignments"
	KindTunnelTargetMatches = "tunnel-target-matches"
)

Kind names used in the state store.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentState

type ComponentState struct {
	// Name          string    `json:"name"`
	IntendedState string    `json:"intended-state"`          // enabled|disabled
	State         string    `json:"state"`                   // running|stopped|starting|failed|paused|stopping
	FailedReason  string    `json:"failed-reason,omitempty"` // last error message
	LastUpdated   time.Time `json:"last-updated"`            // timestamp of last state transition
}

ComponentState is the base state shared by all managed components.

type InputState

type InputState struct {
	ComponentState
}

InputState extends ComponentState with input-specific fields.

type OutputState

type OutputState struct {
	ComponentState
}

OutputState extends ComponentState with output-specific fields.

type Store

type Store struct {
	Config zstore.Store[any]
	State  zstore.Store[any]
}

Store wraps both the config store and the state store. The config store holds user-defined configuration (targets, subscriptions, outputs, inputs, etc.). The state store holds runtime state for each component (running, stopped, failed, etc.).

func NewStore

func NewStore(configStore zstore.Store[any]) *Store

NewStore creates a new Store with the given config store and a fresh in-memory state store.

type SubscriptionState

type SubscriptionState struct {
	ComponentState
	Targets map[string]string `json:"targets,omitempty"` // target_name -> running|stopped|starting|failed|paused|stopping
}

SubscriptionState tracks a subscription's aggregate state across targets.

type TargetState

type TargetState struct {
	ComponentState
	ConnectionState string            `json:"connection-state,omitempty"` // gRPC connectivity: READY|CONNECTING|TRANSIENT_FAILURE|...
	Subscriptions   map[string]string `json:"subscriptions,omitempty"`    // subscription_name -> running|stopped
}

TargetState extends ComponentState with target-specific fields.

Jump to

Keyboard shortcuts

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