validator

package
v0.31.1 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: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DataDirectoryValid indicates data directory is valid.
	DataDirectoryValid = iota
	// WrongVolumeMounted indicates wrong volume is attached to the ETCD container
	WrongVolumeMounted
	// DataDirectoryNotExist indicates data directory is non-existent.
	DataDirectoryNotExist
	// DataDirectoryInvStruct indicates data directory has invalid structure.
	DataDirectoryInvStruct
	// DataDirectoryCorrupt indicates data directory is corrupt.
	DataDirectoryCorrupt
	// BoltDBCorrupt indicates Bolt database is corrupt.
	BoltDBCorrupt
	// DataDirectoryStatusUnknown indicates validator failed to check the data directory status.
	DataDirectoryStatusUnknown
	// DataDirStatusInvalidInMultiNode indicates validator failed to check the data directory status in multi-node etcd cluster.
	DataDirStatusInvalidInMultiNode
	// RevisionConsistencyError indicates current etcd revision is inconsistent with latest snapshot revision.
	RevisionConsistencyError
	// FailBelowRevisionConsistencyError indicates the current etcd revision is inconsistent with failBelowRevision.
	FailBelowRevisionConsistencyError
	// FailToOpenBoltDBError indicates that backup-restore is unable to open boltDB as it is failed to acquire lock over database.
	FailToOpenBoltDBError
)

Variables

View Source
var (
	// ErrPathRequired is returned when the path to a Bolt database is not specified.
	ErrPathRequired = errors.New("path required")

	// ErrFileNotFound is returned when a Bolt database does not exist.
	ErrFileNotFound = errors.New("file not found")

	// ErrCorrupt is returned when a checking a data file finds errors.
	ErrCorrupt = errors.New("invalid value")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir                string
	EmbeddedEtcdQuotaBytes int64
	SnapstoreConfig        *brtypes.SnapstoreConfig
}

Config store configuration for DataValidator.

type DataDirStatus

type DataDirStatus int

DataDirStatus represents the status of the etcd data directory.

type DataValidator

type DataValidator struct {
	Config              *Config
	OriginalClusterSize int
	Logger              *logrus.Logger
	ZapLogger           *zap.Logger
}

DataValidator contains implements Validator interface to perform data validation.

func (*DataValidator) Validate

func (d *DataValidator) Validate(mode Mode, failBelowRevision int64) (DataDirStatus, error)

Validate performs the steps required to validate data for Etcd instance.

type Mode

type Mode string

Mode is the Validation mode passed on to the DataValidator

const (
	// Full Mode does complete validation including the data directory contents for corruption.
	Full Mode = "full"
	// Sanity Mode does a quick, partial validation of data directory using time-efficient checks.
	Sanity Mode = "sanity"
)

type Validator

type Validator interface {
	Validate(Mode, int64) error
}

Validator is the interface for data validation actions.

Jump to

Keyboard shortcuts

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