configrt

package
v0.6.55 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package configrt is what the SDK core needs from a live configuration and authors do not: the effective values for instance state, schema walks for the manifest and provenance. Backend clients belong to optional drivers.

Index

Constants

View Source
const (
	SourceFile   = "file:"
	SourceEnv    = "env:"
	SourceConsul = "consul:"
	// SourceDefaults: the service's own defaults, reported as defaults.
	SourceDefaults = "defaults:"
)

Source names carry their kind as a prefix; provenance maps back from it.

View Source
const LiveAnnotation = "backplane.live"

LiveAnnotation marks a Live field in the configuration schema: the console may change it and Consul KV overrides apply only to such fields.

View Source
const RevisionKey = "_revision"

RevisionKey, under config/<service>/, holds the console's revision of the values next to it; written in one transaction with them.

Variables

This section is empty.

Functions

func LivePaths

func LivePaths(schema *sp.Schema) [][]string

LivePaths lists the paths of Live fields in schema.

func SourceOf

func SourceOf(name string) backplanev1.ConfigSource

SourceOf maps a source name to its kind.

func WithoutLiveRequired

func WithoutLiveRequired(schema *sp.Schema) *sp.Schema

WithoutLiveRequired copies schema with every Live field optional: the layers below Consul need not supply what only Consul may.

Types

type Effective

type Effective struct {
	Values  []byte
	Sources map[string]backplanev1.ConfigSource
	// Revision of config/<service>/_revision read together with the applied
	// values; 0 when absent.
	Revision uint64
	// Err: why the last update was not applied; nil once a later one is.
	Err error
	// RejectedRevision of the update Err refers to; 0 when none.
	RejectedRevision uint64
}

Effective is what the instance runs with: masked values, the layer each path came from, the console revision they came from, and the last rejected update.

type State

type State interface {
	// Schema of the configuration; Live fields carry LiveAnnotation.
	Schema() *sp.Schema
	// LivePaths are dot-separated paths of Live fields.
	LivePaths() []string
	Effective() Effective
	// OnChange calls fn whenever Effective or Degraded may have changed.
	OnChange(fn func())
	Degraded() error
	// SetLog routes the configuration's own logging (rejected updates,
	// Consul layer transitions) to the service logger; until then it goes
	// to log/slog.
	SetLog(log *xlog.Logger)
	Close() error
}

State is the SDK's view of a live configuration.

Jump to

Keyboard shortcuts

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