walk

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tree

func Tree(ctx context.Context, repo TreeLoader, id restic.ID, jobCh chan<- TreeJob)

Tree walks the tree specified by id recursively and sends a job for each file and directory it finds. When the channel done is closed, processing stops.

Types

type TreeJob

type TreeJob struct {
	Path  string
	Error error

	Node *restic.Node
	Tree *restic.Tree
}

TreeJob is a job sent from the tree walker.

type TreeLoader

type TreeLoader interface {
	LoadTree(context.Context, restic.ID) (*restic.Tree, error)
}

TreeLoader loads tree objects.

type TreeWalker

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

TreeWalker traverses a tree in the repository depth-first and sends a job for each item (file or dir) that it encounters.

func NewTreeWalker

func NewTreeWalker(ch chan<- loadTreeJob, out chan<- TreeJob) *TreeWalker

NewTreeWalker uses ch to load trees from the repository and sends jobs to out.

func (*TreeWalker) Walk

func (tw *TreeWalker) Walk(ctx context.Context, path string, id restic.ID)

Walk starts walking the tree given by id. When the channel done is closed, processing stops.

Jump to

Keyboard shortcuts

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