1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

Mark hash dirty

This commit is contained in:
mcrakhman 2023-12-01 21:42:16 +01:00
parent a8a62b0923
commit 39e28159bb
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
2 changed files with 6 additions and 0 deletions

View file

@ -30,12 +30,14 @@ func (d *diffContainer) PrecalculatedDiff() Diff {
func (d *diffContainer) Set(elements ...Element) {
d.initial.mu.Lock()
defer d.initial.mu.Unlock()
defer d.initial.markHashDirty()
d.precalculated.Set(elements...)
}
func (d *diffContainer) RemoveId(id string) error {
d.initial.mu.Lock()
defer d.initial.mu.Unlock()
defer d.initial.markHashDirty()
return d.precalculated.RemoveId(id)
}

View file

@ -251,6 +251,10 @@ func (d *olddiff) Diff(ctx context.Context, dl Remote) (newIds, changedIds, remo
return dctx.newIds, dctx.changedIds, dctx.removedIds, nil
}
func (d *olddiff) markHashDirty() {
d.hashIsDirty.Store(true)
}
func (d *olddiff) compareResults(dctx *diffCtx, r Range, myRes, otherRes RangeResult) {
// both hash equals - do nothing
if bytes.Equal(myRes.Hash, otherRes.Hash) {