package overlayfs
import "github.com/bep/overlayfs"
Index ¶
- type Dir
- func OpenDir( merge DirsMerger, info func() (os.FileInfo, error), dirOpeners ...func() (afero.File, error), ) (*Dir, error)
- 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 New(opts Options) *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
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 ¶
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) Name ¶
Name implements afero.File.Name.
func (*Dir) Read ¶
Read is not supported.
func (*Dir) ReadAt ¶
ReadAt is not supported.
func (*Dir) ReadDir ¶
ReadDir implements fs.ReadDirFile.
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.
func (*Dir) Seek ¶
Seek is not supported.
func (*Dir) Stat ¶
Stat implements afero.File.Stat.
func (*Dir) Sync ¶
Sync is not supported.
func (*Dir) Truncate ¶
Truncate is not supported.
func (*Dir) Write ¶
Write is not supported.
func (*Dir) WriteAt ¶
WriteAt is not supported.
func (*Dir) WriteString ¶
WriteString is not supported.
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 New ¶
New creates a new OverlayFs with the given options.
func (OverlayFs) Append ¶
Append creates a shallow copy of the filesystem and appends the given filesystems to it.
func (*OverlayFs) Chmod ¶
Chmod changes the mode of the named file to mode.
func (*OverlayFs) Chown ¶
Chown changes the uid and gid of the named file.
func (*OverlayFs) Chtimes ¶
Chtimes changes the access and modification times of the named file
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) Name ¶
Name returns the name of this filesystem.
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) OpenFile ¶
OpenFile opens a file using the given flags and the given mode.
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) Rename ¶
Rename renames a file.
func (*OverlayFs) Stat ¶
Stat returns a FileInfo describing the named file, or an error, if any happens.
func (OverlayFs) WithDirsMerger ¶
func (ofs OverlayFs) WithDirsMerger(d DirsMerger) *OverlayFs
WithDirsMerger creates a shallow copy of the filesystem and sets the DirsMerger.
Source Files ¶
overlayfs.go readops.go writeops.go
- Version
- v0.9.2 (latest)
- Published
- Feb 25, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 4 days ago –
Tools for package owners.