|
|
|
@ -88,6 +88,7 @@ using ROCKSDB_NAMESPACE::NewBloomFilterPolicy; |
|
|
|
|
using ROCKSDB_NAMESPACE::NewCompactOnDeletionCollectorFactory; |
|
|
|
|
using ROCKSDB_NAMESPACE::NewGenericRateLimiter; |
|
|
|
|
using ROCKSDB_NAMESPACE::NewLRUCache; |
|
|
|
|
using ROCKSDB_NAMESPACE::NewRibbonFilterPolicy; |
|
|
|
|
using ROCKSDB_NAMESPACE::OptimisticTransactionDB; |
|
|
|
|
using ROCKSDB_NAMESPACE::OptimisticTransactionOptions; |
|
|
|
|
using ROCKSDB_NAMESPACE::Options; |
|
|
|
@ -3882,6 +3883,47 @@ rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_bloom(int bits_per_key) { |
|
|
|
|
return rocksdb_filterpolicy_create_bloom_format(bits_per_key, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_ribbon_format( |
|
|
|
|
int bloom_equivalent_bits_per_key) { |
|
|
|
|
// Make a rocksdb_filterpolicy_t, but override all of its methods so
|
|
|
|
|
// they delegate to a NewRibbonFilterPolicy() instead of user
|
|
|
|
|
// supplied C functions.
|
|
|
|
|
struct Wrapper : public rocksdb_filterpolicy_t { |
|
|
|
|
const FilterPolicy* rep_; |
|
|
|
|
~Wrapper() override { delete rep_; } |
|
|
|
|
const char* Name() const override { return rep_->Name(); } |
|
|
|
|
void CreateFilter(const Slice* keys, int n, |
|
|
|
|
std::string* dst) const override { |
|
|
|
|
return rep_->CreateFilter(keys, n, dst); |
|
|
|
|
} |
|
|
|
|
bool KeyMayMatch(const Slice& key, const Slice& filter) const override { |
|
|
|
|
return rep_->KeyMayMatch(key, filter); |
|
|
|
|
} |
|
|
|
|
ROCKSDB_NAMESPACE::FilterBitsBuilder* GetBuilderWithContext( |
|
|
|
|
const ROCKSDB_NAMESPACE::FilterBuildingContext& context) |
|
|
|
|
const override { |
|
|
|
|
return rep_->GetBuilderWithContext(context); |
|
|
|
|
} |
|
|
|
|
ROCKSDB_NAMESPACE::FilterBitsReader* GetFilterBitsReader( |
|
|
|
|
const Slice& contents) const override { |
|
|
|
|
return rep_->GetFilterBitsReader(contents); |
|
|
|
|
} |
|
|
|
|
static void DoNothing(void*) {} |
|
|
|
|
}; |
|
|
|
|
Wrapper* wrapper = new Wrapper; |
|
|
|
|
wrapper->rep_ = NewRibbonFilterPolicy(bloom_equivalent_bits_per_key); |
|
|
|
|
wrapper->state_ = nullptr; |
|
|
|
|
wrapper->delete_filter_ = nullptr; |
|
|
|
|
wrapper->destructor_ = &Wrapper::DoNothing; |
|
|
|
|
return wrapper; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
rocksdb_filterpolicy_t* rocksdb_filterpolicy_create_ribbon( |
|
|
|
|
int bloom_equivalent_bits_per_key) { |
|
|
|
|
return rocksdb_filterpolicy_create_ribbon_format( |
|
|
|
|
bloom_equivalent_bits_per_key); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
rocksdb_mergeoperator_t* rocksdb_mergeoperator_create( |
|
|
|
|
void* state, void (*destructor)(void*), |
|
|
|
|
char* (*full_merge)(void*, const char* key, size_t key_length, |
|
|
|
|