Documentation ¶
Index ¶
- type Dir
- func (d *Dir) Close() error
- func (d *Dir) Name() string
- func (d *Dir) Read(p []byte) (n int, err error)
- func (d *Dir) ReadAt(p []byte, off int64) (n int, err error)
- func (d *Dir) ReadDir(n int) ([]fs.DirEntry, error)
- func (d *Dir) Readdir(n int) ([]os.FileInfo, error)
- func (d *Dir) Readdirnames(n int) ([]string, error)
- func (d *Dir) Seek(offset int64, whence int) (int64, error)
- func (d *Dir) Stat() (os.FileInfo, error)
- func (d *Dir) Sync() error
- func (d *Dir) Truncate(size int64) error
- func (d *Dir) Write(p []byte) (n int, err error)
- func (d *Dir) WriteAt(p []byte, off int64) (n int, err error)
- func (d *Dir) WriteString(s string) (ret int, err error)
- type DirsMerger
- type FilesystemIterator
- type Options
- type OverlayFs
- func (ofs OverlayFs) Append(fss ...afero.Fs) *OverlayFs
- func (ofs *OverlayFs) Chmod(name string, mode os.FileMode) error
- func (ofs *OverlayFs) Chown(name string, uid, gid int) error
- func (ofs *OverlayFs) Chtimes(name string, atime, mtime time.Time) error
- func (ofs *OverlayFs) Create(name string) (afero.File, error)
- func (ofs *OverlayFs) Filesystem(i int) afero.Fs
- func (ofs *OverlayFs) LstatIfPossible(name string) (os.FileInfo, bool, error)
- func (ofs *OverlayFs) Mkdir(name string, perm os.FileMode) error
- func (ofs *OverlayFs) MkdirAll(path string, perm os.FileMode) error
- func (ofs *OverlayFs) Name() string
- func (ofs *OverlayFs) NumFilesystems() int
- func (ofs *OverlayFs) Open(name string) (afero.File, error)
- func (ofs *OverlayFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (ofs *OverlayFs) Remove(name string) error
- func (ofs *OverlayFs) RemoveAll(path string) error
- func (ofs *OverlayFs) Rename(oldname, newname string) error
- func (ofs *OverlayFs) Stat(name string) (os.FileInfo, error)
- func (ofs OverlayFs) WithDirsMerger(d DirsMerger) *OverlayFs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
Dir is an afero.File that represents list of directories that will be merged in Readdir and Readdirnames.
func OpenDir ¶ added in v0.8.0
func OpenDir( merge DirsMerger, info func() (os.FileInfo, error), dirOpeners ...func() (afero.File, error), ) (*Dir, error)
OpenDir opens a new Dir with dirs to be merged by the given merge func. If merge is nil, a default DirsMerger is used.
func (*Dir) Close ¶
Close implements afero.File.Close. Note that d must not be used after it is closed, as the object may be reused.
func (*Dir) Readdir ¶
Readdir implements afero.File.Readdir. If n > 0, Readdir returns at most n. Note that Dir also implements fs.ReadDirFile, which is more efficient.
func (*Dir) Readdirnames ¶
Readdirnames implements afero.File.Readdirnames. If n > 0, Readdirnames returns at most n.
type DirsMerger ¶
DirsMerger is used to merge two directories.
type FilesystemIterator ¶
FilesystemIterator is an interface for iterating over the wrapped filesystems in order.
type Options ¶
type Options struct { // The filesystems to overlay ordered in priority from left to right. Fss []afero.Fs // The OverlayFs is by default read-only, but you can nominate the first filesystem to be writable. FirstWritable bool // The DirsMerger is used to merge the contents of two directories. // If not provided, the defaultDirMerger is used. DirsMerger DirsMerger }
Options for the OverlayFs.
type OverlayFs ¶
type OverlayFs struct {
// contains filtered or unexported fields
}
OverlayFs is a filesystem that overlays multiple filesystems. It's by default a read-only filesystem, but you can nominate the first filesystem to be writable. For all operations, the filesystems are checked in order until found. If a filesystem implementes FilesystemIterator, those filesystems will be checked before continuing.
func (OverlayFs) Append ¶
Append creates a shallow copy of the filesystem and appends the given filesystems to it.
func (*OverlayFs) Create ¶
Create creates a file in the filesystem, returning the file and an error, if any happens.
func (*OverlayFs) Filesystem ¶
Filesystem returns filesystem with index i, nil if not found.
func (*OverlayFs) LstatIfPossible ¶
LstatIfPossible will call Lstat if the filesystem iself is, or it delegates to, the os filesystem. Else it will call Stat.
func (*OverlayFs) Mkdir ¶
Mkdir creates a directory in the filesystem, return an error if any happens.
func (*OverlayFs) MkdirAll ¶
MkdirAll creates a directory path and all parents that does not exist yet.
func (*OverlayFs) NumFilesystems ¶
NumFilesystems returns the number of filesystems in this composite filesystem.
func (*OverlayFs) Open ¶
Open opens a file, returning it or an error, if any happens. If name is a directory, a *Dir is returned representing all directories matching name. Note that a *Dir must not be used after it's closed.
func (*OverlayFs) Remove ¶
Remove removes a file identified by name, returning an error, if any happens.
func (*OverlayFs) RemoveAll ¶
RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).
func (*OverlayFs) Stat ¶
Stat returns a FileInfo describing the named file, or an error, if any happens.
func (OverlayFs) WithDirsMerger ¶ added in v0.9.0
func (ofs OverlayFs) WithDirsMerger(d DirsMerger) *OverlayFs
WithDirsMerger creates a shallow copy of the filesystem and sets the DirsMerger.