lib/db, lib/protocol: Never need empty-version entries (fixes #6961) (#6962)

Avoid havoc when discovering locally-deleted-upgraded files during repair / need calculation...

Co-authored-by: Simon Frei <freisim93@gmail.com>
This commit is contained in:
Jakob Borg
2020-09-07 20:18:25 +02:00
committed by GitHub
co-authored by Simon Frei
parent e19728d8cc
commit 674fca3868
4 changed files with 81 additions and 7 deletions
+5
View File
@@ -127,6 +127,11 @@ func (v Vector) Counter(id ShortID) uint64 {
return 0
}
// IsEmpty returns true when there are no counters.
func (v Vector) IsEmpty() bool {
return len(v.Counters) == 0
}
// DropOthers removes all counters, keeping only the one with given id. If there
// is no such counter, an empty Vector is returned.
func (v Vector) DropOthers(id ShortID) Vector {