walker

package
v0.0.0-...-282f259 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter func(os.FileInfo) bool

Helper type for the filter function

type TreeWalker

type TreeWalker struct {
	// contains filtered or unexported fields
}

Distinct type used by the walker package to provide an interface for tree-walking routines. It is responsible for keeping track of all processed file system nodes, client-provided filtering subs and communication channels.

func NewTreeWalker

func NewTreeWalker() *TreeWalker

Constructor. Returns pointer to the TreeWalker object.

func (*TreeWalker) AddFilter

func (tw *TreeWalker) AddFilter(f Filter)

Adds client-provided filter function, that takes an os.FileInfo object as an argument and returns bool, to a chain of filters. Processed file system node (os.FileInfo) is considered valid if and only if all registered filters are passed (return true).

func (*TreeWalker) GetCounts

func (tw *TreeWalker) GetCounts() (uint, uint)

Get count of all directories and files successfully processed by the TreeWalker.

func (*TreeWalker) Traverse

func (tw *TreeWalker) Traverse(dir string) <-chan *node.Node

Main interface to the TreeWalker service. Starts depth-first traversal of the file system from the provided root directory (dir). Returns a receive-only *Node communication channel for all found valid nodes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL