Documentation
¶
Index ¶
- func ResolveSelectionPath(entries SelectionSource, name string) (string, error)
- func ResolveWildcards(root, src string, followLinks bool) ([]string, error)
- type Copier
- func (c *Copier) Close() error
- func (c *Copier) Copy(ctx context.Context, src Mount, srcPath, destPath string, opts CopyOptions) error
- func (c *Copier) CopyFile(ctx context.Context, src Mount, srcPath, destPath string, opts CopyOptions) error
- func (c *Copier) CopyFileFromLayer(ctx context.Context, layer, srcPath, destPath string, opts CopyOptions) (bool, error)
- func (c *Copier) CopySelection(ctx context.Context, root, name string, options ...SelectionOptions) error
- func (c *Copier) ForgetSourceLinks()
- func (c *Copier) MaterializeDestDir(ctx context.Context, destPath string) (string, error)
- func (c *Copier) Mkdir(ctx context.Context, destPath string, opts CopyOptions) error
- func (c *Copier) Usage() (snapshots.Usage, error)
- type CopyOptions
- type Filter
- type Mount
- type Ownership
- type PathTree
- type SelectionOptions
- type SelectionSource
- type XAttrErrorHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveSelectionPath ¶
func ResolveSelectionPath(entries SelectionSource, name string) (string, error)
ResolveSelectionPath expands a path through the same confined entry source and symlink budget used by CopySelection. Missing mountpoint parents can be supplied as synthetic directories by the source.
Types ¶
type Copier ¶
type Copier struct {
// contains filtered or unexported fields
}
func (*Copier) CopyFileFromLayer ¶
func (c *Copier) CopyFileFromLayer(ctx context.Context, layer, srcPath, destPath string, opts CopyOptions) (bool, error)
CopyFileFromLayer copies srcPath as CopyFile does, read from layer, the directory of a snapshot's topmost layer, with no mount of the snapshot. It takes only a non-empty regular file reached through real directories in that layer, which is the file the snapshot shows whatever the layers below hold. An empty one may be an overlay whiteout, which a regular file can be. For anything else it reports false, and the caller uses CopyFile: the path isn't in the layer, or is a whiteout or symlink there, or a component of it is, or the layer or file has gone. Only a file that goes from under the copy can have changed the destination by then, by replacing what destPath held; before that, nothing has.
func (*Copier) CopySelection ¶
func (c *Copier) CopySelection(ctx context.Context, root, name string, options ...SelectionOptions) error
CopySelection copies a directory to the destination root. It repairs links that would break when the parent is removed, and preserves other links, including links that already have no target. The source is a mounted view or a logical mount table; filters and raw overlay layers are not accepted.
func (*Copier) ForgetSourceLinks ¶
func (c *Copier) ForgetSourceLinks()
ForgetSourceLinks makes later copies independent of earlier ones, as with a new Copier for the same destination: a source file copied before is linked or copied from its source again, not linked to its earlier destination, which a later copy may have replaced. Usage accounting is kept.
func (*Copier) MaterializeDestDir ¶
type CopyOptions ¶
type CopyOptions struct {
Filter Filter
Chown *Ownership
Mode *os.FileMode
XAttrErrorHandler XAttrErrorHandler
DisableXAttrs bool
CopyDirContents bool
ReplaceExisting bool
DestPathHintIsDir bool
// DisableHardlinks disables all hardlink creation, including hardlink
// preservation between entries created by this copy.
DisableHardlinks bool
// DisableSourceHardlinks disables hardlinking from source paths into the
// destination while still preserving hardlinks within this copy.
DisableSourceHardlinks bool
}
type PathTree ¶
type PathTree struct {
// contains filtered or unexported fields
}
PathTree is a directory tree known only from its paths, such as a Git tree whose files aren't on disk. It answers what a copy of the tree would select without reading any file.
func NewPathTree ¶
NewPathTree builds a tree from the slash-separated paths of everything in it that isn't a directory. Their parents are its directories.
func (*PathTree) FileCount ¶
FileCount returns how many files are below the directory rel, at any depth.
func (*PathTree) IsDir ¶
IsDir reports whether rel, a slash-separated path from the tree's root, is one of its directories.
func (*PathTree) SelectedFiles ¶
SelectedFiles returns what a Copy of the directory root with this filter selects other than directories, as paths from the tree's root. It visits the tree as the copy does, with the copy's own matcher, so the two can't disagree on a pattern. A gitignore filter reads files, so it can't be answered here.
type SelectionOptions ¶
type SelectionOptions struct {
Source SelectionSource
}
SelectionOptions controls access to a directory selection's source.
type SelectionSource ¶
type SelectionSource interface {
Open(name string, parent *os.Root) (*os.File, error)
Children(name string, names []string) ([]string, error)
}
SelectionSource supplies pinned entries from a logical filesystem. Open must confine access and return an O_PATH descriptor without following the final link. A held parent permits a one-component child open. Children adds mountpoints to names read from the pinned directory.