Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Directory ¶
type Directory interface { // Enter creates a derived directory handle for a subdirectory // of the current subtree. Enter(name string) (Directory, error) // Close any resources associated with the current directory. Close() error // Link is the equivalent of os.Link(). Link(oldName string, newDirectory Directory, newName string) error // Lstat is the equivalent of os.Lstat(). Lstat(name string) (FileInfo, error) // Mkdir is the equivalent of os.Mkdir(). Mkdir(name string, perm os.FileMode) error // OpenFile is the equivalent of os.OpenFile(). OpenFile(name string, flag int, perm os.FileMode) (File, error) // ReadDir is the equivalent of ioutil.ReadDir(). ReadDir() ([]FileInfo, error) // Readlink is the equivalent of os.Readlink(). Readlink(name string) (string, error) // Remove is the equivalent of os.Remove(). Remove(name string) error // RemoveAll is the equivalent of os.RemoveAll(). RemoveAll(name string) error // RemoveAllChildren empties out a directory, without removing // the directory itself. RemoveAllChildren() error // Symlink is the equivalent of os.Symlink(). Symlink(oldName string, newName string) error }
Directory is an abstraction for accessing a subtree of the file system. Each of the functions should be implemented in such a way that they reject access to data stored outside of the subtree. This allows for safe, race-free traversal of the file system.
By placing this in a separate interface, it's easier to stub out file system handling as part of unit tests entirely.
func NewLocalDirectory ¶
NewLocalDirectory creates a directory handle that corresponds to a local path on the system.
type File ¶
File is an interface for the operations that are applied on regular files opened through Directory.OpenFile().
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo is a subset of os.FileInfo, only containing the features used by the Buildbarn codebase.
func NewFileInfo ¶
NewFileInfo constructs a FileInfo object that returns fixed values for its methods.
type FileType ¶
type FileType int
FileType is an enumeration of the type of a file stored on a file system.
const ( // FileTypeRegularFile means the file is a regular file that is // not executable. FileTypeRegularFile FileType = iota // FileTypeExecutableFile means the file is a regular file that // is executable. FileTypeExecutableFile // FileTypeDirectory means the file is a directory. FileTypeDirectory // FileTypeSymlink means the file is a symbolic link. FileTypeSymlink // FileTypeOther means the file is neither a regular file, a // directory or symbolic link. FileTypeOther )