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
|
||||
db *bolt.DB
|
||||
noSync bool
|
||||
fillPercent float64
|
||||
mo store.MergeOperator
|
||||
}
|
||||
|
||||
|
@ -53,6 +54,11 @@ func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore,
|
|||
|
||||
noSync, _ := config["nosync"].(bool)
|
||||
|
||||
fillPercent, ok := config["fillPercent"].(float64)
|
||||
if !ok {
|
||||
fillPercent = bolt.DefaultFillPercent
|
||||
}
|
||||
|
||||
db, err := bolt.Open(path, 0600, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -74,6 +80,7 @@ func New(mo store.MergeOperator, config map[string]interface{}) (store.KVStore,
|
|||
db: db,
|
||||
mo: mo,
|
||||
noSync: noSync,
|
||||
fillPercent: fillPercent,
|
||||
}
|
||||
return &rv, nil
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ func (w *Writer) ExecuteBatch(batch store.KVBatch) error {
|
|||
}
|
||||
|
||||
bucket := tx.Bucket([]byte(w.store.bucket))
|
||||
bucket.FillPercent = w.store.fillPercent
|
||||
|
||||
for k, mergeOps := range emulatedBatch.Merger.Merges {
|
||||
kb := []byte(k)
|
||||
|
|
Loading…
Reference in New Issue
Block a user