Documentation
¶
Overview ¶
Package rootfs provides an Afero filesystem pinned to an OS directory handle.
Index ¶
- func RemoveFS(backing afero.Fs, parentPath, name string) error
- type Billy
- func (b *Billy) Chmod(name string, mode os.FileMode) error
- func (b *Billy) Chroot(name string) (billy.Filesystem, error)
- func (b *Billy) Close() error
- func (b *Billy) Create(name string) (billy.File, error)
- func (b *Billy) Join(elem ...string) string
- func (b *Billy) Lstat(name string) (os.FileInfo, error)
- func (b *Billy) MkdirAll(name string, perm os.FileMode) error
- func (b *Billy) Open(name string) (billy.File, error)
- func (b *Billy) OpenFile(name string, flag int, perm os.FileMode) (billy.File, error)
- func (b *Billy) ReadDir(name string) ([]os.FileInfo, error)
- func (b *Billy) Readlink(name string) (string, error)
- func (b *Billy) Remove(name string) error
- func (b *Billy) Rename(oldname, newname string) error
- func (b *Billy) Root() string
- func (b *Billy) Stat(name string) (os.FileInfo, error)
- func (b *Billy) Symlink(target, name string) error
- func (b *Billy) TempFile(dir, prefix string) (billy.File, error)
- type FS
- func (f *FS) Chmod(name string, mode os.FileMode) error
- func (f *FS) Chown(name string, uid, gid int) error
- func (f *FS) Chtimes(name string, atime, mtime time.Time) error
- func (f *FS) Close() error
- func (f *FS) Create(name string) (afero.File, error)
- func (f *FS) LstatIfPossible(name string) (os.FileInfo, bool, error)
- func (f *FS) Mkdir(name string, perm os.FileMode) error
- func (f *FS) MkdirAll(name string, perm os.FileMode) error
- func (f *FS) Name() string
- func (f *FS) Open(name string) (afero.File, error)
- func (f *FS) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (f *FS) ReadlinkIfPossible(name string) (string, error)
- func (f *FS) Remove(name string) error
- func (f *FS) RemoveAll(name string) error
- func (f *FS) Rename(oldname, newname string) error
- func (f *FS) Root() string
- func (f *FS) Stat(name string) (os.FileInfo, error)
- func (f *FS) Sub(name string) (*FS, error)
- func (f *FS) SymlinkIfPossible(target, name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Billy ¶
type Billy struct {
// contains filtered or unexported fields
}
Billy adapts a borrowed Afero filesystem for go-git. Close releases only the child handles opened by Chroot, not the borrowed filesystem.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS owns a directory handle. Root is a display path, never an authority for I/O. Names must be relative. Symlink targets are preserved verbatim, but absolute and escaping links cannot be followed, even when they point back into Root.
func Open ¶
Open pins an existing directory, rejecting a symlink at the root itself. Ancestors of path must be trusted; use Sub for untrusted descendants.
func Prepare ¶
Prepare creates a private single-component directory under a trusted parent. The caller owns both returned handles and must close both, including on later initialization failure. Existing symlink roots are rejected even with replace.
func PrepareFS ¶
PrepareFS selects the pinned OS backend for nil or OsFs, and a private job namespace for MemMapFs. Other injected backends fail closed rather than accidentally treating a host filesystem as a relative namespace. On success the caller owns the OS parent and child handles, if present.
func (*FS) Sub ¶
Sub derives an independently owned handle through the pinned parent, not through its possibly replaced display path. Closing either handle does not close the other.