Add bucket fill percent option for boltdb
This commit is contained in:
parent
fedb46269e
commit
d369bd5c3c
@ -37,6 +37,7 @@ type Store struct {
|
|||||||
bucket string
|
bucket string
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
noSync bool
|
noSync bool
|
||||||
|
fillPercent float64
|
||||||
mo store.MergeOperator
|
mo store.MergeOperator
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,11 @@ func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore,
|
|||||||
|
|
||||||
noSync, _ := config["nosync"].(bool)
|
noSync, _ := config["nosync"].(bool)
|
||||||
|
|
||||||
|
fillPercent, ok := config["fillPercent"].(float64)
|
||||||
|
if !ok {
|
||||||
|
fillPercent = bolt.DefaultFillPercent
|
||||||
|
}
|
||||||
|
|
||||||
db, err := bolt.Open(path, 0600, nil)
|
db, err := bolt.Open(path, 0600, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -74,6 +80,7 @@ func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore,
|
|||||||
db: db,
|
db: db,
|
||||||
mo: mo,
|
mo: mo,
|
||||||
noSync: noSync,
|
noSync: noSync,
|
||||||
|
fillPercent: fillPercent,
|
||||||
}
|
}
|
||||||
return &rv, nil
|
return &rv, nil
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ func (w *Writer) ExecuteBatch(batch store.KVBatch) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bucket := tx.Bucket([]byte(w.store.bucket))
|
bucket := tx.Bucket([]byte(w.store.bucket))
|
||||||
|
bucket.FillPercent = w.store.fillPercent
|
||||||
|
|
||||||
for k, mergeOps := range emulatedBatch.Merger.Merges {
|
for k, mergeOps := range emulatedBatch.Merger.Merges {
|
||||||
kb := []byte(k)
|
kb := []byte(k)
|
||||||
|
Loading…
Reference in New Issue
Block a user