Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func File ¶
File clones src to dst - including all clonable file attributes and xattr. File will use the best available CoW facilities provided by the OS and Filesystem. It will fall back to using copy via mmap(2) on systems that don't have CoW semantics.
func Metadata ¶
CloneMetadata clones all the metadata from src to dst: the metadata is atime, mtime, uid, gid, mode/perm, xattr
func Tree ¶
Tree clones the directory tree 'src' to 'dst' with options 'opt'. For example, an entry src/a will be cloned to dst/b. If dst exists, it must be a directory.
func UpdateMetadata ¶
UpdateMetadata writes new metadata of 'dst' from 'fi' The metadata that will be updated includes atime, mtime, uid/gid, mode/perm, xattr
Types ¶
type Error ¶
Error represents the errors returned by CloneFile, CloneMetadata and UpdateMetadata
type FunnyEntry ¶
type FunnyEntry struct { Name string // relative path name Src *fio.Info Dst *fio.Info }
FunnyEntry captures an error where the source and destination are not the same type (eg src is a file and dst is a directory)
type FunnyError ¶
type FunnyError struct {
Funny []FunnyEntry
}
FunnyError represents a clone error that fails to clone a directory tree because there are one or more funny entries in the Src and Dst.
func (*FunnyError) Error ¶
func (e *FunnyError) Error() string
Error returns a string representation of FunnyError
func (*FunnyError) Unwrap ¶
func (e *FunnyError) Unwrap() error
Unwrap returns the underlying wrapped error; in our case this is a "leaf" error.
type Observer ¶ added in v0.4.1
type Observer interface { Difference(d *cmp.Difference) Copy(dst, src string) Delete(nm string) MetadataUpdate(dst, src string) }
Observer is invoked when the tree cloner makes progress. The Difference method is called just before starting the I/O operation. For every entry that is processed, Tree() invokes the Copy or Delete methods. The final metadata fixup step is tracked by the MetadataUpdate method.
func NopObserver ¶ added in v0.4.1
func NopObserver() Observer
NopObserver implements Observer and throws away all input. ie it's a no-op
type Option ¶
type Option func(o *treeopt)
func WithIgnoreAttr ¶
func WithIgnoreAttr(fl cmp.IgnoreFlag) Option
WithIgnoreAttr captures the attributes of fio.Info that must be ignored for comparing equality of two filesystem entries.
func WithObserver ¶ added in v0.4.1
WithObserver uses 'ob' to report activities as the tree cloner makes progress
func WithWalkOptions ¶
WithWalkOptions uses 'wo' as the option for walk.Walk(); it describes a caller desired traversal of the file system with the requisite input and output filters