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

Add spaceIsDeleted checks

This commit is contained in:
mcrakhman 2023-02-20 22:51:00 +01:00 committed by Mikhail Iudin
parent 09387888de
commit 7e946d4313
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
9 changed files with 137 additions and 94 deletions

View file

@ -117,7 +117,10 @@ func (s *spaceService) NewSpace(ctx context.Context, id string) (Space, error) {
}
lastConfiguration := s.configurationService.GetLast()
var spaceIsClosed = &atomic.Bool{}
var (
spaceIsClosed = &atomic.Bool{}
spaceIsDeleted = &atomic.Bool{}
)
getter := newCommonGetter(st.Id(), s.treeGetter, spaceIsClosed)
syncStatus := syncstatus.NewNoOpSyncStatus()
// this will work only for clients, not the best solution, but...
@ -131,8 +134,8 @@ func (s *spaceService) NewSpace(ctx context.Context, id string) (Space, error) {
return nil, err
}
headSync := headsync.NewHeadSync(id, s.config.SyncPeriod, st, peerManager, getter, syncStatus, log)
objectSync := objectsync.NewObjectSync(id, peerManager, getter)
headSync := headsync.NewHeadSync(id, spaceIsDeleted, s.config.SyncPeriod, st, peerManager, getter, syncStatus, log)
objectSync := objectsync.NewObjectSync(id, spaceIsDeleted, peerManager, getter)
sp := &space{
id: id,
objectSync: objectSync,
@ -145,6 +148,7 @@ func (s *spaceService) NewSpace(ctx context.Context, id string) (Space, error) {
storage: st,
treesUsed: &atomic.Int32{},
isClosed: spaceIsClosed,
isDeleted: spaceIsDeleted,
}
return sp, nil
}