Documentation ¶
Overview ¶
Package db 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
- Variables
- func DropDeltaIndexIDs(db *Lowlevel)
- func DropFolder(ll *Lowlevel, folder string)
- func UpdateSchema(ll *Lowlevel) error
- type BlockFinder
- type BlockMap
- type Counts
- func (c Counts) Add(other Counts) Counts
- func (*Counts) Descriptor() ([]byte, []int)
- func (m *Counts) Marshal() (dAtA []byte, err error)
- func (m *Counts) MarshalTo(dAtA []byte) (int, error)
- func (*Counts) ProtoMessage()
- func (m *Counts) ProtoSize() (n int)
- func (m *Counts) Reset()
- func (m *Counts) String() string
- func (c Counts) TotalItems() int32
- func (m *Counts) Unmarshal(dAtA []byte) error
- func (m *Counts) XXX_DiscardUnknown()
- func (m *Counts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Counts) XXX_Merge(src proto.Message)
- func (m *Counts) XXX_Size() int
- func (m *Counts) XXX_Unmarshal(b []byte) error
- type CountsSet
- func (*CountsSet) Descriptor() ([]byte, []int)
- func (m *CountsSet) Marshal() (dAtA []byte, err error)
- func (m *CountsSet) MarshalTo(dAtA []byte) (int, error)
- func (*CountsSet) ProtoMessage()
- func (m *CountsSet) ProtoSize() (n int)
- func (m *CountsSet) Reset()
- func (m *CountsSet) String() string
- func (m *CountsSet) Unmarshal(dAtA []byte) error
- func (m *CountsSet) XXX_DiscardUnknown()
- func (m *CountsSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *CountsSet) XXX_Merge(src proto.Message)
- func (m *CountsSet) XXX_Size() int
- func (m *CountsSet) XXX_Unmarshal(b []byte) error
- type FileInfoTruncated
- func (f FileInfoTruncated) BlockSize() int
- func (f FileInfoTruncated) ConvertToIgnoredFileInfo(by protocol.ShortID) protocol.FileInfo
- func (*FileInfoTruncated) Descriptor() ([]byte, []int)
- func (f FileInfoTruncated) FileLocalFlags() uint32
- func (f FileInfoTruncated) FileName() string
- func (f FileInfoTruncated) FileSize() int64
- func (f FileInfoTruncated) FileVersion() protocol.Vector
- func (f FileInfoTruncated) HasPermissionBits() bool
- func (f FileInfoTruncated) IsDeleted() bool
- func (f FileInfoTruncated) IsDirectory() bool
- func (f FileInfoTruncated) IsIgnored() bool
- func (f FileInfoTruncated) IsInvalid() bool
- func (f FileInfoTruncated) IsReceiveOnlyChanged() bool
- func (f FileInfoTruncated) IsSymlink() bool
- func (f FileInfoTruncated) IsUnsupported() bool
- func (m *FileInfoTruncated) Marshal() (dAtA []byte, err error)
- func (m *FileInfoTruncated) MarshalTo(dAtA []byte) (int, error)
- func (f FileInfoTruncated) ModTime() time.Time
- func (f FileInfoTruncated) MustRescan() bool
- func (*FileInfoTruncated) ProtoMessage()
- func (m *FileInfoTruncated) ProtoSize() (n int)
- func (m *FileInfoTruncated) Reset()
- func (f FileInfoTruncated) SequenceNo() int64
- func (f FileInfoTruncated) ShouldConflict() bool
- func (f FileInfoTruncated) String() string
- func (m *FileInfoTruncated) Unmarshal(dAtA []byte) error
- func (m *FileInfoTruncated) XXX_DiscardUnknown()
- func (m *FileInfoTruncated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *FileInfoTruncated) XXX_Merge(src proto.Message)
- func (m *FileInfoTruncated) XXX_Size() int
- func (m *FileInfoTruncated) XXX_Unmarshal(b []byte) error
- type FileIntf
- type FileSet
- func (s *FileSet) Availability(file string) []protocol.DeviceID
- func (s *FileSet) Drop(device protocol.DeviceID)
- func (s *FileSet) Get(device protocol.DeviceID, file string) (protocol.FileInfo, bool)
- func (s *FileSet) GetGlobal(file string) (protocol.FileInfo, bool)
- func (s *FileSet) GetGlobalTruncated(file string) (FileInfoTruncated, bool)
- func (s *FileSet) GlobalSize() Counts
- func (s *FileSet) IndexID(device protocol.DeviceID) protocol.IndexID
- func (s *FileSet) ListDevices() []protocol.DeviceID
- func (s *FileSet) LocalSize() Counts
- func (s *FileSet) MtimeFS() *fs.MtimeFS
- func (s *FileSet) ReceiveOnlyChangedSize() Counts
- func (s *FileSet) Sequence(device protocol.DeviceID) int64
- func (s *FileSet) SetIndexID(device protocol.DeviceID, id protocol.IndexID)
- func (s *FileSet) Update(device protocol.DeviceID, fs []protocol.FileInfo)
- func (s *FileSet) WithGlobal(fn Iterator)
- func (s *FileSet) WithGlobalTruncated(fn Iterator)
- func (s *FileSet) WithHave(device protocol.DeviceID, fn Iterator)
- func (s *FileSet) WithHaveSequence(startSeq int64, fn Iterator)
- func (s *FileSet) WithHaveTruncated(device protocol.DeviceID, fn Iterator)
- func (s *FileSet) WithNeed(device protocol.DeviceID, fn Iterator)
- func (s *FileSet) WithNeedTruncated(device protocol.DeviceID, fn Iterator)
- func (s *FileSet) WithPrefixedGlobalTruncated(prefix string, fn Iterator)
- func (s *FileSet) WithPrefixedHaveTruncated(device protocol.DeviceID, prefix string, fn Iterator)
- type FileVersion
- func (*FileVersion) Descriptor() ([]byte, []int)
- func (m *FileVersion) Marshal() (dAtA []byte, err error)
- func (m *FileVersion) MarshalTo(dAtA []byte) (int, error)
- func (*FileVersion) ProtoMessage()
- func (m *FileVersion) ProtoSize() (n int)
- func (m *FileVersion) Reset()
- func (m *FileVersion) String() string
- func (m *FileVersion) Unmarshal(dAtA []byte) error
- func (m *FileVersion) XXX_DiscardUnknown()
- func (m *FileVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *FileVersion) XXX_Merge(src proto.Message)
- func (m *FileVersion) XXX_Size() int
- func (m *FileVersion) XXX_Unmarshal(b []byte) error
- type Iterator
- type Lowlevel
- type NamespacedKV
- func (n NamespacedKV) Bool(key string) (bool, bool)
- func (n NamespacedKV) Bytes(key string) ([]byte, bool)
- func (n NamespacedKV) Delete(key string)
- func (n *NamespacedKV) Int64(key string) (int64, bool)
- func (n *NamespacedKV) PutBool(key string, val bool)
- func (n *NamespacedKV) PutBytes(key string, val []byte)
- func (n *NamespacedKV) PutInt64(key string, val int64)
- func (n *NamespacedKV) PutString(key, val string)
- func (n *NamespacedKV) PutTime(key string, val time.Time)
- func (n *NamespacedKV) Reset()
- func (n NamespacedKV) String(key string) (string, bool)
- func (n NamespacedKV) Time(key string) (time.Time, bool)
- type VersionList
- func (*VersionList) Descriptor() ([]byte, []int)
- func (vl VersionList) Get(device []byte) (FileVersion, bool)
- func (m *VersionList) Marshal() (dAtA []byte, err error)
- func (m *VersionList) MarshalTo(dAtA []byte) (int, error)
- func (*VersionList) ProtoMessage()
- func (m *VersionList) ProtoSize() (n int)
- func (m *VersionList) Reset()
- func (vl VersionList) String() string
- func (m *VersionList) Unmarshal(dAtA []byte) error
- func (m *VersionList) XXX_DiscardUnknown()
- func (m *VersionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *VersionList) XXX_Merge(src proto.Message)
- func (m *VersionList) XXX_Size() int
- func (m *VersionList) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // KeyTypeDevice <int32 folder ID> <int32 device ID> <file name> = FileInfo KeyTypeDevice = 0 // KeyTypeGlobal <int32 folder ID> <file name> = VersionList KeyTypeGlobal = 1 // KeyTypeBlock <int32 folder ID> <32 bytes hash> <§file name> = int32 (block index) KeyTypeBlock = 2 // KeyTypeDeviceStatistic <device ID as string> <some string> = some value KeyTypeDeviceStatistic = 3 // KeyTypeFolderStatistic <folder ID as string> <some string> = some value KeyTypeFolderStatistic = 4 // KeyTypeVirtualMtime <int32 folder ID> <file name> = dbMtime KeyTypeVirtualMtime = 5 // KeyTypeFolderIdx <int32 id> = string value KeyTypeFolderIdx = 6 // KeyTypeDeviceIdx <int32 id> = string value KeyTypeDeviceIdx = 7 // KeyTypeIndexID <int32 device ID> <int32 folder ID> = protocol.IndexID KeyTypeIndexID = 8 // KeyTypeFolderMeta <int32 folder ID> = CountsSet KeyTypeFolderMeta = 9 // KeyTypeMiscData <some string> = some value KeyTypeMiscData = 10 // KeyTypeSequence <int32 folder ID> <int64 sequence number> = KeyTypeDevice key KeyTypeSequence = 11 // KeyTypeNeed <int32 folder ID> <file name> = <nothing> KeyTypeNeed = 12 )
Variables ¶
var ( ErrInvalidLengthStructs = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowStructs = fmt.Errorf("proto: integer overflow") )
Functions ¶
func DropDeltaIndexIDs ¶ added in v0.14.52
func DropDeltaIndexIDs(db *Lowlevel)
DropDeltaIndexIDs removes all delta index IDs from the database. This will cause a full index transmission on the next connection.
func DropFolder ¶
DropFolder clears out all information related to the given folder from the database.
func UpdateSchema ¶ added in v0.14.52
Types ¶
type BlockFinder ¶
type BlockFinder struct {
// contains filtered or unexported fields
}
func NewBlockFinder ¶
func NewBlockFinder(db *Lowlevel) *BlockFinder
func (*BlockFinder) Iterate ¶
func (f *BlockFinder) Iterate(folders []string, hash []byte, iterFn func(string, string, int32) bool) bool
Iterate takes 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.
func (*BlockFinder) String ¶
func (f *BlockFinder) String() string
type BlockMap ¶
type BlockMap struct {
// contains filtered or unexported fields
}
func NewBlockMap ¶
type Counts ¶ added in v0.14.10
type Counts struct { Files int32 `protobuf:"varint,1,opt,name=files,proto3" json:"files,omitempty"` Directories int32 `protobuf:"varint,2,opt,name=directories,proto3" json:"directories,omitempty"` Symlinks int32 `protobuf:"varint,3,opt,name=symlinks,proto3" json:"symlinks,omitempty"` Deleted int32 `protobuf:"varint,4,opt,name=deleted,proto3" json:"deleted,omitempty"` Bytes int64 `protobuf:"varint,5,opt,name=bytes,proto3" json:"bytes,omitempty"` Sequence int64 `protobuf:"varint,6,opt,name=sequence,proto3" json:"sequence,omitempty"` DeviceID []byte `protobuf:"bytes,17,opt,name=deviceID,proto3" json:"deviceID,omitempty"` LocalFlags uint32 `protobuf:"varint,18,opt,name=localFlags,proto3" json:"localFlags,omitempty"` }
For each folder and device we keep one of these to track the current counts and sequence. We also keep one for the global state of the folder.
func (*Counts) Descriptor ¶ added in v0.14.43
func (*Counts) ProtoMessage ¶ added in v0.14.43
func (*Counts) ProtoMessage()
func (Counts) TotalItems ¶ added in v1.0.0
func (*Counts) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *Counts) XXX_DiscardUnknown()
func (*Counts) XXX_Marshal ¶ added in v1.0.1
func (*Counts) XXX_Unmarshal ¶ added in v1.0.1
type CountsSet ¶ added in v0.14.43
type CountsSet struct { Counts []Counts `protobuf:"bytes,1,rep,name=counts,proto3" json:"counts"` Created int64 `protobuf:"varint,2,opt,name=created,proto3" json:"created,omitempty"` }
func (*CountsSet) Descriptor ¶ added in v0.14.43
func (*CountsSet) ProtoMessage ¶ added in v0.14.43
func (*CountsSet) ProtoMessage()
func (*CountsSet) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *CountsSet) XXX_DiscardUnknown()
func (*CountsSet) XXX_Marshal ¶ added in v1.0.1
func (*CountsSet) XXX_Unmarshal ¶ added in v1.0.1
type FileInfoTruncated ¶
type FileInfoTruncated struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Type protocol.FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"` Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` Permissions uint32 `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"` ModifiedS int64 `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"` ModifiedNs int32 `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"` ModifiedBy github_com_syncthing_syncthing_lib_protocol.ShortID `` /* 146-byte string literal not displayed */ Deleted bool `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"` RawInvalid bool `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid,omitempty"` NoPermissions bool `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"no_permissions,omitempty"` Version protocol.Vector `protobuf:"bytes,9,opt,name=version,proto3" json:"version"` Sequence int64 `protobuf:"varint,10,opt,name=sequence,proto3" json:"sequence,omitempty"` RawBlockSize int32 `protobuf:"varint,13,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` // repeated BlockInfo Blocks = 16 SymlinkTarget string `protobuf:"bytes,17,opt,name=symlink_target,json=symlinkTarget,proto3" json:"symlink_target,omitempty"` // see bep.proto LocalFlags uint32 `protobuf:"varint,1000,opt,name=local_flags,json=localFlags,proto3" json:"local_flags,omitempty"` }
Must be the same as FileInfo but without the blocks field
func (FileInfoTruncated) BlockSize ¶ added in v0.14.48
func (f FileInfoTruncated) BlockSize() int
func (FileInfoTruncated) ConvertToIgnoredFileInfo ¶ added in v0.14.49
func (f FileInfoTruncated) ConvertToIgnoredFileInfo(by protocol.ShortID) protocol.FileInfo
func (*FileInfoTruncated) Descriptor ¶ added in v0.14.0
func (*FileInfoTruncated) Descriptor() ([]byte, []int)
func (FileInfoTruncated) FileLocalFlags ¶ added in v0.14.50
func (f FileInfoTruncated) FileLocalFlags() uint32
func (FileInfoTruncated) FileName ¶ added in v0.14.0
func (f FileInfoTruncated) FileName() string
func (FileInfoTruncated) FileSize ¶ added in v0.14.0
func (f FileInfoTruncated) FileSize() int64
func (FileInfoTruncated) FileVersion ¶ added in v0.14.49
func (f FileInfoTruncated) FileVersion() protocol.Vector
func (FileInfoTruncated) HasPermissionBits ¶ added in v0.14.0
func (f FileInfoTruncated) HasPermissionBits() bool
func (FileInfoTruncated) IsDeleted ¶ added in v0.14.0
func (f FileInfoTruncated) IsDeleted() bool
func (FileInfoTruncated) IsDirectory ¶ added in v0.14.0
func (f FileInfoTruncated) IsDirectory() bool
func (FileInfoTruncated) IsIgnored ¶ added in v0.14.49
func (f FileInfoTruncated) IsIgnored() bool
func (FileInfoTruncated) IsInvalid ¶ added in v0.14.0
func (f FileInfoTruncated) IsInvalid() bool
func (FileInfoTruncated) IsReceiveOnlyChanged ¶ added in v0.14.50
func (f FileInfoTruncated) IsReceiveOnlyChanged() bool
func (FileInfoTruncated) IsSymlink ¶ added in v0.14.0
func (f FileInfoTruncated) IsSymlink() bool
func (FileInfoTruncated) IsUnsupported ¶ added in v0.14.50
func (f FileInfoTruncated) IsUnsupported() bool
func (*FileInfoTruncated) Marshal ¶ added in v0.14.0
func (m *FileInfoTruncated) Marshal() (dAtA []byte, err error)
func (*FileInfoTruncated) MarshalTo ¶ added in v0.14.0
func (m *FileInfoTruncated) MarshalTo(dAtA []byte) (int, error)
func (FileInfoTruncated) ModTime ¶ added in v0.14.4
func (f FileInfoTruncated) ModTime() time.Time
func (FileInfoTruncated) MustRescan ¶ added in v0.14.49
func (f FileInfoTruncated) MustRescan() bool
func (*FileInfoTruncated) ProtoMessage ¶ added in v0.14.0
func (*FileInfoTruncated) ProtoMessage()
func (*FileInfoTruncated) ProtoSize ¶ added in v0.14.0
func (m *FileInfoTruncated) ProtoSize() (n int)
func (*FileInfoTruncated) Reset ¶ added in v0.14.0
func (m *FileInfoTruncated) Reset()
func (FileInfoTruncated) SequenceNo ¶ added in v0.14.43
func (f FileInfoTruncated) SequenceNo() int64
func (FileInfoTruncated) ShouldConflict ¶ added in v0.14.51
func (f FileInfoTruncated) ShouldConflict() bool
func (FileInfoTruncated) String ¶ added in v0.14.0
func (f FileInfoTruncated) String() string
func (*FileInfoTruncated) Unmarshal ¶ added in v0.14.0
func (m *FileInfoTruncated) Unmarshal(dAtA []byte) error
func (*FileInfoTruncated) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *FileInfoTruncated) XXX_DiscardUnknown()
func (*FileInfoTruncated) XXX_Marshal ¶ added in v1.0.1
func (m *FileInfoTruncated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FileInfoTruncated) XXX_Merge ¶ added in v1.0.1
func (dst *FileInfoTruncated) XXX_Merge(src proto.Message)
func (*FileInfoTruncated) XXX_Size ¶ added in v1.0.1
func (m *FileInfoTruncated) XXX_Size() int
func (*FileInfoTruncated) XXX_Unmarshal ¶ added in v1.0.1
func (m *FileInfoTruncated) XXX_Unmarshal(b []byte) error
type FileIntf ¶
type FileIntf interface { FileSize() int64 FileName() string FileLocalFlags() uint32 IsDeleted() bool IsInvalid() bool IsIgnored() bool IsUnsupported() bool MustRescan() bool IsReceiveOnlyChanged() bool IsDirectory() bool IsSymlink() bool ShouldConflict() bool HasPermissionBits() bool SequenceNo() int64 BlockSize() int FileVersion() protocol.Vector }
FileIntf is the set of methods implemented by both protocol.FileInfo and FileInfoTruncated.
type FileSet ¶
type FileSet struct {
// contains filtered or unexported fields
}
func NewFileSet ¶
func NewFileSet(folder string, fs fs.Filesystem, ll *Lowlevel) *FileSet
func (*FileSet) GetGlobalTruncated ¶
func (s *FileSet) GetGlobalTruncated(file string) (FileInfoTruncated, bool)
func (*FileSet) GlobalSize ¶ added in v0.12.0
func (*FileSet) ListDevices ¶ added in v0.14.4
func (*FileSet) ReceiveOnlyChangedSize ¶ added in v0.14.50
func (*FileSet) SetIndexID ¶ added in v0.14.1
func (*FileSet) WithGlobal ¶
func (*FileSet) WithGlobalTruncated ¶
func (*FileSet) WithHaveSequence ¶ added in v0.14.48
func (*FileSet) WithHaveTruncated ¶
func (*FileSet) WithNeedTruncated ¶
func (*FileSet) WithPrefixedGlobalTruncated ¶
Except for an item with a path equal to prefix, only children of prefix are iterated. E.g. for prefix "dir", "dir/file" is iterated, but "dir.file" is not.
func (*FileSet) WithPrefixedHaveTruncated ¶ added in v0.12.21
Except for an item with a path equal to prefix, only children of prefix are iterated. E.g. for prefix "dir", "dir/file" is iterated, but "dir.file" is not.
type FileVersion ¶ added in v0.14.0
type FileVersion struct { Version protocol.Vector `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` Device []byte `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` Invalid bool `protobuf:"varint,3,opt,name=invalid,proto3" json:"invalid,omitempty"` }
func (*FileVersion) Descriptor ¶ added in v0.14.0
func (*FileVersion) Descriptor() ([]byte, []int)
func (*FileVersion) Marshal ¶ added in v0.14.0
func (m *FileVersion) Marshal() (dAtA []byte, err error)
func (*FileVersion) MarshalTo ¶ added in v0.14.0
func (m *FileVersion) MarshalTo(dAtA []byte) (int, error)
func (*FileVersion) ProtoMessage ¶ added in v0.14.0
func (*FileVersion) ProtoMessage()
func (*FileVersion) ProtoSize ¶ added in v0.14.0
func (m *FileVersion) ProtoSize() (n int)
func (*FileVersion) Reset ¶ added in v0.14.0
func (m *FileVersion) Reset()
func (*FileVersion) String ¶ added in v0.14.0
func (m *FileVersion) String() string
func (*FileVersion) Unmarshal ¶ added in v0.14.0
func (m *FileVersion) Unmarshal(dAtA []byte) error
func (*FileVersion) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *FileVersion) XXX_DiscardUnknown()
func (*FileVersion) XXX_Marshal ¶ added in v1.0.1
func (m *FileVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FileVersion) XXX_Merge ¶ added in v1.0.1
func (dst *FileVersion) XXX_Merge(src proto.Message)
func (*FileVersion) XXX_Size ¶ added in v1.0.1
func (m *FileVersion) XXX_Size() int
func (*FileVersion) XXX_Unmarshal ¶ added in v1.0.1
func (m *FileVersion) XXX_Unmarshal(b []byte) error
type Iterator ¶
The Iterator is called with either a protocol.FileInfo or a FileInfoTruncated (depending on the method) and returns true to continue iteration, false to stop.
type Lowlevel ¶ added in v0.14.52
Lowlevel is the lowest level database interface. It has a very simple purpose: hold the actual *leveldb.DB database, and the in-memory state that belong to that database. In the same way that a single on disk database can only be opened once, there should be only one Lowlevel for any given *leveldb.DB.
func NewLowlevel ¶ added in v0.14.52
NewLowlevel wraps the given *leveldb.DB into a *lowlevel
func Open ¶ added in v0.12.0
Open attempts to open the database at the given location, and runs recovery on it if opening fails. Worst case, if recovery is not possible, the database is erased and created from scratch.
func OpenMemory ¶ added in v0.12.0
func OpenMemory() *Lowlevel
OpenMemory returns a new Lowlevel referencing an in-memory database.
func OpenRO ¶ added in v0.14.53
OpenRO attempts to open the database at the given location, read only.
func (*Lowlevel) Committed ¶ added in v0.14.52
Committed returns the number of items committed to the database since startup
func (*Lowlevel) Delete ¶ added in v0.14.52
func (db *Lowlevel) Delete(key []byte, wo *opt.WriteOptions) error
func (*Lowlevel) ListFolders ¶ added in v0.14.52
ListFolders returns the list of folders currently in the database
type NamespacedKV ¶
type NamespacedKV struct {
// contains filtered or unexported fields
}
NamespacedKV is a simple key-value store using a specific namespace within a leveldb.
func NewDeviceStatisticsNamespace ¶ added in v0.14.52
func NewDeviceStatisticsNamespace(db *Lowlevel, device string) *NamespacedKV
NewDeviceStatisticsNamespace creates a KV namespace for device statistics for the given device.
func NewFolderStatisticsNamespace ¶ added in v0.14.52
func NewFolderStatisticsNamespace(db *Lowlevel, folder string) *NamespacedKV
NewFolderStatisticsNamespace creates a KV namespace for folder statistics for the given folder.
func NewMiscDataNamespace ¶ added in v0.14.52
func NewMiscDataNamespace(db *Lowlevel) *NamespacedKV
NewMiscDateNamespace creates a KV namespace for miscellaneous metadata.
func NewNamespacedKV ¶
func NewNamespacedKV(db *Lowlevel, prefix string) *NamespacedKV
NewNamespacedKV returns a new NamespacedKV that lives in the namespace specified by the prefix.
func (NamespacedKV) Bool ¶
func (n NamespacedKV) Bool(key string) (bool, bool)
Bool returns the stored value as a boolean and a boolean that is false if no value was stored at the key.
func (NamespacedKV) Bytes ¶
func (n NamespacedKV) Bytes(key string) ([]byte, bool)
Bytes returns the stored value as a raw byte slice and a boolean that is false if no value was stored at the key.
func (NamespacedKV) Delete ¶
func (n NamespacedKV) Delete(key string)
Delete deletes the specified key. It is allowed to delete a nonexistent key.
func (*NamespacedKV) Int64 ¶
func (n *NamespacedKV) Int64(key string) (int64, bool)
Int64 returns the stored value interpreted as an int64 and a boolean that is false if no value was stored at the key.
func (*NamespacedKV) PutBool ¶
func (n *NamespacedKV) PutBool(key string, val bool)
PutBool stores a new boolean. Any existing value (even if of another type) is overwritten.
func (*NamespacedKV) PutBytes ¶
func (n *NamespacedKV) PutBytes(key string, val []byte)
PutBytes stores a new byte slice. Any existing value (even if of another type) is overwritten.
func (*NamespacedKV) PutInt64 ¶
func (n *NamespacedKV) PutInt64(key string, val int64)
PutInt64 stores a new int64. Any existing value (even if of another type) is overwritten.
func (*NamespacedKV) PutString ¶
func (n *NamespacedKV) PutString(key, val string)
PutString stores a new string. Any existing value (even if of another type) is overwritten.
func (*NamespacedKV) PutTime ¶
func (n *NamespacedKV) PutTime(key string, val time.Time)
PutTime stores a new time.Time. Any existing value (even if of another type) is overwritten.
func (*NamespacedKV) Reset ¶
func (n *NamespacedKV) Reset()
Reset removes all entries in this namespace.
type VersionList ¶ added in v0.13.5
type VersionList struct {
Versions []FileVersion `protobuf:"bytes,1,rep,name=versions,proto3" json:"versions"`
}
func (*VersionList) Descriptor ¶ added in v0.14.0
func (*VersionList) Descriptor() ([]byte, []int)
func (VersionList) Get ¶ added in v0.14.49
func (vl VersionList) Get(device []byte) (FileVersion, bool)
func (*VersionList) Marshal ¶ added in v0.14.0
func (m *VersionList) Marshal() (dAtA []byte, err error)
func (*VersionList) MarshalTo ¶ added in v0.14.0
func (m *VersionList) MarshalTo(dAtA []byte) (int, error)
func (*VersionList) ProtoMessage ¶ added in v0.14.0
func (*VersionList) ProtoMessage()
func (*VersionList) ProtoSize ¶ added in v0.14.0
func (m *VersionList) ProtoSize() (n int)
func (*VersionList) Reset ¶ added in v0.14.0
func (m *VersionList) Reset()
func (VersionList) String ¶ added in v0.13.5
func (vl VersionList) String() string
func (*VersionList) Unmarshal ¶ added in v0.14.0
func (m *VersionList) Unmarshal(dAtA []byte) error
func (*VersionList) XXX_DiscardUnknown ¶ added in v1.0.1
func (m *VersionList) XXX_DiscardUnknown()
func (*VersionList) XXX_Marshal ¶ added in v1.0.1
func (m *VersionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*VersionList) XXX_Merge ¶ added in v1.0.1
func (dst *VersionList) XXX_Merge(src proto.Message)
func (*VersionList) XXX_Size ¶ added in v1.0.1
func (m *VersionList) XXX_Size() int
func (*VersionList) XXX_Unmarshal ¶ added in v1.0.1
func (m *VersionList) XXX_Unmarshal(b []byte) error