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 ¶
const ( SourceFile = "file:" SourceEnv = "env:" SourceConsul = "consul:" )
Source names carry their kind as a prefix; provenance maps back from it.
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.
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 SourceOf ¶
func SourceOf(name string) backplanev1.ConfigSource
SourceOf maps a source name to its kind.
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.