lmdb: create directory if it doesn't exist.
This commit is contained in:
@@ -3,6 +3,7 @@ package lmdb
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"os"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/bmatsuo/lmdb-go/lmdb"
|
"github.com/bmatsuo/lmdb-go/lmdb"
|
||||||
@@ -49,6 +50,11 @@ func (b *LMDBBackend) Init() error {
|
|||||||
env.SetMaxReaders(500)
|
env.SetMaxReaders(500)
|
||||||
env.SetMapSize(1 << 38) // ~273GB
|
env.SetMapSize(1 << 38) // ~273GB
|
||||||
|
|
||||||
|
// create directory if it doesn't exist and open it
|
||||||
|
if err := os.MkdirAll(b.Path, 0644); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = env.Open(b.Path, lmdb.NoTLS, 0644)
|
err = env.Open(b.Path, lmdb.NoTLS, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user