Help us shape the future of Go! Take the 2026 Go Developer Survey

etcd

package
v0.4.26 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoveryClusterToken

func RecoveryClusterToken(ctx context.Context, archive string, identity Identity) (string, error)

RecoveryClusterToken gives all members of a restored snapshot the same new cluster identity, distinct from either live bootstrap token. It is stable on resume and bound to the owned snapshot, not to a guessed directory.

Types

type Endpoint

type Endpoint struct {
	Address    string
	ServerName string
}

type EtcdctlSource

type EtcdctlSource struct {
	Etcdctl    string
	Etcdutl    string
	Endpoints  []string
	Identity   Identity
	TLS        TLSFiles
	ScratchDir string
	Attest     func(context.Context) (SnapshotInfo, error)
}

EtcdctlSource invokes a separately installed trusted etcdctl and etcdutl, never a command inside the distroless etcd container. Credentials remain in protected files; only path locations are passed through the child environment.

func (EtcdctlSource) Snapshot

func (s EtcdctlSource) Snapshot(ctx context.Context, dest io.Writer) (SnapshotInfo, error)

type Identity

type Identity struct {
	Core    string `json:"core"`
	Target  string `json:"target"`
	Cluster string `json:"cluster"`
}

func (Identity) Validate

func (i Identity) Validate() error

type IsolatedEtcdutl

type IsolatedEtcdutl struct {
	Binary                   string
	MemberName               string
	InitialCluster           string
	InitialAdvertisePeerURLs string
	ExpectedMemberNames      []string
}

IsolatedEtcdutl restores a validated snapshot with an independent trusted etcdutl binary. The existing cluster data directory is never touched.

func (IsolatedEtcdutl) RestoreIsolated

func (e IsolatedEtcdutl) RestoreIsolated(ctx context.Context, archive, destination string, identity Identity, info SnapshotInfo) error

func (IsolatedEtcdutl) VerifyIsolated

func (e IsolatedEtcdutl) VerifyIsolated(ctx context.Context, destination string, identity Identity, info SnapshotInfo) error

type Metadata

type Metadata struct {
	Format   int          `json:"format"`
	Identity Identity     `json:"identity"`
	Info     SnapshotInfo `json:"info"`
	Bytes    int64        `json:"bytes"`
	SHA256   string       `json:"sha256"`
	Created  time.Time    `json:"created"`
}

type RecoveryReadiness

type RecoveryReadiness interface {
	VerifyEtcdQuorum(context.Context, Identity, SnapshotInfo) error
	VerifyPatroniDCS(context.Context, Identity, SnapshotInfo) error
}

RecoveryReadiness is supplied by the Core/Patroni orchestrator. Verification must prove both restored etcd quorum and the Patroni DCS consumer state.

type RestorePlan

type RestorePlan struct {
	Archive, Destination string
	Identity             Identity
	Info                 SnapshotInfo
	SHA256               string
}

type Restorer

type Restorer interface {
	RestoreIsolated(context.Context, string, string, Identity, SnapshotInfo) error
	VerifyIsolated(context.Context, string, Identity, SnapshotInfo) error
}

Restorer must implement isolated etcdutl snapshot restore semantics: never execute inside the running distroless etcd container.

type SnapshotInfo

type SnapshotInfo struct {
	ClusterID string `json:"cluster_id"`
	Version   string `json:"version"`
	Revision  int64  `json:"revision"`
}

type Source

type Source interface {
	// Snapshot streams etcd v3 Maintenance.Snapshot (gRPC), never a container shell.
	Snapshot(context.Context, io.Writer) (SnapshotInfo, error)
}

type Store

type Store struct {
	Directory string
	Identity  Identity
	Client    Source
}

func (Store) CreateSnapshot

func (s Store) CreateSnapshot(ctx context.Context) (Metadata, error)

func (Store) PrepareRestore

func (s Store) PrepareRestore(ctx context.Context, destination string) (RestorePlan, error)

func (Store) Restore

func (s Store) Restore(ctx context.Context, plan RestorePlan, client Restorer) error

func (Store) VerifyOperationalRecovery

func (s Store) VerifyOperationalRecovery(ctx context.Context, plan RestorePlan, client Restorer, readiness RecoveryReadiness) error

VerifyOperationalRecovery never treats local files as proof of HA recovery.

func (Store) VerifyRecovery

func (s Store) VerifyRecovery(ctx context.Context, plan RestorePlan, client Restorer) error

func (Store) VerifySnapshot

func (s Store) VerifySnapshot(ctx context.Context) (Metadata, error)

type TLSFiles

type TLSFiles struct{ CA, Cert, Key string }

func (TLSFiles) Config

func (t TLSFiles) Config() (*tls.Config, error)

Jump to

Keyboard shortcuts

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