Documentation ¶
Overview ¶
Package dtdiff is a generated protocol buffer package.
It is generated from these files:
messages.proto
It has these top-level messages:
ProtoReplica ProtoEntry
Index ¶
- Constants
- Variables
- func ExtraOptions(extraOptions *tree.ScanOptions) func(*ReplicaSet)
- func IterateEntries(list []*Entry) chan *Entry
- func LeastName(names ...string) string
- func Progress(progress chan<- ScanProgress) func(*ReplicaSet)
- type Entry
- func (e *Entry) Add(info tree.FileInfo, source *Entry) (*Entry, error)
- func (e *Entry) After(e2 *Entry) bool
- func (e *Entry) Before(e2 *Entry) bool
- func (e *Entry) Conflict(e2 *Entry) bool
- func (e *Entry) Count() (int, int64)
- func (e *Entry) Equal(e2 *Entry) bool
- func (e *Entry) EqualContents(e2 *Entry) bool
- func (e *Entry) EqualMode(e2 *Entry) bool
- func (e *Entry) Filesystem() tree.Filesystem
- func (e *Entry) Get(name string) *Entry
- func (e *Entry) HasMode() tree.Mode
- func (e *Entry) HasRevision(other *Entry) bool
- func (e *Entry) Hash() tree.Hash
- func (e *Entry) Includes(e2 *Entry) bool
- func (e *Entry) Inode() uint64
- func (e *Entry) List() []*Entry
- func (e *Entry) ModTime() time.Time
- func (e *Entry) Mode() tree.Mode
- func (e *Entry) Name() string
- func (e *Entry) RelativePath() []string
- func (e *Entry) Remove()
- func (e *Entry) Size() int64
- func (e *Entry) String() string
- func (e *Entry) Type() tree.Type
- func (e *Entry) Update(info tree.FileInfo, fs interface{}, hash tree.Hash, source *Entry)
- func (e *Entry) UpdateHash(hash tree.Hash, source *Entry)
- type ErrSameIdentity
- type ParseError
- type ProtoEntry
- func (*ProtoEntry) Descriptor() ([]byte, []int)
- func (m *ProtoEntry) GetFs() uint64
- func (m *ProtoEntry) GetGeneration() uint64
- func (m *ProtoEntry) GetHasMode() uint32
- func (m *ProtoEntry) GetHashData() []byte
- func (m *ProtoEntry) GetHashType() uint32
- func (m *ProtoEntry) GetIdentity() uint32
- func (m *ProtoEntry) GetInode() uint64
- func (m *ProtoEntry) GetModTime() int64
- func (m *ProtoEntry) GetMode() uint32
- func (m *ProtoEntry) GetName() string
- func (m *ProtoEntry) GetRemoved() int64
- func (m *ProtoEntry) GetSize() uint64
- func (m *ProtoEntry) GetType() uint32
- func (*ProtoEntry) ProtoMessage()
- func (m *ProtoEntry) Reset()
- func (m *ProtoEntry) String() string
- type ProtoReplica
- func (*ProtoReplica) Descriptor() ([]byte, []int)
- func (m *ProtoReplica) GetCreatedBy() string
- func (m *ProtoReplica) GetGeneration() uint64
- func (m *ProtoReplica) GetHash() string
- func (m *ProtoReplica) GetIdentity() string
- func (m *ProtoReplica) GetKnowledgeKeys() []string
- func (m *ProtoReplica) GetKnowledgeValues() []uint64
- func (m *ProtoReplica) GetOptionKeys() []string
- func (m *ProtoReplica) GetOptionValues() []string
- func (m *ProtoReplica) GetVersion() uint32
- func (*ProtoReplica) ProtoMessage()
- func (m *ProtoReplica) Reset()
- func (m *ProtoReplica) String() string
- type Replica
- type ReplicaSet
- type ScanProgress
Constants ¶
const ( MAGIC_TEXT = "dtsync-status-file" MAGIC_PROTO = "dtsync-status-file-proto" )
These string constants are used in the header to determine serialization format and can be used to identify the filetype (e.g. by the file(1) command).
const ( FORMAT_NONE = iota FORMAT_TEXT FORMAT_PROTO )
Format constants to use for the Replica.Serialize function.
const HASH_ID = "blake2b-256"
HASH_ID is the identifier for the hash function in use. The last part is the number of bits for this version (256 bits or 32 bytes).
const PERMS_DEFAULT = 0777
PERMS_DEFAULT has the default permission bits that are compared. It is possible to compare less bits with the 'perms' option.
const STATUS_FILE = ".dtsync"
File where current status of the tree is stored.
const STATUS_RETAIN = time.Hour * 24 * 30
STATUS_RETAIN is the duration how long to retain status entries that have disappeared, in case they reappear (e.g. a disk is mounted again).
Variables ¶
Functions ¶
func ExtraOptions ¶
func ExtraOptions(extraOptions *tree.ScanOptions) func(*ReplicaSet)
func IterateEntries ¶
IterateEntries returns a channel, reads from the channel will return each entry in the slice.
func LeastName ¶
LeastName returns the alphabetically first name in the list that is not the empty string.
func Progress ¶
func Progress(progress chan<- ScanProgress) func(*ReplicaSet)
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
An Entry is one object (row) in a Replica. It belongs to one Replica.
func (*Entry) Count ¶
Count returns the number of entries (at least 1) and the number of bytes in the file or directory tree (only regular bytes, no directory entries). Can be used for progress indication.
func (*Entry) Equal ¶
Equal returns true if both entries are of the same revision (replica and generation). Not recursive.
func (*Entry) EqualContents ¶
EqualContents returns true if the contents (fingerprint/hash) of these entries is the same.
func (*Entry) Filesystem ¶
func (e *Entry) Filesystem() tree.Filesystem
Filesystem returns the filesystem ID for this replica (filesystem IDs are unique per replica).
func (*Entry) HasRevision ¶
HasRevision returns true if this file (actually, this replica) includes the revision the other entry is at.
func (*Entry) Includes ¶
Includes returns true if this entry includes all revisions from the other entry (recursively: children are also compared).
FIXME: It does not always work when one file is removed. It does work however to check for equality, though.
func (*Entry) Inode ¶
Id returns an unique identification for this file: a combination of the inode number and the generation number (for NFS). Together with the filesystem ID, this is a unique identification for this replica.
Returns a nil value if there is no unique identification available.
func (*Entry) RelativePath ¶
RelativePath returns the path relative to the root
func (*Entry) Remove ¶
func (e *Entry) Remove()
Remove this entry. It will mark this entry as removed, and remove it once it's getting old.
type ErrSameIdentity ¶
type ErrSameIdentity struct {
Identity string
}
func (*ErrSameIdentity) Error ¶
func (e *ErrSameIdentity) Error() string
type ParseError ¶
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ProtoEntry ¶
type ProtoEntry struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Type *uint32 `protobuf:"varint,2,opt,name=type" json:"type,omitempty"` ModTime *int64 `protobuf:"zigzag64,3,opt,name=modTime" json:"modTime,omitempty"` Size *uint64 `protobuf:"varint,4,opt,name=size" json:"size,omitempty"` Identity *uint32 `protobuf:"varint,5,opt,name=identity" json:"identity,omitempty"` Generation *uint64 `protobuf:"varint,6,opt,name=generation" json:"generation,omitempty"` Mode *uint32 `protobuf:"varint,7,opt,name=mode" json:"mode,omitempty"` HasMode *uint32 `protobuf:"varint,8,opt,name=hasMode" json:"hasMode,omitempty"` HashType *uint32 `protobuf:"varint,9,opt,name=hashType" json:"hashType,omitempty"` HashData []byte `protobuf:"bytes,10,opt,name=hashData" json:"hashData,omitempty"` Removed *int64 `protobuf:"zigzag64,11,opt,name=removed" json:"removed,omitempty"` Inode *uint64 `protobuf:"varint,12,opt,name=inode" json:"inode,omitempty"` Fs *uint64 `protobuf:"varint,16,opt,name=fs" json:"fs,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*ProtoEntry) Descriptor ¶
func (*ProtoEntry) Descriptor() ([]byte, []int)
func (*ProtoEntry) GetFs ¶
func (m *ProtoEntry) GetFs() uint64
func (*ProtoEntry) GetGeneration ¶
func (m *ProtoEntry) GetGeneration() uint64
func (*ProtoEntry) GetHasMode ¶
func (m *ProtoEntry) GetHasMode() uint32
func (*ProtoEntry) GetHashData ¶
func (m *ProtoEntry) GetHashData() []byte
func (*ProtoEntry) GetHashType ¶
func (m *ProtoEntry) GetHashType() uint32
func (*ProtoEntry) GetIdentity ¶
func (m *ProtoEntry) GetIdentity() uint32
func (*ProtoEntry) GetInode ¶
func (m *ProtoEntry) GetInode() uint64
func (*ProtoEntry) GetModTime ¶
func (m *ProtoEntry) GetModTime() int64
func (*ProtoEntry) GetMode ¶
func (m *ProtoEntry) GetMode() uint32
func (*ProtoEntry) GetName ¶
func (m *ProtoEntry) GetName() string
func (*ProtoEntry) GetRemoved ¶
func (m *ProtoEntry) GetRemoved() int64
func (*ProtoEntry) GetSize ¶
func (m *ProtoEntry) GetSize() uint64
func (*ProtoEntry) GetType ¶
func (m *ProtoEntry) GetType() uint32
func (*ProtoEntry) ProtoMessage ¶
func (*ProtoEntry) ProtoMessage()
func (*ProtoEntry) Reset ¶
func (m *ProtoEntry) Reset()
func (*ProtoEntry) String ¶
func (m *ProtoEntry) String() string
type ProtoReplica ¶
type ProtoReplica struct { Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` CreatedBy *string `protobuf:"bytes,2,opt,name=createdBy" json:"createdBy,omitempty"` Identity *string `protobuf:"bytes,3,opt,name=identity" json:"identity,omitempty"` Generation *uint64 `protobuf:"varint,4,opt,name=generation" json:"generation,omitempty"` KnowledgeKeys []string `protobuf:"bytes,5,rep,name=knowledgeKeys" json:"knowledgeKeys,omitempty"` KnowledgeValues []uint64 `protobuf:"varint,6,rep,name=knowledgeValues" json:"knowledgeValues,omitempty"` OptionKeys []string `protobuf:"bytes,7,rep,name=optionKeys" json:"optionKeys,omitempty"` OptionValues []string `protobuf:"bytes,8,rep,name=optionValues" json:"optionValues,omitempty"` Hash *string `protobuf:"bytes,9,opt,name=hash" json:"hash,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*ProtoReplica) Descriptor ¶
func (*ProtoReplica) Descriptor() ([]byte, []int)
func (*ProtoReplica) GetCreatedBy ¶
func (m *ProtoReplica) GetCreatedBy() string
func (*ProtoReplica) GetGeneration ¶
func (m *ProtoReplica) GetGeneration() uint64
func (*ProtoReplica) GetHash ¶
func (m *ProtoReplica) GetHash() string
func (*ProtoReplica) GetIdentity ¶
func (m *ProtoReplica) GetIdentity() string
func (*ProtoReplica) GetKnowledgeKeys ¶
func (m *ProtoReplica) GetKnowledgeKeys() []string
func (*ProtoReplica) GetKnowledgeValues ¶
func (m *ProtoReplica) GetKnowledgeValues() []uint64
func (*ProtoReplica) GetOptionKeys ¶
func (m *ProtoReplica) GetOptionKeys() []string
func (*ProtoReplica) GetOptionValues ¶
func (m *ProtoReplica) GetOptionValues() []string
func (*ProtoReplica) GetVersion ¶
func (m *ProtoReplica) GetVersion() uint32
func (*ProtoReplica) ProtoMessage ¶
func (*ProtoReplica) ProtoMessage()
func (*ProtoReplica) Reset ¶
func (m *ProtoReplica) Reset()
func (*ProtoReplica) String ¶
func (m *ProtoReplica) String() string
type Replica ¶
type Replica struct {
// contains filtered or unexported fields
}
func ScanTree ¶
func ScanTree(fs tree.LocalFileTree, extraOptions *tree.ScanOptions, recvOptionsChan, sendOptionsChan chan *tree.ScanOptions, progress chan<- *tree.ScanProgress, cancel chan struct{}) (*Replica, error)
func (*Replica) Changed ¶
Changed returns true if this replica got a change in it's own files (data or metadata)
func (*Replica) ChangedAny ¶
ChangedAny returns true if this replica got any updated (presumably during the last scan).
func (*Replica) Perms ¶
Perms returns the permission map used for this replica (which permissions are used in synchronizing). 0777 by default, but can be changed by the "perms" option.
func (*Replica) SerializeStream ¶
type ReplicaSet ¶
type ReplicaSet struct {
// contains filtered or unexported fields
}
ReplicaSet is a combination of two replicas
func Scan ¶
func Scan(fs1, fs2 tree.Tree, options ...func(*ReplicaSet)) (*ReplicaSet, error)
func (*ReplicaSet) Get ¶
func (rs *ReplicaSet) Get(index int) *Replica
Get returns the replica by index
func (*ReplicaSet) MarkSynced ¶
func (rs *ReplicaSet) MarkSynced()
MarkSynced sets the generation as including each other. This is done after they have been cleanly synchronized.
type ScanProgress ¶
type ScanProgress [2]*tree.ScanProgress
func (ScanProgress) Ahead ¶
func (p ScanProgress) Ahead() *tree.ScanProgress
func (ScanProgress) Behind ¶
func (p ScanProgress) Behind() *tree.ScanProgress
func (ScanProgress) Percent ¶
func (p ScanProgress) Percent() float64