1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00
any-sync/commonspace/commonstorage.go
2023-05-23 14:47:24 +02:00

28 lines
722 B
Go

package commonspace
import (
"github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
"github.com/anyproto/any-sync/commonspace/spacestorage"
)
type commonStorage struct {
spacestorage.SpaceStorage
}
func newCommonStorage(spaceStorage spacestorage.SpaceStorage) spacestorage.SpaceStorage {
return &commonStorage{
SpaceStorage: spaceStorage,
}
}
func (c *commonStorage) CreateTreeStorage(payload treestorage.TreeStorageCreatePayload) (store treestorage.TreeStorage, err error) {
status, err := c.TreeDeletedStatus(payload.RootRawChange.Id)
if err != nil {
return
}
if status == "" {
return c.SpaceStorage.CreateTreeStorage(payload)
}
err = spacestorage.ErrTreeStorageAlreadyDeleted
return
}