1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-10 18:10:49 +09:00

migrate to badger v3

This commit is contained in:
Roman Khafizianov 2022-04-11 19:07:23 +02:00
parent 2548dba949
commit f457ef6616
No known key found for this signature in database
GPG key ID: F07A7D55A2684852
7 changed files with 436 additions and 69 deletions

View file

@ -11,7 +11,6 @@ import (
"github.com/anytypeio/go-anytype-middleware/util/pbtypes"
dsbadgerv3 "github.com/anytypeio/go-ds-badger3"
"github.com/gogo/protobuf/types"
dsbadgerv1 "github.com/ipfs/go-ds-badger"
"math/rand"
"os"
"path/filepath"
@ -67,10 +66,10 @@ func initBadgerV3(o *options) (*dsbadgerv3.Datastore, error) {
return localstoreDS, nil
}
func initBadgerV1(o *options) (*dsbadgerv1.Datastore, error) {
cfg := clientds.DefaultConfig.Logstore
func initBadgerV1(o *options) (*dsbadgerv3.Datastore, error) {
cfg := clientds.DefaultConfig.Localstore
cfg.SyncWrites = o.sync
localstoreDS, err := dsbadgerv1.NewDatastore(filepath.Join(o.path, localstoreDir), &cfg)
localstoreDS, err := dsbadgerv3.NewDatastore(filepath.Join(o.path, localstoreDir), &cfg)
if err != nil {
return nil, err
}