Documentation ¶
Index ¶
- func Eval(root string, directory string, _ EvalOptions) (string, error)
- func Get(root string, directory string, options GetOptions, globs []string, ...) error
- func Lgetxattrs(path string) (map[string]string, error)
- func Lsetxattrs(path string, xattrs map[string]string) error
- func Mkdir(root string, directory string, options MkdirOptions) error
- func Put(root string, directory string, options PutOptions, bulkReader io.Reader) error
- func Remove(root string, item string, options RemoveOptions) error
- type EvalOptions
- type GetOptions
- type MkdirOptions
- type PutOptions
- type RemoveOptions
- type StatForItem
- type StatOptions
- type StatsForGlob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Eval ¶ added in v1.19.7
func Eval(root string, directory string, _ EvalOptions) (string, error)
Eval evaluates the directory's path, including any intermediate symbolic links. If root is specified and the current OS supports it, and the calling process has the necessary privileges, evaluation is performed in a chrooted context. If the directory is specified as an absolute path, it should either be the root directory or a subdirectory of the root directory. Otherwise, the directory is treated as a path relative to the root directory.
func Get ¶
func Get(root string, directory string, options GetOptions, globs []string, bulkWriter io.Writer) error
Get produces an archive containing items that match the specified glob patterns and writes it to bulkWriter. If root and directory are both not specified, the current root directory is used, and relative names in the globs list are treated as being relative to the current working directory. If root is specified and the current OS supports it, and the calling process has the necessary privileges, the contents are read in a chrooted context. If the directory is specified as an absolute path, it should either be the root directory or a subdirectory of the root directory. Otherwise, the directory is treated as a path relative to the root directory. Relative names in the glob list are treated as being relative to the directory.
func Lgetxattrs ¶
Lgetxattrs returns a map of the relevant extended attributes set on the given file.
func Lsetxattrs ¶
Lsetxattrs sets the relevant members of the specified extended attributes on the given file.
func Mkdir ¶
func Mkdir(root string, directory string, options MkdirOptions) error
Mkdir ensures that the specified directory exists. Any directories which need to be created will be given the specified ownership and permissions. If root and directory are both not specified, the current root directory is used. If root is specified and the current OS supports it, and the calling process has the necessary privileges, the directory is created in a chrooted context. If the directory is specified as an absolute path, it should either be the root directory or a subdirectory of the root directory. Otherwise, the directory is treated as a path relative to the root directory.
func Put ¶
Put extracts an archive from the bulkReader at the specified directory. If root and directory are both not specified, the current root directory is used. If root is specified and the current OS supports it, and the calling process has the necessary privileges, the contents are written in a chrooted context. If the directory is specified as an absolute path, it should either be the root directory or a subdirectory of the root directory. Otherwise, the directory is treated as a path relative to the root directory.
func Remove ¶ added in v1.21.0
func Remove(root string, item string, options RemoveOptions) error
Remove removes the specified directory or item, traversing any intermediate symbolic links. If the root directory is not specified, the current root directory is used. If root is specified and the current OS supports it, and the calling process has the necessary privileges, the remove() is performed in a chrooted context. If the item to remove is specified as an absolute path, it should either be in the root directory or in a subdirectory of the root directory. Otherwise, the directory is treated as a path relative to the root directory.
Types ¶
type EvalOptions ¶ added in v1.19.7
type EvalOptions struct{}
EvalOptions controls parts of Eval()'s behavior.
type GetOptions ¶
type GetOptions struct {
UIDMap, GIDMap []idtools.IDMap // map from hostIDs to containerIDs in the output archive
Excludes []string // contents to pretend don't exist, using the OS-specific path separator
ExpandArchives bool // extract the contents of named items that are archives
ChownDirs *idtools.IDPair // set ownership on directories. no effect on archives being extracted
ChmodDirs *os.FileMode // set permissions on directories. no effect on archives being extracted
ChownFiles *idtools.IDPair // set ownership of files. no effect on archives being extracted
ChmodFiles *os.FileMode // set permissions on files. no effect on archives being extracted
StripSetuidBit bool // strip the setuid bit off of items being copied. no effect on archives being extracted
StripSetgidBit bool // strip the setgid bit off of items being copied. no effect on archives being extracted
StripStickyBit bool // strip the sticky bit off of items being copied. no effect on archives being extracted
StripXattrs bool // don't record extended attributes of items being copied. no effect on archives being extracted
KeepDirectoryNames bool // don't strip the top directory's basename from the paths of items in subdirectories
Rename map[string]string // rename items with the specified names, or under the specified names
NoDerefSymlinks bool // don't follow symlinks when globs match them
IgnoreUnreadable bool // ignore errors reading items, instead of returning an error
NoCrossDevice bool // if a subdirectory is a mountpoint with a different device number, include it but skip its contents
}
GetOptions controls parts of Get()'s behavior.
type MkdirOptions ¶
type MkdirOptions struct {
UIDMap, GIDMap []idtools.IDMap // map from containerIDs to hostIDs when creating directories
ChownNew *idtools.IDPair // set ownership of newly-created directories
ChmodNew *os.FileMode // set permissions on newly-created directories
}
MkdirOptions controls parts of Mkdir()'s behavior.
type PutOptions ¶
type PutOptions struct {
UIDMap, GIDMap []idtools.IDMap // map from containerIDs to hostIDs when writing contents to disk
DefaultDirOwner *idtools.IDPair // set ownership of implicitly-created directories, default is ChownDirs, or 0:0 if ChownDirs not set
DefaultDirMode *os.FileMode // set permissions on implicitly-created directories, default is ChmodDirs, or 0755 if ChmodDirs not set
ChownDirs *idtools.IDPair // set ownership of newly-created directories
ChmodDirs *os.FileMode // set permissions on newly-created directories
ChownFiles *idtools.IDPair // set ownership of newly-created files
ChmodFiles *os.FileMode // set permissions on newly-created files
StripSetuidBit bool // strip the setuid bit off of items being written
StripSetgidBit bool // strip the setgid bit off of items being written
StripStickyBit bool // strip the sticky bit off of items being written
StripXattrs bool // don't bother trying to set extended attributes of items being copied
IgnoreXattrErrors bool // ignore any errors encountered when attempting to set extended attributes
IgnoreDevices bool // ignore items which are character or block devices
NoOverwriteDirNonDir bool // instead of quietly overwriting directories with non-directories, return an error
NoOverwriteNonDirDir bool // instead of quietly overwriting non-directories with directories, return an error
Rename map[string]string // rename items with the specified names, or under the specified names
}
PutOptions controls parts of Put()'s behavior.
type RemoveOptions ¶ added in v1.21.0
type RemoveOptions struct {
All bool // if Directory is a directory, remove its contents as well
}
RemoveOptions controls parts of Remove()'s behavior.
type StatForItem ¶
type StatForItem struct { Error string `json:",omitempty"` Name string Size int64 // dereferenced value for symlinks Mode os.FileMode // dereferenced value for symlinks ModTime time.Time // dereferenced value for symlinks IsSymlink bool IsDir bool // dereferenced value for symlinks IsRegular bool // dereferenced value for symlinks IsArchive bool // dereferenced value for symlinks ImmediateTarget string `json:",omitempty"` // raw link content }
StatForItem encode results for a single filesystem item, as returned by Stat().
type StatOptions ¶
type StatOptions struct { CheckForArchives bool // check for and populate the IsArchive bit in returned values Excludes []string // contents to pretend don't exist, using the OS-specific path separator }
StatOptions controls parts of Stat()'s behavior.
type StatsForGlob ¶
type StatsForGlob struct { Error string `json:",omitempty"` // error if the Glob pattern was malformed Glob string // input pattern to which this result corresponds Globbed []string // a slice of zero or more names that match the glob Results map[string]*StatForItem // one for each Globbed value if there are any, or for Glob }
StatsForGlob encode results for a single glob pattern passed to Stat().
func Stat ¶
func Stat(root string, directory string, options StatOptions, globs []string) ([]*StatsForGlob, error)
Stat globs the specified pattern in the specified directory and returns its results. If root and directory are both not specified, the current root directory is used, and relative names in the globs list are treated as being relative to the current working directory. If root is specified and the current OS supports it, and the calling process has the necessary privileges, the stat() is performed in a chrooted context. If the directory is specified as an absolute path, it should either be the root directory or a subdirectory of the root directory. Otherwise, the directory is treated as a path relative to the root directory. Relative names in the glob list are treated as being relative to the directory.