pipe

package
v0.0.0-...-17ee6b1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2015 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package pipe implements walking a directory in a deterministic order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Split

func Split(inChan <-chan Job, dirChan chan<- Dir, entChan chan<- Entry)

Split feeds all elements read from inChan to dirChan and entChan.

func Walk

func Walk(paths []string, selectFunc SelectFunc, done chan struct{}, jobs chan<- Job, res chan<- Result) error

Walk sends a Job for each file and directory it finds below the paths. When the channel done is closed, processing stops.

Types

type Dir

type Dir struct {
	Entries [](<-chan Result)
	// contains filtered or unexported fields
}

func (Dir) Error

func (e Dir) Error() error

func (Dir) Fullpath

func (e Dir) Fullpath() string

func (Dir) Info

func (e Dir) Info() os.FileInfo

func (Dir) Path

func (e Dir) Path() string

func (Dir) Result

func (e Dir) Result() chan<- Result

type Entry

type Entry struct {

	// points to the old node if available, interface{} is used to prevent
	// circular import
	Node interface{}
	// contains filtered or unexported fields
}

func (Entry) Error

func (e Entry) Error() error

func (Entry) Fullpath

func (e Entry) Fullpath() string

func (Entry) Info

func (e Entry) Info() os.FileInfo

func (Entry) Path

func (e Entry) Path() string

func (Entry) Result

func (e Entry) Result() chan<- Result

type Job

type Job interface {
	Path() string
	Fullpath() string
	Error() error
	Info() os.FileInfo

	Result() chan<- Result
}

type Result

type Result interface{}

type SelectFunc

type SelectFunc func(item string, fi os.FileInfo) bool

SelectFunc returns true for all items that should be included (files and dirs). If false is returned, files are ignored and dirs are not even walked.

Jump to

Keyboard shortcuts

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