Documentation ¶
Overview ¶
Package walk does a concurrent file system traversal and returns each entry. Callers can filter the returned entries via `Options` or a caller provided `Filter` function. This library uses all the available CPUs (as returned by `runtime.NumCPU()`) to maximize concurrency of the file tree traversal.
This library can detect mount point crossings, follow symlinks and also return extended attributes (xattr(7)).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Walk ¶
Walk traverses the entries in 'names' in a concurrent fashion and returns results in a channel of *fio.Info. The caller must service the channel. Any errors encountered during the walk are returned in the error channel.
func WalkFunc ¶
WalkFunc traverses the entries in 'names' in a concurrent fashion and calls 'apply' for entries that match criteria in 'opt'. The apply function must be concurrency-safe ie it will be called concurrently from multiple go-routines. Any errors reported by 'apply' will be returned from WalkFunc().
Types ¶
type Error ¶ added in v0.4.0
Error represents the errors returned by CloneFile, CloneMetadata and UpdateMetadata
type Options ¶
type Options struct { // Number of go-routines to use; if not set (ie 0), // Walk() will use the max available cpus Concurrency int // Follow symlinks if set FollowSymlinks bool // stay within the same file-system OneFS bool // Ignore duplicate inodes. Turning this on // suppresses entries with hardlink count greater // than 1 - for those entries, only the first encountered // entry is output. IgnoreDuplicateInode bool // Types of entries to return Type Type // Excludes is a list of shell-glob patterns to exclude from // the file-system traversal. In a sense it is an "input filter" - // for example, excluded directories are not descended. // The matching is done on the basename component of the pathname. Excludes []string // Filter is an optional caller provided callback to similarly // exclude entries from further traversal. // This function must return True if this entry should // no longer be processed. ie filtered out. Filter func(fi *fio.Info) (bool, error) }
Options control the behavior of the filesystem walk.