runtimeconfig

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package runtimeconfig owns the closed, versioned catalogue consumed by the running Hikyo instance. Published values are prepared without side effects.

Index

Constants

View Source
const MigrationVersion int64 = 6
View Source
const SchemaVersion = 1

Variables

View Source
var ErrNodeNotConfigured = errors.New("managed configuration has no entry for this node")

Functions

func EncodeNodeOverrides

func EncodeNodeOverrides(nodes map[string]map[string]string) (string, error)

EncodeNodeOverrides creates one canonical encrypted project-cell value for the independently captured nodes. It never infers one node from another.

func Folder

func Folder(name string) string

Folder names the folder a catalogue key is shown in, or "" for an unknown name. It is never stored: the runtime and upgrade fences require the system project's stored catalogue to stay flat, so this also reaches adopted instances without a migration and survives a downgrade.

Types

type Bundle

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

Bundle contains one immutable prepared configuration. Callers atomically replace the whole bundle and retain the captured bundle for in-flight work.

func Prepare

func Prepare(values map[string]string) (*Bundle, error)

func PrepareForConfig

func PrepareForConfig(values map[string]string, base *config.Config) (*Bundle, error)

PrepareForConfig additionally proves that the owner settings fit this node's bootstrap/deployment context. It performs no activation or I/O.

func PrepareForNode

func PrepareForNode(values map[string]string, base *config.Config, nodeID string) (*Bundle, error)

PrepareForNode validates the complete candidate using this node's bootstrap identity and engine. Resource construction and activation remain app-owned.

func (*Bundle) BootstrapSources

func (b *Bundle) BootstrapSources() config.ManagedBootstrapSources

BootstrapSources returns value-only installed source selections.

func (*Bundle) HasNodeValues

func (b *Bundle) HasNodeValues() bool

HasNodeValues distinguishes a legacy owner-only bundle from one that declares managed node configuration. A declared document always requires exact nodes.

func (*Bundle) MailConfigured

func (b *Bundle) MailConfigured() bool

func (*Bundle) NodeValues

func (b *Bundle) NodeValues(nodeID string) (map[string]string, error)

NodeValues returns one independent complete projection, never another node's settings. Missing nodes are explicit errors, including in an owner-only bundle.

func (*Bundle) OwnerValues

func (b *Bundle) OwnerValues() map[string]string

OwnerValues returns independent application settings only. Mail and release notifications have separate runtime owners and are omitted from this map.

func (*Bundle) Send

func (b *Bundle) Send(ctx context.Context, to, subject, body string) error

Send uses this exact prepared bundle, including when a newer revision is activated concurrently. Runtime fencing and test budgets belong to callers.

func (*Bundle) UpdateChannel

func (b *Bundle) UpdateChannel() string

func (*Bundle) ValidateNodeMembership

func (b *Bundle) ValidateNodeMembership(admittedNodeIDs []string) error

ValidateNodeMembership binds a candidate to the exact admitted participants. Neither unknown candidate nodes nor omitted admitted nodes are acceptable.

type Key

type Key struct {
	Name           string
	Description    string
	Secret         bool
	Classification schema.Classification
	Declaration    schema.Declaration
}

Key describes the runtime-owned normal project declaration. Presence is optional; Prepare enforces dependencies between the mail keys at activation.

func Catalogue

func Catalogue() []Key

Catalogue returns independent metadata on every call, so an editor cannot mutate the runtime schema through a retained slice or declaration pointer.

type Migration

type Migration struct {
	Version int64
	Name    string
	Default *string
	// Optional adds only the declaration when no value exists. It cannot be
	// combined with Default, and never removes an existing operator value.
	Optional bool
}

Migration adds one release-owned setting. Versions and defaults are immutable once released. A nil Default means operator input is required unless Optional explicitly permits an absent value. Empty string is an explicit default, never absence. The declaration remains in Catalogue.

func Migrations

func Migrations() []Migration

type PreparedActivation

type PreparedActivation interface {
	Activate(context.Context) error
	Close() error
}

PreparedActivation owns candidate resources until Activate transfers them to the application. Close disposes an unused candidate and is idempotent; after successful activation it must not close the active application. Failed activation must leave the prior application available for recovery.

type RuntimeInstaller

type RuntimeInstaller interface {
	Prepare(context.Context, *Bundle) (PreparedActivation, error)
}

RuntimeInstaller prepares the application's consumers without making a candidate active. The app owns this interface; only its configuration worker invokes it, outside request and datastore transaction lifetimes.

Jump to

Keyboard shortcuts

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