robustness

package
v0.8.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Overview

Package robustness contains tests that that validate data stability over time. The package, while designed for Kopia, is written with abstractions that can be used to test other environments.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoOp is thrown when an action could not do anything useful.
	ErrNoOp = fmt.Errorf("no-op")

	// ErrCannotPerformIO is returned if the engine determines there is not enough space
	// to write files.
	ErrCannotPerformIO = fmt.Errorf("cannot perform i/o")

	// ErrNoActionPicked is returned if a random action could not be selected.
	ErrNoActionPicked = errors.New("unable to pick an action with the action control options provided")

	// ErrInvalidOption is returned if an option value is invalid or missing.
	ErrInvalidOption = errors.New("invalid option setting")

	// ErrKeyNotFound is returned when the store can't find the key provided.
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func GetOptAsIntOrDefault

func GetOptAsIntOrDefault(key string, opts map[string]string, def int) int

GetOptAsIntOrDefault extracts an integer value from a configuration map if present, or else returns a default.

Types

type Comparer

type Comparer interface {
	Gather(ctx context.Context, path string, opts map[string]string) ([]byte, error)
	Compare(ctx context.Context, path string, data []byte, reportOut io.Writer, opts map[string]string) error
}

Comparer describes an interface that gathers state data on a provided path, and compares that data to the state on another path.

type FileWriter

type FileWriter interface {
	// DataDirectory returns the absolute path of the data directory configured.
	DataDirectory() string

	// DeleteDirectoryContents deletes some of the content of a random directory,
	// based on its input option values (none of which are required).
	// The method returns the effective option values used and the error if any.
	// ErrNoOp is returned if no directory is found.
	DeleteDirectoryContents(opts map[string]string) (map[string]string, error)

	// DeleteEverything deletes all content.
	DeleteEverything() error

	// DeleteRandomSubdirectory deletes a random directory, based
	// on its input option values (none of which are required).
	// The method returns the effective option values used and the error if any.
	// ErrNoOp is returned if no directory is found.
	DeleteRandomSubdirectory(opts map[string]string) (map[string]string, error)

	// WriteRandomFiles writes a number of files in a random directory, based
	// on its input option values (none of which are required).
	// The method returns the effective option values used and the error if any.
	WriteRandomFiles(opts map[string]string) (map[string]string, error)
}

FileWriter is an interface used for filesystem related actions.

type Persister

type Persister interface {
	Store
	LoadMetadata() error
	FlushMetadata() error
	GetPersistDir() string
}

Persister describes the ability to flush metadata to, and load it again, from a repository.

type Snapshotter

type Snapshotter interface {
	CreateSnapshot(sourceDir string, opts map[string]string) (snapID string, err error)
	RestoreSnapshot(snapID string, restoreDir string, opts map[string]string) error
	DeleteSnapshot(snapID string, opts map[string]string) error
	RunGC(opts map[string]string) error
	ListSnapshots() ([]string, error)
}

Snapshotter is an interface that describes methods for taking, restoring, deleting snapshots, and tracking them by a string snapshot ID.

type Store

type Store interface {
	Store(key string, val []byte) error
	Load(key string) ([]byte, error)
	Delete(key string)
}

Store describes the ability to store and retrieve a buffer of metadata, indexed by a string key.

Directories

Path Synopsis
Package checker defines the framework for creating and restoring snapshots with a data integrity check
Package checker defines the framework for creating and restoring snapshots with a data integrity check
Package engine provides the framework for a snapshot repository testing engine
Package engine provides the framework for a snapshot repository testing engine
Package fiofilewriter provides a FileWriter based on FIO.
Package fiofilewriter provides a FileWriter based on FIO.
Package pathlock defines a PathLocker interface and an implementation that will synchronize based on filepath.
Package pathlock defines a PathLocker interface and an implementation that will synchronize based on filepath.
Package snapmeta provides Kopia implementations of Persister and Snapshotter.
Package snapmeta provides Kopia implementations of Persister and Snapshotter.

Jump to

Keyboard shortcuts

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