forked from TrueCloudLab/frostfs-node
674f520da7
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
17 lines
366 B
Go
17 lines
366 B
Go
package writecache
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"go.etcd.io/bbolt"
|
|
)
|
|
|
|
// OpenDB opens BoltDB instance for write-cache. Opens in read-only mode if ro is true.
|
|
func OpenDB(p string, ro bool) (*bbolt.DB, error) {
|
|
return bbolt.Open(filepath.Join(p, dbName), os.ModePerm, &bbolt.Options{
|
|
NoFreelistSync: true,
|
|
NoSync: true,
|
|
ReadOnly: ro,
|
|
})
|
|
}
|