dmflakey

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSType

type FSType string

FSType represents the filesystem name.

const (
	FSTypeEXT4 FSType = "ext4"
	FSTypeXFS  FSType = "xfs"
)

Supported filesystems.

type FeatOpt

type FeatOpt func(*featCfg)

FeatOpt is used to configure failure feature.

func WithIntervalFeatOpt

func WithIntervalFeatOpt(interval time.Duration) FeatOpt

WithIntervalFeatOpt updates the up time for the feature.

func WithSyncFSFeatOpt

func WithSyncFSFeatOpt(syncFS bool) FeatOpt

WithSyncFSFeatOpt is to determine if the caller wants to synchronize filesystem before inject failure.

type Flakey

type Flakey interface {
	// DevicePath returns the flakey device path.
	DevicePath() string

	// Filesystem returns filesystem's type.
	Filesystem() FSType

	// AllowWrites allows write I/O.
	AllowWrites(opts ...FeatOpt) error

	// DropWrites drops all write I/O silently.
	DropWrites(opts ...FeatOpt) error

	// ErrorWrites drops all write I/O and returns error.
	ErrorWrites(opts ...FeatOpt) error

	// Teardown releases the flakey device.
	Teardown() error
}

Flakey is to inject failure into device.

func InitFlakey

func InitFlakey(flakeyDevice, dataStorePath string, fsType FSType, mkfsOpt string) (_ Flakey, retErr error)

InitFlakey creates an filesystem on a loopback device and returns Flakey on it.

The device-mapper device will be /dev/mapper/$flakeyDevice. And the filesystem image will be created at $dataStorePath/$flakeyDevice.img. By default, the device is available for 2 minutes and size is 10 GiB.

Jump to

Keyboard shortcuts

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