Add the ability to pass in bitcask options per store

This commit is contained in:
kayos@tcp.direct 2022-01-21 02:57:25 -08:00
parent 6aade658b4
commit 4d08c92d99

@ -37,7 +37,7 @@ func (db *DB) Path() string {
} }
// Init opens a bitcask store at the given path to be referenced by storeName. // Init opens a bitcask store at the given path to be referenced by storeName.
func (db *DB) Init(storeName string) error { func (db *DB) Init(storeName string, bitcaskopts ...bitcask.Option) error {
db.mu.Lock() db.mu.Lock()
defer db.mu.Unlock() defer db.mu.Unlock()
if _, ok := db.store[storeName]; ok { if _, ok := db.store[storeName]; ok {
@ -47,7 +47,7 @@ func (db *DB) Init(storeName string) error {
if !strings.HasSuffix("/", db.Path()) { if !strings.HasSuffix("/", db.Path()) {
path = db.Path() + "/" path = db.Path() + "/"
} }
c, e := bitcask.Open(path + storeName) c, e := bitcask.Open(path+storeName, bitcaskopts...)
if e != nil { if e != nil {
return e return e
} }