configsnapshot

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthReader

type AuthReader interface {
	List(ctx context.Context, filter authdomain.ListFilter) ([]*authdomain.Auth, int, error)
}

type CatalogReader

type CatalogReader interface {
	ListProviders(ctx context.Context) ([]catalogdomain.Provider, error)
	ListModelsByProviderCode(ctx context.Context, providerCode string) ([]catalogdomain.Model, error)
}

type Compiler

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

func NewCompiler

func NewCompiler(
	gateways GatewayReader,
	consumers ConsumerReader,
	registries RegistryReader,
	policies PolicyReader,
	auths AuthReader,
	roles RoleReader,
	catalog CatalogReader,
	logger *slog.Logger,
) *Compiler

func (*Compiler) Compile

func (c *Compiler) Compile(ctx context.Context) (*readmodel.Snapshot, error)

func (*Compiler) CompileAll

func (c *Compiler) CompileAll(ctx context.Context) (*readmodel.Snapshot, map[string]*readmodel.Snapshot, error)

func (*Compiler) CompileFor

func (c *Compiler) CompileFor(ctx context.Context, scope string) (*readmodel.Snapshot, error)

type ConsumerReader

type ConsumerReader interface {
	ListByGateway(ctx context.Context, gatewayID ids.GatewayID) ([]*consumerdomain.Consumer, error)
}

type Dispatcher

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

Dispatcher compiles the config snapshot, holds it for the gRPC server to serve, broadcasts the new version to connected data planes, and drains the change-marker outbox that survives a control-plane restart. A committed admin write leaves a durable marker; the dispatcher folds every marker visible before the compile into one recompile and drains exactly that observed set.

func NewDispatcher

NewDispatcher builds the control-plane snapshot dispatcher.

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context) error

Dispatch runs one dispatch cycle synchronously. It must not run concurrently with Run or another Dispatch: the outbox frontier (MaxSeq/DeleteUpTo) is not mutually exclusive across cycles, so overlapping callers could drain against different frontiers.

func (*Dispatcher) Run

func (d *Dispatcher) Run(ctx context.Context) error

Run drives the dispatch loop until ctx is cancelled: a debounced dispatch after a Signal burst, a jittered backstop dispatch, and an initial catch-up when the outbox holds markers left by a write that committed before a prior restart.

func (*Dispatcher) Signal

func (d *Dispatcher) Signal()

Signal requests a debounced dispatch after an admin write.

type DispatcherConfig

type DispatcherConfig struct {
	Debounce  time.Duration
	Backstop  time.Duration
	Retention time.Duration
	MaxRows   int
}

DispatcherConfig tunes the debounce/backstop cadence and the outbox safety bound.

type GatewayReader

type GatewayReader interface {
	List(ctx context.Context, filter gatewaydomain.ListFilter) ([]*gatewaydomain.Gateway, int, error)
}

type Holder

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

func NewHolder

func NewHolder() *Holder

func (*Holder) Set

func (h *Holder) Set(raw []byte, version string)

func (*Holder) SetPartitioned

func (h *Holder) SetPartitioned(raw []byte, version string, scoped map[string]ScopedSnapshot)

func (*Holder) Snapshot

func (h *Holder) Snapshot() (raw []byte, version string, ok bool)

func (*Holder) SnapshotFor

func (h *Holder) SnapshotFor(scope string) (raw []byte, version string, ok bool)

func (*Holder) Version

func (h *Holder) Version() string

type PartitionedCompiler

type PartitionedCompiler interface {
	CompileAll(ctx context.Context) (*readmodel.Snapshot, map[string]*readmodel.Snapshot, error)
}

type PolicyReader

type PolicyReader interface {
	ListByGateway(ctx context.Context, gatewayID ids.GatewayID) ([]*policydomain.Policy, error)
}

type RegistryReader

type RegistryReader interface {
	List(ctx context.Context, filter registrydomain.ListFilter) ([]*registrydomain.Registry, int, error)
}

type RoleReader

type RoleReader interface {
	ListByGateway(ctx context.Context, gatewayID ids.GatewayID) ([]*roledomain.Role, error)
}

type ScopedSnapshot

type ScopedSnapshot struct {
	Raw     []byte
	Version string
}

type Signaler

type Signaler interface {
	Signal()
}

type SnapshotCompiler

type SnapshotCompiler interface {
	Compile(ctx context.Context) (*readmodel.Snapshot, error)
}

SnapshotCompiler compiles the current State-of-the-World from the live config.

type SnapshotVersionPublisher

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

func NewSnapshotVersionPublisher

func NewSnapshotVersionPublisher(signaler Signaler) *SnapshotVersionPublisher

func (*SnapshotVersionPublisher) Signal

Jump to

Keyboard shortcuts

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