fs

package
v0.0.1-prerelease5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToFS

func ToFS(fs Filesystem) fs.FS

Types

type File

type File interface {
	Stat() (fs.FileInfo, error)
	io.Writer
	io.Reader
	io.Closer
}

type Filesystem

type Filesystem interface {
	// OpenFile is the generalized open call; most users will use Open or Create
	// instead. It opens the named file with specified flag (O_RDONLY etc.) and
	// perm, (0666 etc.) if applicable. If successful, methods on the returned
	// File can be used for I/O.
	OpenFile(filename string, flag int, perm os.FileMode) (File, error)
	// Stat returns a FileInfo describing the named file.
	Stat(filename string) (os.FileInfo, error)
	// Remove removes the named file or directory.
	Remove(filename string) error

	// ReadDir reads the directory named by dirname and returns a list of
	// directory entries sorted by filename.
	ReadDir(path string) ([]os.FileInfo, error)
	// MkdirAll creates a directory named path, along with any necessary
	// parents, and returns nil, or else returns an error. The permission bits
	// perm are used for all directories that MkdirAll creates. If path is/
	// already a directory, MkdirAll does nothing and returns nil.
	MkdirAll(filename string, perm os.FileMode) error
}

Filesystem is a subset of a filesystem API surface area Our storage engine requires the ability to open regular files and directories for reading and writing both metadata and contents

func SubFilesystem

func SubFilesystem(fs Filesystem, dir string) Filesystem

SubFilesystem decorates the provided filesystem with one which scopes all provided paths with a parent directory before delegating.

Jump to

Keyboard shortcuts

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