Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ribbon filter, optimistic db write #58

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ Almost C API, excepts:
- [ ] putv/mergev/deletev/delete_rangev
- [ ] compaction_filter/compaction_filter_factory/compaction_filter_context
- [ ] transactiondb_property_value/transactiondb_property_int
- [ ] optimistictransactiondb_write/optimistictransactiondb_checkpoint_object_create/optimistictransactiondb_property_value/optimistictransactiondb_property_int

- [ ] optimistictransactiondb_property_value/optimistictransactiondb_property_int
4 changes: 2 additions & 2 deletions filter_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ func NewBloomFilterFull(bitsPerKey float64) FilterPolicy {
//
// Also consider using optimize_filters_for_memory to save filter
// memory.
func NewRibbonFilterPolicy(bitsPerKey float64) FilterPolicy {
return NewNativeFilterPolicy(C.rocksdb_filterpolicy_create_ribbon(C.double(bitsPerKey)))
func NewRibbonFilterPolicy(bitsPerKey float64, bloomBeforeLevel int) FilterPolicy {
return NewNativeFilterPolicy(C.rocksdb_filterpolicy_create_ribbon_hybrid(C.double(bitsPerKey), C.int(bloomBeforeLevel)))
}

// Hold references to filter policies.
Expand Down
15 changes: 15 additions & 0 deletions optimistic_transaction_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ func (db *OptimisticTransactionDB) TransactionBegin(
db.c, opts.c, transactionOpts.c, nil))
}

// NewCheckpoint creates a new Checkpoint for this db.
func (db *OptimisticTransactionDB) NewCheckpoint() (cp *Checkpoint, err error) {
var cErr *C.char

cCheckpoint := C.rocksdb_optimistictransactiondb_checkpoint_object_create(
db.c, &cErr,
)
if err = fromCError(cErr); err == nil {
cp = NewNativeCheckpoint(cCheckpoint)
}

return
}

// Write batch.
func (db *OptimisticTransactionDB) Write(opts *WriteOptions, batch *WriteBatch) (err error) {
var cErr *C.char

Expand Down