storage

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExistsInFS

type ExistsInFS interface {
	// FileExists does file exist at the path specified
	FileExists(path string) bool

	// DirectoryExists does directory exist at the path specified
	DirectoryExists(path string) bool
}

ExistsInFS contains methods that check the existence of file system items.

type ReadFromFS

type ReadFromFS interface {
	// Lstat, see https://pkg.go.dev/os#Lstat
	Lstat(path string) (fs.FileInfo, error)

	// Lstat, see https://pkg.go.dev/os#Stat
	Stat(path string) (fs.FileInfo, error)

	// ReadFile, see https://pkg.go.dev/os#ReadFile
	ReadFile(name string) ([]byte, error)

	// ReadDir, see https://pkg.go.dev/os#ReadDir
	ReadDir(name string) ([]os.DirEntry, error)
}

type ReadOnlyVirtualFS

type ReadOnlyVirtualFS interface {
	ExistsInFS
	ReadFromFS
	// contains filtered or unexported methods
}

ReadOnlyVirtualFS provides read-only access to the file system.

type VirtualBackend

type VirtualBackend string

type VirtualFS

type VirtualFS interface {
	ExistsInFS
	ReadFromFS
	WriteToFS

	Backend() VirtualBackend
	// contains filtered or unexported methods
}

VirtualFS is a facade over the native file system, which include read and write access.

func UseMemFS

func UseMemFS() VirtualFS

func UseNativeFS

func UseNativeFS() VirtualFS

type WriteToFS

type WriteToFS interface {

	// Chmod, see https://pkg.go.dev/os#Chmod
	Chmod(name string, mode os.FileMode) error

	// Chown, https://pkg.go.dev/os#Chown
	Chown(name string, uid, gid int) error

	// Create, see https://pkg.go.dev/os#Create
	Create(name string) (*os.File, error)

	// Link, see https://pkg.go.dev/os#Link
	Link(oldname, newname string) error

	// Mkdir, see https://pkg.go.dev/os#Mkdir
	Mkdir(name string, perm fs.FileMode) error

	// MkdirAll, see https://pkg.go.dev/os#MkdirAll
	MkdirAll(path string, perm os.FileMode) error

	// Remove, see https://pkg.go.dev/os#Remove
	Remove(name string) error

	// RemoveAll, see https://pkg.go.dev/os#RemoveAll
	RemoveAll(path string) error

	// Rename, see https://pkg.go.dev/os#Rename
	Rename(oldpath, newpath string) error

	// WriteFile, see https://pkg.go.dev/os#WriteFile
	WriteFile(name string, data []byte, perm os.FileMode) error
}

WriteToFS contains methods that perform mutative operations on the file system.

Jump to

Keyboard shortcuts

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