Use mostly defaults for badger options

This options are the defults in badger `master` now.
We should update to next badger version as soon as it is stable, it has
some nice improvments.

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera
2020-07-08 17:54:33 +02:00
parent 8e46753e38
commit 40286e4192
3 changed files with 12 additions and 4 deletions
+7 -4
View File
@@ -1,16 +1,18 @@
package repo
import (
"os"
"path/filepath"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/mount"
"github.com/ipfs/go-datastore/namespace"
"golang.org/x/xerrors"
"os"
"path/filepath"
dgbadger "github.com/dgraph-io/badger/v2"
badger "github.com/ipfs/go-ds-badger2"
levelds "github.com/ipfs/go-ds-leveldb"
"github.com/ipfs/go-ds-measure"
measure "github.com/ipfs/go-ds-measure"
ldbopts "github.com/syndtr/goleveldb/leveldb/opt"
)
@@ -25,7 +27,8 @@ var fsDatastores = map[string]func(path string) (datastore.Batching, error){
func badgerDs(path string) (datastore.Batching, error) {
opts := badger.DefaultOptions
opts.Truncate = true
opts.Options = dgbadger.DefaultOptions("").WithCompactL0OnClose(false).
WithTruncate(true).WithValueThreshold(1 << 10)
return badger.NewDatastore(path, &opts)
}