Documentation
¶
Index ¶
- type FS
- type Failer
- type File
- func (f *File) Close() error
- func (f *File) Name() string
- func (f *File) Read(p []byte) (int, error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) ReadDir(n int) ([]fs.DirEntry, error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Stat() (fs.FileInfo, error)
- func (f *File) Write(p []byte) (n int, err error)
- func (f *File) WriteAt(p []byte, off int64) (n int, err error)
- type OS
- func (o *OS) Chdir(dir string) error
- func (o *OS) Chmod(name string, mode fs.FileMode) error
- func (o *OS) Chown(name string, uid int, gid int) error
- func (o *OS) Create(name string) (fs.File, error)
- func (o *OS) DirFS(dir string) fs.FS
- func (o *OS) Getwd() (dir string, err error)
- func (o *OS) Lstat(name string) (fs.FileInfo, error)
- func (o *OS) Mkdir(name string, perm fs.FileMode) error
- func (o *OS) MkdirAll(path string, perm fs.FileMode) error
- func (o *OS) Open(name string) (fs.File, error)
- func (o *OS) OpenFile(name string, flag int, perm fs.FileMode) (fs.File, error)
- func (o *OS) ReadDir(name string) ([]fs.DirEntry, error)
- func (o *OS) ReadLink(name string) (string, error)
- func (o *OS) Stat(name string) (fs.FileInfo, error)
- func (o *OS) Symlink(oldName string, newName string) error
- type ProbabilityFailer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Failer ¶
type Failer interface {
// Checks if the called operation should fail
// os - the [fs.OS] object
// Arguments helping to make a decision:
// op` - called operation
// self - object which method is called (e.g. Fd). Can be nil (e.g. for methods of `Fs`)
// args - the arguments of the operation
ShouldFail(os fs.OS, op fs.Op, self any, args ...any) error
}
Failure-injection interface
type File ¶
type File struct {
// contains filtered or unexported fields
}
type OS ¶
type OS struct {
// contains filtered or unexported fields
}
type ProbabilityFailer ¶
type ProbabilityFailer struct {
// contains filtered or unexported fields
}
Generates random failures with the given probability
func NewProbabilityFailer ¶
func NewProbabilityFailer(seed int64, prob float64) *ProbabilityFailer
Creates a new ProbabilityFailer with the given probability
func (*ProbabilityFailer) ShouldFail ¶
Click to show internal directories.
Click to hide internal directories.