Documentation
¶
Overview ¶
Package clusterstate stores the small, secret-bearing pieces of coordinator state needed to restore a coordinator from an etcd snapshot.
Index ¶
- Variables
- func EnsureSealingKey(ctx context.Context, log *slog.Logger, client *clientv3.Client, ...) ([]byte, error)
- func SealingKeyPath(dataPath string) string
- type Lock
- type Store
- func (s *Store) Delete(ctx context.Context, name string) error
- func (s *Store) Ensure(ctx context.Context, name string, bootstrap []byte) ([]byte, error)
- func (s *Store) Get(ctx context.Context, name string) ([]byte, error)
- func (s *Store) Lock(ctx context.Context, name string) (*Lock, error)
- func (s *Store) Put(ctx context.Context, name string, value []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("cluster state not found")
Functions ¶
func EnsureSealingKey ¶
func EnsureSealingKey(ctx context.Context, log *slog.Logger, client *clientv3.Client, prefix, dataPath string) ([]byte, error)
EnsureSealingKey creates a key only before metadata migration. A restored snapshot without its original sealing key must fail rather than mint a new root that cannot decrypt the cluster's credentials.
func SealingKeyPath ¶
SealingKeyPath is the host-only root key. Back it up separately from etcd; it is not a recoverable cache and must never be uploaded with snapshots.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock holds a cluster-wide mutex. Writes made through it are fenced by the mutex's create revision and lease, so a holder which pauses past lease expiry cannot overwrite the next holder's work.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store encrypts records before placing them in replicated etcd. The key is derived from a host-only sealing key, which must be backed up separately.
func (*Store) Ensure ¶
Ensure returns the authoritative value, atomically installing bootstrap only when no coordinator has created the record yet.