files

package
v0.10.16 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2015 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package files provides a set type to track local/remote files with newness checks. We must do a certain amount of normalization in here. We will get fed paths with either native or wire-format separators and encodings depending on who calls us. We transform paths to wire-format (NFC and slashes) on the way to the database, and transform to native format (varying separator and encoding) on the way back out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropFolder added in v0.10.0

func DropFolder(db *leveldb.DB, folder string)

DropFolder clears out all information related to the given folder from the database.

func ListFolders added in v0.10.0

func ListFolders(db *leveldb.DB) []string

ListFolders returns the folder IDs seen in the database.

Types

type BlockFinder added in v0.10.2

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

func NewBlockFinder added in v0.10.2

func NewBlockFinder(db *leveldb.DB, cfg *config.Wrapper) *BlockFinder

func (*BlockFinder) Changed added in v0.10.2

func (f *BlockFinder) Changed(cfg config.Configuration) error

Implements config.Handler interface

func (*BlockFinder) Fix added in v0.10.4

func (f *BlockFinder) Fix(folder, file string, index uint32, oldHash, newHash []byte) error

A method for repairing incorrect blockmap entries, removes the old entry and replaces it with a new entry for the given block

func (*BlockFinder) Iterate added in v0.10.2

func (f *BlockFinder) Iterate(hash []byte, iterFn func(string, string, uint32) bool) bool

An iterator function which iterates over all matching blocks for the given hash. The iterator function has to return either true (if they are happy with the block) or false to continue iterating for whatever reason. The iterator finally returns the result, whether or not a satisfying block was eventually found.

type BlockMap added in v0.10.2

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

func NewBlockMap added in v0.10.2

func NewBlockMap(db *leveldb.DB, folder string) *BlockMap

func (*BlockMap) Add added in v0.10.2

func (m *BlockMap) Add(files []protocol.FileInfo) error

Add files to the block map, ignoring any deleted or invalid files.

func (*BlockMap) Discard added in v0.10.3

func (m *BlockMap) Discard(files []protocol.FileInfo) error

Discard block map state, removing the given files

func (*BlockMap) Drop added in v0.10.2

func (m *BlockMap) Drop() error

Drop block map, removing all entries related to this block map from the db.

func (*BlockMap) Update added in v0.10.2

func (m *BlockMap) Update(files []protocol.FileInfo) error

Update block map state, removing any deleted or invalid files.

type Set

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

func NewSet

func NewSet(folder string, db *leveldb.DB) *Set

func (*Set) Availability

func (s *Set) Availability(file string) []protocol.DeviceID

func (*Set) Get

func (s *Set) Get(device protocol.DeviceID, file string) protocol.FileInfo

func (*Set) GetGlobal

func (s *Set) GetGlobal(file string) protocol.FileInfo

func (*Set) LocalVersion

func (s *Set) LocalVersion(device protocol.DeviceID) uint64

func (*Set) Replace

func (s *Set) Replace(device protocol.DeviceID, fs []protocol.FileInfo)

func (*Set) ReplaceWithDelete

func (s *Set) ReplaceWithDelete(device protocol.DeviceID, fs []protocol.FileInfo)

func (*Set) Update

func (s *Set) Update(device protocol.DeviceID, fs []protocol.FileInfo)

func (*Set) WithGlobal

func (s *Set) WithGlobal(fn fileIterator)

func (*Set) WithGlobalTruncated

func (s *Set) WithGlobalTruncated(fn fileIterator)

func (*Set) WithHave

func (s *Set) WithHave(device protocol.DeviceID, fn fileIterator)

func (*Set) WithHaveTruncated

func (s *Set) WithHaveTruncated(device protocol.DeviceID, fn fileIterator)

func (*Set) WithNeed

func (s *Set) WithNeed(device protocol.DeviceID, fn fileIterator)

func (*Set) WithNeedTruncated

func (s *Set) WithNeedTruncated(device protocol.DeviceID, fn fileIterator)

Jump to

Keyboard shortcuts

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