Versions in this module Expand all Collapse all v0 v0.2.3 Jun 18, 2024 Changes in this version + const InvalidFd + var ErrInjected = errors.New("injected error") + func Clone(srcFS, dstFS FS, srcPath, dstPath string) (bool, error) + func Copy(fs FS, oldname, newname string) error + func IsNoSpaceError(err error) bool — darwin/amd64, linux/amd64, windows/amd64 + func LimitedCopy(fs FS, oldname, newname string, maxBytes int64) error + func LinkOrCopy(fs FS, oldname, newname string) error + func Prefetch(file uintptr, offset uint64, size uint64) error + func ReportLeakedFD(fs FS, t *testing.T) + type DiskUsage struct + AvailBytes uint64 + TotalBytes uint64 + UsedBytes uint64 + type ErrorFS struct + func Wrap(fs FS, inj Injector) *ErrorFS + func (fs *ErrorFS) Create(name string) (File, error) + func (fs *ErrorFS) GetDiskUsage(path string) (DiskUsage, error) + func (fs *ErrorFS) Link(oldname, newname string) error + func (fs *ErrorFS) List(dir string) ([]string, error) + func (fs *ErrorFS) Lock(name string) (io.Closer, error) + func (fs *ErrorFS) MkdirAll(dir string, perm os.FileMode) error + func (fs *ErrorFS) Open(name string, opts ...OpenOption) (File, error) + func (fs *ErrorFS) OpenDir(name string) (File, error) + func (fs *ErrorFS) OpenForAppend(name string) (File, error) + func (fs *ErrorFS) OpenReadWrite(name string, opts ...OpenOption) (File, error) + func (fs *ErrorFS) PathBase(p string) string + func (fs *ErrorFS) PathDir(p string) string + func (fs *ErrorFS) PathJoin(elem ...string) string + func (fs *ErrorFS) Remove(name string) error + func (fs *ErrorFS) RemoveAll(fullname string) error + func (fs *ErrorFS) Rename(oldname, newname string) error + func (fs *ErrorFS) ReuseForWrite(oldname, newname string) (File, error) + func (fs *ErrorFS) Stat(name string) (os.FileInfo, error) + func (fs *ErrorFS) Unwrap() FS + type FS interface + Create func(name string) (File, error) + GetDiskUsage func(path string) (DiskUsage, error) + Link func(oldname, newname string) error + List func(dir string) ([]string, error) + Lock func(name string) (io.Closer, error) + MkdirAll func(dir string, perm os.FileMode) error + Open func(name string, opts ...OpenOption) (File, error) + OpenDir func(name string) (File, error) + OpenForAppend func(name string) (File, error) + OpenReadWrite func(name string, opts ...OpenOption) (File, error) + PathBase func(path string) string + PathDir func(path string) string + PathJoin func(elem ...string) string + Remove func(name string) error + RemoveAll func(name string) error + Rename func(oldname, newname string) error + ReuseForWrite func(oldname, newname string) (File, error) + Stat func(name string) (os.FileInfo, error) + var Default FS = defaultFS{} + type File interface + Fd func() uintptr + Preallocate func(offset, length int64) error + Prefetch func(offset int64, length int64) error + Stat func() (os.FileInfo, error) + Sync func() error + SyncData func() error + SyncTo func(length int64) (fullSync bool, err error) + func NewMemFile(data []byte) File + func NewSyncingFile(f File, opts SyncingFileOptions) File + func WithFd(inner, outer File) File + func WrapFile(f File, inj Injector) File + type InjectIndex struct + func OnIndex(index int32, op Op) *InjectIndex + func (ii *InjectIndex) Index() int32 + func (ii *InjectIndex) MaybeError(op Op) error + func (ii *InjectIndex) SetIndex(v int32) + type Injector interface + MaybeError func(Op) error + func WithProbability(op Op, p float64) Injector + type MemFS struct + func NewMem() *MemFS + func NewStrictMem() *MemFS + func (*MemFS) GetDiskUsage(string) (DiskUsage, error) + func (*MemFS) PathBase(p string) string + func (*MemFS) PathDir(p string) string + func (*MemFS) PathJoin(elem ...string) string + func (y *MemFS) Create(fullname string) (File, error) + func (y *MemFS) Iterate(f func(path string, isDir bool, refs int32) error) error + func (y *MemFS) Link(oldname, newname string) error + func (y *MemFS) List(dirname string) ([]string, error) + func (y *MemFS) Lock(fullname string) (io.Closer, error) + func (y *MemFS) MkdirAll(dirname string, perm os.FileMode) error + func (y *MemFS) Open(fullname string, opts ...OpenOption) (File, error) + func (y *MemFS) OpenDir(fullname string) (File, error) + func (y *MemFS) OpenForAppend(fullname string) (File, error) + func (y *MemFS) OpenReadWrite(fullname string, opts ...OpenOption) (File, error) + func (y *MemFS) Remove(fullname string) error + func (y *MemFS) RemoveAll(fullname string) error + func (y *MemFS) Rename(oldname, newname string) error + func (y *MemFS) ResetToSyncedState() + func (y *MemFS) ReuseForWrite(oldname, newname string) (File, error) + func (y *MemFS) SetIgnoreSyncs(ignoreSyncs bool) + func (y *MemFS) Stat(name string) (os.FileInfo, error) + func (y *MemFS) String() string + type Op int + const OpRead + const OpSync + const OpWrite + type OpenOption interface + Apply func(File) + var RandomReadsOption OpenOption = &randomReadsOption{} + var SequentialReadsOption OpenOption = &sequentialReadsOption{} + type SyncingFileOptions struct + BytesPerSync int + PreallocateSize int