configstore

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 8 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 configstore persists the last-known-good (LKG) NodeConfig so the node keeps serving its last applied configuration across restarts, even when the console is unreachable.

Layout (inside <state-dir>/config):

current.binpb   the applied configuration (binary protobuf)
previous.binpb  the configuration applied before it (backup)

Writes are atomic (temp file + fsync + rename + dir fsync). Load verifies the content hash and falls back to the backup if current is corrupt.

Index

Constants

View Source
const (
	CurrentFile  = "current.binpb"
	PreviousFile = "previous.binpb"
)

File names inside the store directory.

Variables

View Source
var ErrNoConfig = errors.New("no last-known-good configuration")

ErrNoConfig is returned by Load when no configuration has been saved.

Functions

This section is empty.

Types

type Store

type Store struct {
	Dir string
}

Store is a directory holding the LKG configuration.

func (Store) Load

func (s Store) Load() (*nodev1.NodeConfig, string, error)

Load returns the current configuration, or the backup if the current file is missing or fails verification. The second return value names the file that was used.

func (Store) Save

func (s Store) Save(cfg *nodev1.NodeConfig) error

Save persists cfg as the current configuration and keeps the former current file as the backup.

Jump to

Keyboard shortcuts

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