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 ¶
- func BlocksToSize(num uint32) int64
- func DropFolder(db *leveldb.DB, folder string)
- func ListFolders(db *leveldb.DB) []string
- type BlockFinder
- type BlockMap
- type FileInfoTruncated
- func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error)
- func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error
- func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error)
- func (f FileInfoTruncated) HasPermissionBits() bool
- func (f FileInfoTruncated) IsDeleted() bool
- func (f FileInfoTruncated) IsDirectory() bool
- func (f FileInfoTruncated) IsInvalid() bool
- func (f FileInfoTruncated) IsSymlink() bool
- func (o FileInfoTruncated) MarshalXDR() ([]byte, error)
- func (o FileInfoTruncated) MustMarshalXDR() []byte
- func (f FileInfoTruncated) Size() int64
- func (f FileInfoTruncated) String() string
- func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error
- type FileIntf
- type Iterator
- type Set
- func (s *Set) Availability(file string) []protocol.DeviceID
- func (s *Set) Get(device protocol.DeviceID, file string) (protocol.FileInfo, bool)
- func (s *Set) GetGlobal(file string) (protocol.FileInfo, bool)
- func (s *Set) GetGlobalTruncated(file string) (FileInfoTruncated, bool)
- func (s *Set) LocalVersion(device protocol.DeviceID) uint64
- func (s *Set) Replace(device protocol.DeviceID, fs []protocol.FileInfo)
- func (s *Set) ReplaceWithDelete(device protocol.DeviceID, fs []protocol.FileInfo)
- func (s *Set) Update(device protocol.DeviceID, fs []protocol.FileInfo)
- func (s *Set) WithGlobal(fn Iterator)
- func (s *Set) WithGlobalTruncated(fn Iterator)
- func (s *Set) WithHave(device protocol.DeviceID, fn Iterator)
- func (s *Set) WithHaveTruncated(device protocol.DeviceID, fn Iterator)
- func (s *Set) WithNeed(device protocol.DeviceID, fn Iterator)
- func (s *Set) WithNeedTruncated(device protocol.DeviceID, fn Iterator)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlocksToSize ¶ added in v0.10.19
func DropFolder ¶ added in v0.10.0
DropFolder clears out all information related to the given folder from the database.
func ListFolders ¶ added in v0.10.0
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
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 (*BlockMap) Add ¶ added in v0.10.2
Add files to the block map, ignoring any deleted or invalid files.
type FileInfoTruncated ¶ added in v0.10.19
type FileInfoTruncated struct { Name string // max:8192 Flags uint32 Modified int64 Version uint64 LocalVersion uint64 NumBlocks uint32 }
Used for unmarshalling a FileInfo structure but skipping the block list.
func (FileInfoTruncated) AppendXDR ¶ added in v0.10.19
func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error)
func (*FileInfoTruncated) DecodeXDR ¶ added in v0.10.19
func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error
func (FileInfoTruncated) EncodeXDR ¶ added in v0.10.19
func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error)
func (FileInfoTruncated) HasPermissionBits ¶ added in v0.10.19
func (f FileInfoTruncated) HasPermissionBits() bool
func (FileInfoTruncated) IsDeleted ¶ added in v0.10.19
func (f FileInfoTruncated) IsDeleted() bool
func (FileInfoTruncated) IsDirectory ¶ added in v0.10.19
func (f FileInfoTruncated) IsDirectory() bool
func (FileInfoTruncated) IsInvalid ¶ added in v0.10.19
func (f FileInfoTruncated) IsInvalid() bool
func (FileInfoTruncated) IsSymlink ¶ added in v0.10.19
func (f FileInfoTruncated) IsSymlink() bool
func (FileInfoTruncated) MarshalXDR ¶ added in v0.10.19
func (o FileInfoTruncated) MarshalXDR() ([]byte, error)
func (FileInfoTruncated) MustMarshalXDR ¶ added in v0.10.19
func (o FileInfoTruncated) MustMarshalXDR() []byte
func (FileInfoTruncated) Size ¶ added in v0.10.19
func (f FileInfoTruncated) Size() int64
Returns a statistical guess on the size, not the exact figure
func (FileInfoTruncated) String ¶ added in v0.10.19
func (f FileInfoTruncated) String() string
func (*FileInfoTruncated) UnmarshalXDR ¶ added in v0.10.19
func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error
type FileIntf ¶ added in v0.10.19
type FileIntf interface { Size() int64 IsDeleted() bool IsInvalid() bool IsDirectory() bool IsSymlink() bool HasPermissionBits() bool }
FileIntf is the set of methods implemented by both protocol.FileInfo and protocol.FileInfoTruncated.
type Iterator ¶ added in v0.10.19
The Iterator is called with either a protocol.FileInfo or a protocol.FileInfoTruncated (depending on the method) and returns true to continue iteration, false to stop.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func (*Set) GetGlobalTruncated ¶ added in v0.10.19
func (s *Set) GetGlobalTruncated(file string) (FileInfoTruncated, bool)