Documentation ¶
Overview ¶
Package fio wraps calls to the fio tool. It assumes the tool is executable by "fio", but gives the option to specify another executable path by setting environment variable FIO_EXE.
Index ¶
- Constants
- Variables
- type Config
- type Job
- type NullPathLocker
- type Options
- func (o Options) Merge(other Options) Options
- func (o Options) WithBlockSize(blockSizeB int64) Options
- func (o Options) WithDedupePercentage(dPcnt int) Options
- func (o Options) WithDirectory(dir string) Options
- func (o Options) WithFileSize(fileSizeB int64) Options
- func (o Options) WithFileSizeRange(fileSizeMinB, fileSizeMaxB int64) Options
- func (o Options) WithIOLimit(ioSizeB int64) Options
- func (o Options) WithIOSize(sizeB int64) Options
- func (o Options) WithNoFallocate() Options
- func (o Options) WithNumFiles(numFiles int) Options
- func (o Options) WithRandRepeat(set bool) Options
- func (o Options) WithSize(sizeB int64) Options
- func (o Options) WithSizeRange(sizeMinB, sizeMaxB int64) Options
- type Runner
- func (fr *Runner) Cleanup()
- func (fr *Runner) DeleteContentsAtDepth(relBasePath string, depth int, prob float32) error
- func (fr *Runner) DeleteDirAtDepth(relBasePath string, depth int) error
- func (fr *Runner) DeleteRelDir(relDirPath string) error
- func (fr *Runner) Run(args ...string) (stdout, stderr string, err error)
- func (fr *Runner) RunConfigs(cfgs ...Config) (stdout, stderr string, err error)
- func (fr *Runner) WriteFiles(relPath string, opt Options) error
- func (fr *Runner) WriteFilesAtDepth(relBasePath string, depth int, opt Options) error
- func (fr *Runner) WriteFilesAtDepthRandomBranch(relBasePath string, depth int, opt Options) error
Constants ¶
const ( // FioExeEnvKey gives the path to the fio executable to use in testing. FioExeEnvKey = "FIO_EXE" // FioDockerImageEnvKey specifies the docker image tag to use. If // FioExeEnvKey is set, the local executable will be used instead of // docker, even if this variable is also set. FioDockerImageEnvKey = "FIO_DOCKER_IMAGE" // LocalFioDataPathEnvKey is the local path where fio data will be // accessible. If not specified, defaults to the default temp directory (os.TempDir). LocalFioDataPathEnvKey = "LOCAL_FIO_DATA_PATH" // HostFioDataPathEnvKey specifies the path where fio data will be written, // relative to the docker host. If left blank, defaults to local fio data path // (works unless running via docker from within a container, e.g. for development). HostFioDataPathEnvKey = "HOST_FIO_DATA_PATH" )
Environment variable keys.
const ( BlockSizeFioArg = "blocksize" DedupePercentageFioArg = "dedupe_percentage" DirectoryFioArg = "directory" FallocateFioArg = "fallocate" FileSizeFioArg = "filesize" IOLimitFioArg = "io_limit" IOSizeFioArg = "io_size" NumFilesFioArg = "nrfiles" RandRepeatFioArg = "randrepeat" SizeFioArg = "size" )
List of FIO argument strings.
const ( NoneFio = "none" RandWriteFio = "randwrite" RangeDelimFio = "-" )
List of FIO specific fields and delimiters.
const (
JobNameFlag = "--name"
)
List of fio flags.
Variables ¶
var ( ErrNoDirFound = errors.New("no directory found at this depth") ErrCanNotDeleteRoot = errors.New("can not delete root directory") )
List of known errors.
var (
ErrEnvNotSet = fmt.Errorf("must set either %v or %v", FioExeEnvKey, FioDockerImageEnvKey)
)
Known error messages.
Functions ¶
This section is empty.
Types ¶
type NullPathLocker ¶ added in v0.8.0
type NullPathLocker struct{}
NullPathLocker satisfies the pathlock.Locker interface but is a no-op.
func (*NullPathLocker) Lock ¶ added in v0.8.0
func (l *NullPathLocker) Lock(lockPath string) (pathlock.Unlocker, error)
Lock implements the pathlock.Locker interface.
func (*NullPathLocker) Unlock ¶ added in v0.8.0
func (l *NullPathLocker) Unlock()
Unlock satisfies the pathlock.Unlocker interface.
type Options ¶
Options are flags to be set when running fio.
func (Options) Merge ¶
Merge will merge two Options, overwriting common option keys with the incoming option values. Returns the merged result.
func (Options) WithBlockSize ¶
WithBlockSize sets the fio block size option.
func (Options) WithDedupePercentage ¶
WithDedupePercentage sets the fio dedupe percentage.
func (Options) WithDirectory ¶
WithDirectory sets the fio option for the directory to write in.
func (Options) WithFileSize ¶
WithFileSize sets the fio file size.
func (Options) WithFileSizeRange ¶
WithFileSizeRange sets the fio file size range.
func (Options) WithIOLimit ¶
WithIOLimit sets the fio io limit.
func (Options) WithIOSize ¶
WithIOSize sets the fio io size.
func (Options) WithNoFallocate ¶
WithNoFallocate sets the fio option fallocate to "none".
func (Options) WithNumFiles ¶
WithNumFiles sets the fio number of files.
func (Options) WithRandRepeat ¶
WithRandRepeat sets the fio option rand repeat.
func (Options) WithSizeRange ¶
WithSizeRange sets the fio size range.
type Runner ¶
type Runner struct { Exe string ExecArgs []string LocalDataDir string FioWriteBaseDir string Global Config Debug bool PathLock pathlock.Locker }
Runner is a helper for running fio commands.
func (*Runner) DeleteContentsAtDepth ¶ added in v0.7.0
DeleteContentsAtDepth deletes some or all of the contents of a directory at the provided depths. The probability argument denotes the probability in the range [0.0,1.0] that a given file system entry in the directory at this depth will be deleted. Probability set to 0 will delete nothing. Probability set to 1 will delete everything.
func (*Runner) DeleteDirAtDepth ¶ added in v0.7.0
DeleteDirAtDepth deletes a random directory at the given depth.
func (*Runner) DeleteRelDir ¶
DeleteRelDir deletes a relative directory in the runner's data directory.
func (*Runner) RunConfigs ¶
RunConfigs runs fio using the provided Configs.
func (*Runner) WriteFiles ¶
WriteFiles writes files to the directory specified by path, up to the provided size and number of files.
func (*Runner) WriteFilesAtDepth ¶ added in v0.7.0
WriteFilesAtDepth writes files to a directory "depth" layers deep below the base data directory.
func (*Runner) WriteFilesAtDepthRandomBranch ¶ added in v0.7.0
WriteFilesAtDepthRandomBranch writes files to a directory "depth" layers deep below the base data directory and branches at a random depth.