Files
kopia/repo/blob/filesystem/osinterface.go
Julio Lopez 537ab39236 chore(general): cleanup "stale" error naming (#3129)
Rename IsESTALE to IsStale to make it consistent with
the conventions in the Go ecosystem

Use errors.Is() instead of == comparison. It is more robust.
2023-07-06 10:59:58 -07:00

42 lines
979 B
Go

package filesystem
import (
"io"
"io/fs"
"os"
"time"
)
// osInterface is an operating system file interface, used by filesystemStorage to support mocking.
//
//nolint:interfacebloat
type osInterface interface {
Open(fname string) (osReadFile, error)
IsNotExist(err error) bool
IsExist(err error) bool
IsPathError(err error) bool
IsLinkError(err error) bool
IsPathSeparator(c byte) bool
IsStale(err error) bool
Remove(fname string) error
Rename(oldname, newname string) error
ReadDir(dirname string) ([]fs.DirEntry, error)
Stat(fname string) (os.FileInfo, error)
CreateNewFile(fname string, mode os.FileMode) (osWriteFile, error)
Mkdir(fname string, mode os.FileMode) error
MkdirAll(fname string, mode os.FileMode) error
Chtimes(fname string, atime, mtime time.Time) error
Geteuid() int
Chown(fname string, uid, gid int) error
}
type osReadFile interface {
io.ReadSeekCloser
Stat() (os.FileInfo, error)
}
type osWriteFile interface {
io.WriteCloser
}