Get rid of the second context, not needed it is always the same

This commit is contained in:
hofmockel 2014-01-24 17:18:29 +01:00
parent a83a15e1a8
commit 9133c81f9e
3 changed files with 5 additions and 10 deletions

View file

@ -206,7 +206,6 @@ cdef class PyGenericFilterPolicy(PyFilterPolicy):
self.policy = <filter_policy.FilterPolicy*> new filter_policy.FilterPolicyWrapper( self.policy = <filter_policy.FilterPolicy*> new filter_policy.FilterPolicyWrapper(
bytes_to_string(ob.name()), bytes_to_string(ob.name()),
<void*>ob, <void*>ob,
<void*>ob,
create_filter_callback, create_filter_callback,
key_may_match_callback) key_may_match_callback)

View file

@ -20,13 +20,11 @@ namespace py_rocks {
FilterPolicyWrapper( FilterPolicyWrapper(
string name, string name,
void* create_filter_context, void* ctx,
void* key_may_match_context,
create_filter_func create_filter_callback, create_filter_func create_filter_callback,
key_may_match_func key_may_match_callback): key_may_match_func key_may_match_callback):
name(name), name(name),
create_filter_context(create_filter_context), ctx(ctx),
key_may_match_context(key_may_match_context),
create_filter_callback(create_filter_callback), create_filter_callback(create_filter_callback),
key_may_match_callback(key_may_match_callback) key_may_match_callback(key_may_match_callback)
{} {}
@ -34,7 +32,7 @@ namespace py_rocks {
void void
CreateFilter(const Slice* keys, int n, std::string* dst) const { CreateFilter(const Slice* keys, int n, std::string* dst) const {
this->create_filter_callback( this->create_filter_callback(
this->create_filter_context, this->ctx,
keys, keys,
n, n,
dst); dst);
@ -43,7 +41,7 @@ namespace py_rocks {
bool bool
KeyMayMatch(const Slice& key, const Slice& filter) const { KeyMayMatch(const Slice& key, const Slice& filter) const {
return this->key_may_match_callback( return this->key_may_match_callback(
this->key_may_match_context, this->ctx,
key, key,
filter); filter);
} }
@ -54,8 +52,7 @@ namespace py_rocks {
private: private:
string name; string name;
void* create_filter_context; void* ctx;
void* key_may_match_context;
create_filter_func create_filter_callback; create_filter_func create_filter_callback;
key_may_match_func key_may_match_callback; key_may_match_func key_may_match_callback;
}; };

View file

@ -19,6 +19,5 @@ cdef extern from "cpp/filter_policy_wrapper.hpp" namespace "py_rocks":
FilterPolicyWrapper( FilterPolicyWrapper(
string, string,
void*, void*,
void*,
create_filter_func, create_filter_func,
key_may_match_func) nogil except+ key_may_match_func) nogil except+