initializer

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SnapstoreConfig      *brtypes.SnapstoreConfig
	RestoreOptions       *brtypes.RestoreOptions
	EtcdConnectionConfig *brtypes.EtcdConnectionConfig
}

Config holds etcd related configuration required for initialization checks and snapshot restoration in case of corruption.

type EtcdInitializer

type EtcdInitializer struct {
	Validator *validator.DataValidator
	Config    *Config
	Logger    *logrus.Logger
}

EtcdInitializer implements Initializer interface to perform validation and data restore if required.

func NewInitializer

func NewInitializer(restoreOptions *brtypes.RestoreOptions, snapstoreConfig *brtypes.SnapstoreConfig, etcdConnectionConfig *brtypes.EtcdConnectionConfig, logger *logrus.Logger) (*EtcdInitializer, error)

NewInitializer creates an etcd initializer object.

func (*EtcdInitializer) Initialize

func (e *EtcdInitializer) Initialize(mode validator.Mode, failBelowRevision int64) error

Initialize has the following steps:

  • Check if data directory exists.
  • If data directory exists
  • Check for data corruption.
  • If data directory is in corrupted state, clear the data directory.
  • If data directory does not exist.
  • Check if Latest snapshot available.
  • Try to perform an Etcd data restoration from the latest snapshot.
  • No snapshots are available, start etcd as a fresh installation.

type Initializer

type Initializer interface {
	Initialize(validator.Mode, int64) error
}

Initializer is the interface for etcd initialization actions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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