package fs
import "github.com/containerd/continuity/fs"
Index ¶
- Constants
- func Changes(ctx context.Context, a, b string, changeFn ChangeFunc) error
- func CopyDir(dst, src string, opts ...CopyDirOpt) error
- func CopyFile(target, source string) error
- func GetLinkInfo(fi os.FileInfo) (uint64, bool)
- func RootPath(root, path string) (string, error)
- type Change
- type ChangeFunc
- type ChangeKind
- type CopyDirOpt
- func WithAllowXAttrErrors() CopyDirOpt
- func WithXAttrErrorHandler(xeh XAttrErrorHandler) CopyDirOpt
- func WithXAttrExclude(keys ...string) CopyDirOpt
- type Usage
- func DiffUsage(ctx context.Context, a, b string) (Usage, error)
- func DiskUsage(ctx context.Context, roots ...string) (Usage, error)
- type XAttrErrorHandler
Constants ¶
const ( // ChangeKindUnmodified represents an unmodified // file ChangeKindUnmodified = iota // ChangeKindAdd represents an addition of // a file ChangeKindAdd // ChangeKindModify represents a change to // an existing file ChangeKindModify // ChangeKindDelete represents a delete of // a file ChangeKindDelete )
Functions ¶
func Changes ¶
func Changes(ctx context.Context, a, b string, changeFn ChangeFunc) error
Changes computes changes between two directories calling the given change function for each computed change. The first directory is intended to the base directory and second directory the changed directory.
The change callback is called by the order of path names and should be appliable in that order.
Due to this apply ordering, the following is true - Removed directory trees only create a single change for the root directory removed. Remaining changes are implied. - A directory which is modified to become a file will not have delete entries for sub-path items, their removal is implied by the removal of the parent directory.
Opaque directories will not be treated specially and each file removed from the base directory will show up as a removal.
File content comparisons will be done on files which have timestamps which may have been truncated. If either of the files being compared has a zero value nanosecond value, each byte will be compared for differences. If 2 files have the same seconds value but different nanosecond values where one of those values is zero, the files will be considered unchanged if the content is the same. This behavior is to account for timestamp truncation during archiving.
func CopyDir ¶
func CopyDir(dst, src string, opts ...CopyDirOpt) error
CopyDir copies the directory from src to dst. Most efficient copy of files is attempted.
func CopyFile ¶
CopyFile copies the source file to the target. The most efficient means of copying is used for the platform.
func GetLinkInfo ¶
GetLinkInfo returns an identifier representing the node a hardlink is pointing to. If the file is not hard linked then 0 will be returned.
func RootPath ¶
RootPath joins a path with a root, evaluating and bounding any symlink to the root directory.
Types ¶
type Change ¶
type Change struct { Kind ChangeKind Path string }
Change represents single change between a diff and its parent.
type ChangeFunc ¶
ChangeFunc is the type of function called for each change computed during a directory changes calculation.
type ChangeKind ¶
type ChangeKind int
ChangeKind is the type of modification that a change is making.
func (ChangeKind) String ¶
func (k ChangeKind) String() string
type CopyDirOpt ¶
type CopyDirOpt func(*copyDirOpts) error
func WithAllowXAttrErrors ¶
func WithAllowXAttrErrors() CopyDirOpt
WithAllowXAttrErrors allows ignoring xattr errors.
func WithXAttrErrorHandler ¶
func WithXAttrErrorHandler(xeh XAttrErrorHandler) CopyDirOpt
WithXAttrErrorHandler allows specifying XAttrErrorHandler If nil XAttrErrorHandler is specified (default), CopyDir stops on a non-nil xattr error.
func WithXAttrExclude ¶
func WithXAttrExclude(keys ...string) CopyDirOpt
WithXAttrExclude allows for exclusion of specified xattr during CopyDir operation.
type Usage ¶
Usage of disk information
func DiffUsage ¶
DiffUsage counts the numbers of inodes and disk usage in the diff between the 2 directories. The first path is intended as the base directory and the second as the changed directory.
func DiskUsage ¶
DiskUsage counts the number of inodes and disk usage for the resources under path.
type XAttrErrorHandler ¶
XAttrErrorHandler transform a non-nil xattr error. Return nil to ignore an error. xattrKey can be empty for listxattr operation.
Source Files ¶
copy.go copy_irregular_unix.go copy_nondarwin.go diff.go diff_unix.go du.go du_unix.go hardlink.go hardlink_unix.go path.go time.go utimesnanoat.go
Directories ¶
Path | Synopsis |
---|---|
fs/fstest |
- Version
- v0.4.2
- Published
- Aug 19, 2023
- Platform
- js/wasm
- Imports
- 14 packages
- Last checked
- 13 hours ago –
Tools for package owners.