When scanner.Walk detects a change, it now returns the new file info as well as the old file info. It also finds deleted and ignored files while scanning. Also directory deletions are now always committed to db after their children to prevent temporary failure on remote due to non-empty directory.
This commit is contained in:
@@ -117,6 +117,10 @@ func (f FileInfo) WinsConflict(other FileInfo) bool {
|
||||
return f.Version.Compare(other.Version) == ConcurrentGreater
|
||||
}
|
||||
|
||||
func (f FileInfo) IsEmpty() bool {
|
||||
return f.Version.Counters == nil
|
||||
}
|
||||
|
||||
func (f *FileInfo) Invalidate(invalidatedBy ShortID) {
|
||||
f.Invalid = true
|
||||
f.ModifiedBy = invalidatedBy
|
||||
@@ -124,6 +128,23 @@ func (f *FileInfo) Invalidate(invalidatedBy ShortID) {
|
||||
f.Sequence = 0
|
||||
}
|
||||
|
||||
func (f *FileInfo) InvalidatedCopy(invalidatedBy ShortID) FileInfo {
|
||||
copy := *f
|
||||
copy.Invalidate(invalidatedBy)
|
||||
return copy
|
||||
}
|
||||
|
||||
func (f *FileInfo) DeletedCopy(deletedBy ShortID) FileInfo {
|
||||
copy := *f
|
||||
copy.Size = 0
|
||||
copy.ModifiedBy = deletedBy
|
||||
copy.Deleted = true
|
||||
copy.Version = f.Version.Update(deletedBy)
|
||||
copy.Sequence = 0
|
||||
copy.Blocks = nil
|
||||
return copy
|
||||
}
|
||||
|
||||
func (b BlockInfo) String() string {
|
||||
return fmt.Sprintf("Block{%d/%d/%d/%x}", b.Offset, b.Size, b.WeakHash, b.Hash)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user