snapshot

package
v3.3.0-rc.0.0...-d8dc29e Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package snapshot implements utilities around etcd snapshot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Save fetches snapshot from remote etcd server and saves data to target path.
	// If the context "ctx" is canceled or timed out, snapshot save stream will error out
	// (e.g. context.Canceled, context.DeadlineExceeded).
	Save(ctx context.Context, dbPath string) error

	// Status returns the snapshot file information.
	Status(dbPath string) (Status, error)

	// Restore restores a new etcd data directory from given snapshot file.
	// It returns an error if specified data directory already exists, to
	// prevent unintended data directory overwrites.
	Restore(dbPath string, cfg RestoreConfig) error
}

Manager defines snapshot methods.

func NewV3

func NewV3(cli *clientv3.Client, lg logutil.Logger) Manager

NewV3 returns a new snapshot Manager for v3.x snapshot. "*clientv3.Client" is only used for "Save" method. Otherwise, pass "nil".

type RestoreConfig

type RestoreConfig struct {
	// Name is the human-readable name of this member.
	Name string
	// OutputDataDir is the target data directory to save restored data.
	// OutputDataDir should not conflict with existing etcd data directory.
	// If OutputDataDir already exists, it will return an error to prevent
	// unintended data directory overwrites.
	// Defaults to "[Name].etcd" if not given.
	OutputDataDir string
	// OutputWALDir is the target WAL data directory.
	// Defaults to "[OutputDataDir]/member/wal" if not given.
	OutputWALDir string
	// InitialCluster is the initial cluster configuration for restore bootstrap.
	InitialCluster types.URLsMap
	// InitialClusterToken is the initial cluster token for etcd cluster during restore bootstrap.
	InitialClusterToken string
	// PeerURLs is a list of member's peer URLs to advertise to the rest of the cluster.
	PeerURLs types.URLs
	// SkipHashCheck is "true" to ignore snapshot integrity hash value
	// (required if copied from data directory).
	SkipHashCheck bool
}

RestoreConfig configures snapshot restore operation.

type Status

type Status struct {
	Hash      uint32 `json:"hash"`
	Revision  int64  `json:"revision"`
	TotalKey  int    `json:"totalKey"`
	TotalSize int64  `json:"totalSize"`
}

Status is the snapshot file status.

Jump to

Keyboard shortcuts

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