scanner

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2014 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Offset int64
	Size   uint32
	Hash   []byte
}

func BlockDiff

func BlockDiff(src, tgt []Block) (have, need []Block)

BlockDiff returns lists of common and missing (to transform src into tgt) blocks. Both block lists must have been created with the same block size.

func Blocks

func Blocks(r io.Reader, blocksize int) ([]Block, error)

Blocks returns the blockwise hash of the reader.

type File

type File struct {
	Name     string
	Flags    uint32
	Modified int64
	Version  uint32
	Size     int64
	Blocks   []Block
}

func (File) Equals

func (f File) Equals(o File) bool

func (File) NewerThan

func (f File) NewerThan(o File) bool

func (File) String

func (f File) String() string

type Suppressor

type Suppressor interface {
	// Supress returns true if the update to the named file should be ignored.
	Suppress(name string, fi os.FileInfo) bool
}

type TempNamer

type TempNamer interface {
	// Temporary returns a temporary name for the filed referred to by path.
	TempName(path string) string
	// IsTemporary returns true if path refers to the name of temporary file.
	IsTemporary(path string) bool
}

type Walker

type Walker struct {
	// Dir is the base directory for the walk
	Dir string
	// If FollowSymlinks is true, symbolic links directly under Dir will be followed.
	// Symbolic links at deeper levels are never followed regardless of this flag.
	FollowSymlinks bool
	// BlockSize controls the size of the block used when hashing.
	BlockSize int
	// If IgnoreFile is not empty, it is the name used for the file that holds ignore patterns.
	IgnoreFile string
	// If TempNamer is not nil, it is used to ignore tempory files when walking.
	TempNamer TempNamer
	// If Suppressor is not nil, it is queried for supression of modified files.
	Suppressor Suppressor
	// contains filtered or unexported fields
}

func (*Walker) CleanTempFiles

func (w *Walker) CleanTempFiles()

CleanTempFiles removes all files that match the temporary filename pattern.

func (*Walker) Walk

func (w *Walker) Walk() (files []File, ignore map[string][]string)

Walk returns the list of files found in the local repository by scanning the file system. Files are blockwise hashed.

Jump to

Keyboard shortcuts

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