1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-09 17:45:03 +09:00
any-sync/common/commonspace/storage/storage.go
2022-09-30 13:49:31 +02:00

33 lines
1.1 KiB
Go

//go:generate mockgen -package storage -destination storage_mock.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage SpaceStorageProvider,SpaceStorage
package storage
import (
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/storage"
)
const CName = "commonspace.storage"
var ErrSpaceStorageExists = errors.New("space storage exists")
type SpaceStorage interface {
storage.Provider
ACLStorage() (storage.ListStorage, error)
SpaceHeader() (*spacesyncproto.SpaceHeader, error)
StoredIds() ([]string, error)
}
type SpaceStorageCreatePayload struct {
RecWithId *aclrecordproto.RawACLRecordWithId
SpaceHeader *spacesyncproto.SpaceHeader
Id string
}
type SpaceStorageProvider interface {
app.Component
SpaceStorage(id string) (SpaceStorage, error)
CreateSpaceStorage(payload SpaceStorageCreatePayload) (SpaceStorage, error)
}