mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 17:45:03 +09:00
Change deletion logic in headsync and objectsync
This commit is contained in:
parent
73b27c7dac
commit
a0aa02bb8a
4 changed files with 28 additions and 13 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
type SpaceIdsProvider interface {
|
||||
AllIds() []string
|
||||
RemoveObjects(ids []string)
|
||||
}
|
||||
|
||||
type SpaceDeleter interface {
|
||||
|
@ -60,13 +61,17 @@ func (d *deletionManager) UpdateState(state *settingsstate.State) (err error) {
|
|||
if ok {
|
||||
spaceDeleter.DeleteSpace(d.spaceId)
|
||||
}
|
||||
d.onSpaceDelete()
|
||||
if d.isResponsible {
|
||||
allIds := slice.DiscardFromSlice(d.provider.AllIds(), func(s string) bool {
|
||||
return s == d.settingsId
|
||||
allIds := slice.DiscardFromSlice(d.provider.AllIds(), func(id string) bool {
|
||||
return id == d.settingsId
|
||||
})
|
||||
err = d.deletionState.Add(allIds)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
d.provider.RemoveObjects(allIds)
|
||||
}
|
||||
d.onSpaceDelete()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue