Documentation ¶
Overview ¶
Package scanner implements a file system scanner and hasher.
Index ¶
- Variables
- func BlockDiff(src, tgt []protocol.BlockInfo) (have, need []protocol.BlockInfo)
- func Blocks(r io.Reader, blocksize int, sizehint int64, counter Counter) ([]protocol.BlockInfo, error)
- func BlocksEqual(src, tgt []protocol.BlockInfo) bool
- func HashFile(path string, blockSize int, sizeHint int64, counter Counter) ([]protocol.BlockInfo, error)
- func PermsEqual(a, b uint32) bool
- func PopulateOffsets(blocks []protocol.BlockInfo)
- func SymlinkFlags(t symlinks.TargetType) uint32
- func SymlinkTypeEqual(disk symlinks.TargetType, f protocol.FileInfo) bool
- func Verify(r io.Reader, blocksize int, blocks []protocol.BlockInfo) error
- func VerifyBuffer(buf []byte, block protocol.BlockInfo) ([]byte, error)
- type Counter
- type CurrentFiler
- type IgnoreMatcher
- type TempNamer
- type Walker
Constants ¶
This section is empty.
Variables ¶
View Source
var SHA256OfNothing = []uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}
Functions ¶
func BlockDiff ¶
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, sizehint int64, counter Counter) ([]protocol.BlockInfo, error)
Blocks returns the blockwise hash of the reader.
func BlocksEqual ¶
BlocksEqual returns whether two slices of blocks are exactly the same hash and index pair wise.
func PermsEqual ¶
func PopulateOffsets ¶
PopulateOffsets sets the Offset field on each block
func SymlinkFlags ¶ added in v0.12.0
func SymlinkFlags(t symlinks.TargetType) uint32
func SymlinkTypeEqual ¶
func SymlinkTypeEqual(disk symlinks.TargetType, f protocol.FileInfo) bool
Types ¶
type CurrentFiler ¶
type IgnoreMatcher ¶ added in v0.12.0
type Walker ¶
type Walker struct { // Folder for which the walker has been created Folder string // Dir is the base directory for the walk Dir string // Limit walking to these paths within Dir, or no limit if Sub is empty Subs []string // BlockSize controls the size of the block used when hashing. BlockSize int // If Matcher is not nil, it is used to identify files to ignore which were specified by the user. Matcher IgnoreMatcher // If TempNamer is not nil, it is used to ignore temporary files when walking. TempNamer TempNamer // Number of hours to keep temporary files for TempLifetime time.Duration // If CurrentFiler is not nil, it is queried for the current file before rescanning. CurrentFiler CurrentFiler // If MtimeRepo is not nil, it is used to provide mtimes on systems that don't support setting arbirtary mtimes. MtimeRepo *db.VirtualMtimeRepo // If IgnorePerms is true, changes to permission bits will not be // detected. Scanned files will get zero permission bits and the // NoPermissionBits flag set. IgnorePerms bool // When AutoNormalize is set, file names that are in UTF8 but incorrect // normalization form will be corrected. AutoNormalize bool // Number of routines to use for hashing Hashers int // Our vector clock id ShortID protocol.ShortID // Optional progress tick interval which defines how often FolderScanProgress // events are emitted. Negative number means disabled. ProgressTickIntervalS int // Signals cancel from the outside - when closed, we should stop walking. Cancel chan struct{} }
Click to show internal directories.
Click to hide internal directories.