[#791] writecache: Export OpenDB function
The function will be useful for the tool which works with write-cache parts. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ca4c9d4673
commit
8a1593fdcc
2 changed files with 29 additions and 12 deletions
17
pkg/local_object_storage/writecache/util.go
Normal file
17
pkg/local_object_storage/writecache/util.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package writecache
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"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(path.Join(p, dbName), os.ModePerm, &bbolt.Options{
|
||||
NoFreelistSync: true,
|
||||
NoSync: true,
|
||||
ReadOnly: ro,
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue