package snapshot

import "go.etcd.io/etcd/client/v3/snapshot"

Package snapshot implements utilities around etcd snapshot.

Index

Functions

func SaveWithVersion

func SaveWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, dbPath string) (string, error)

SaveWithVersion fetches snapshot from remote etcd server, saves data to target path and returns server version. If the context "ctx" is canceled or timed out, snapshot save stream will error out (e.g. context.Canceled, context.DeadlineExceeded). Make sure to specify only one endpoint in client configuration. Snapshot API must be requested to a selected node, and saved snapshot is the point-in-time state of the selected node. Etcd <v3.6 will return "" as version.

Source Files

doc.go v3_snapshot.go

Version
v3.6.4 (latest)
Published
Jul 25, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
3 months ago

Tools for package owners.