Check space dir existence before creating new
This commit is contained in:
parent
3d624adc09
commit
8b86ad2918
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
|
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -30,6 +31,11 @@ type spaceStorage struct {
|
|||||||
func newSpaceStorage(rootPath string, spaceId string) (store spacestorage.SpaceStorage, err error) {
|
func newSpaceStorage(rootPath string, spaceId string) (store spacestorage.SpaceStorage, err error) {
|
||||||
log.With(zap.String("id", spaceId)).Debug("space storage opening with new")
|
log.With(zap.String("id", spaceId)).Debug("space storage opening with new")
|
||||||
dbPath := path.Join(rootPath, spaceId)
|
dbPath := path.Join(rootPath, spaceId)
|
||||||
|
if _, err = os.Stat(dbPath); err != nil {
|
||||||
|
err = spacestorage.ErrSpaceStorageMissing
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
objDb, err := pogreb.Open(dbPath, defPogrebOptions)
|
objDb, err := pogreb.Open(dbPath, defPogrebOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user