From 7e81dba5cf881c9a3b5d3c4852620cd056353a02 Mon Sep 17 00:00:00 2001 From: Warren Falk Date: Tue, 29 Dec 2015 14:47:51 -0500 Subject: [PATCH] Support creation of "full" format bloom filter from C API --- db/c.cc | 12 ++++++++++-- include/rocksdb/c.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/db/c.cc b/db/c.cc index 3c9842978..6e875bb84 100644 --- a/db/c.cc +++ b/db/c.cc @@ -1965,7 +1965,7 @@ void rocksdb_filterpolicy_destroy(rocksdb_filterpolicy_t* filter) { delete filter; } -rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom(int bits_per_key) { +rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom_format(int bits_per_key, bool original_format) { // Make a rocksdb_filterpolicy_t, but override all of its methods so // they delegate to a NewBloomFilterPolicy() instead of user // supplied C functions. @@ -1983,13 +1983,21 @@ rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom(int bits_per_key) { static void DoNothing(void*) { } }; Wrapper* wrapper = new Wrapper; - wrapper->rep_ = NewBloomFilterPolicy(bits_per_key); + wrapper->rep_ = NewBloomFilterPolicy(bits_per_key, original_format); wrapper->state_ = nullptr; wrapper->delete_filter_ = nullptr; wrapper->destructor_ = &Wrapper::DoNothing; return wrapper; } +rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom_full(int bits_per_key) { + return rocksdb_filterpolicy_create_bloom_format(bits_per_key, false); +} + +rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom(int bits_per_key) { + return rocksdb_filterpolicy_create_bloom_format(bits_per_key, true); +} + rocksdb_mergeoperator_t* rocksdb_mergeoperator_create( void* state, void (*destructor)(void*), char* (*full_merge)(void*, const char* key, size_t key_length, diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 6bb3b8538..ccaa9ede2 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -760,6 +760,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_filterpolicy_destroy( extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom(int bits_per_key); +extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t* +rocksdb_filterpolicy_create_bloom_full(int bits_per_key); /* Merge Operator */