configrt

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 5 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

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.

func WithoutSecretRequired added in v0.6.118

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

WithoutSecretRequired is schema with every secret field optional: a configuration loaded only to describe the service (its manifest) needs no credential.

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