Add space deleted in storage

This commit is contained in:
mcrakhman 2023-02-22 10:05:17 +01:00 committed by Mikhail Iudin
parent 913c6925bf
commit 8a38d54192
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
3 changed files with 11 additions and 0 deletions

View File

@ -423,6 +423,10 @@ func (s *space) onObjectClose(id string) {
}
func (s *space) onSpaceDelete() {
err := s.storage.SetSpaceDeleted()
if err != nil {
log.Debug("failed to set space deleted")
}
s.isDeleted.Swap(true)
}

View File

@ -121,6 +121,11 @@ func (s *spaceService) NewSpace(ctx context.Context, id string) (Space, error) {
spaceIsClosed = &atomic.Bool{}
spaceIsDeleted = &atomic.Bool{}
)
isDeleted, err := st.IsSpaceDeleted()
if err != nil {
return nil, err
}
spaceIsDeleted.Swap(isDeleted)
getter := newCommonGetter(st.Id(), s.treeGetter, spaceIsClosed)
syncStatus := syncstatus.NewNoOpSyncStatus()
// this will work only for clients, not the best solution, but...

View File

@ -29,6 +29,8 @@ const (
// TODO: consider moving to some file with all common interfaces etc
type SpaceStorage interface {
Id() string
SetSpaceDeleted() error
IsSpaceDeleted() (bool, error)
SetTreeDeletedStatus(id, state string) error
TreeDeletedStatus(id string) (string, error)
SpaceSettingsId() string