Change prefix_extractor to smart-pointer instead of raw
This commit is contained in:
parent
82b88db21b
commit
098f9578d6
4 changed files with 24 additions and 19 deletions
|
@ -1,6 +1,14 @@
|
|||
Changelog
|
||||
*********
|
||||
|
||||
Upcoming Version
|
||||
----------------
|
||||
|
||||
Target is to work with the next version of rocksdb.
|
||||
|
||||
* Fixed `issue 3 <https://github.com/stephan-hof/pyrocksdb/pull/3>`_.
|
||||
Which fixed the change of prefix_extractor from raw-pointer to smart-pointer
|
||||
|
||||
Version 0.1
|
||||
-----------
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ For more details consider https://github.com/facebook/rocksdb/blob/master/INSTAL
|
|||
$ apt-get install libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev
|
||||
$ git clone https://github.com/facebook/rocksdb.git
|
||||
$ cd rocksdb
|
||||
$ # It is tested with this version
|
||||
$ git checkout 2.7.fb
|
||||
$ make librocksdb.so
|
||||
|
||||
If you do not want to call ``make install`` export the following enviroment
|
||||
|
@ -34,4 +32,4 @@ Building pyrocksdb
|
|||
$ cd pyrocks_test
|
||||
$ . bin/active
|
||||
$ pip install "Cython>=0.20"
|
||||
$ pip install git+git://github.com/stephan-hof/pyrocksdb.git@v0.1
|
||||
$ pip install git+git://github.com/stephan-hof/pyrocksdb.git
|
||||
|
|
|
@ -462,34 +462,33 @@ LRUCache = PyLRUCache
|
|||
### Here comes the stuff for SliceTransform
|
||||
@cython.internal
|
||||
cdef class PySliceTransform(object):
|
||||
cdef slice_transform.SliceTransformWrapper* transfomer
|
||||
cdef shared_ptr[slice_transform.SliceTransform] transfomer
|
||||
cdef object ob
|
||||
|
||||
def __cinit__(self, object ob):
|
||||
self.transfomer = NULL
|
||||
if not isinstance(ob, ISliceTransform):
|
||||
raise TypeError("%s is not of type %s" % (ob, ISliceTransform))
|
||||
|
||||
self.ob = ob
|
||||
self.transfomer = new slice_transform.SliceTransformWrapper(
|
||||
bytes_to_string(ob.name()),
|
||||
<void*>ob,
|
||||
slice_transform_callback,
|
||||
slice_in_domain_callback,
|
||||
slice_in_range_callback)
|
||||
|
||||
def __dealloc__(self):
|
||||
if not self.transfomer == NULL:
|
||||
del self.transfomer
|
||||
self.transfomer.reset(
|
||||
<slice_transform.SliceTransform*>
|
||||
new slice_transform.SliceTransformWrapper(
|
||||
bytes_to_string(ob.name()),
|
||||
<void*>ob,
|
||||
slice_transform_callback,
|
||||
slice_in_domain_callback,
|
||||
slice_in_range_callback))
|
||||
|
||||
cdef object get_ob(self):
|
||||
return self.ob
|
||||
|
||||
cdef slice_transform.SliceTransform* get_transformer(self):
|
||||
return <slice_transform.SliceTransform*> self.transfomer
|
||||
cdef shared_ptr[slice_transform.SliceTransform] get_transformer(self):
|
||||
return self.transfomer
|
||||
|
||||
cdef set_info_log(self, shared_ptr[logger.Logger] info_log):
|
||||
self.transfomer.set_info_log(info_log)
|
||||
cdef slice_transform.SliceTransformWrapper* ptr
|
||||
ptr = <slice_transform.SliceTransformWrapper*> self.transfomer.get()
|
||||
ptr.set_info_log(info_log)
|
||||
|
||||
|
||||
cdef Slice slice_transform_callback(
|
||||
|
|
|
@ -45,7 +45,7 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
|
|||
CompressionType compression
|
||||
# TODO: compression_per_level
|
||||
# TODO: compression_opts
|
||||
SliceTransform* prefix_extractor
|
||||
shared_ptr[SliceTransform] prefix_extractor
|
||||
cpp_bool whole_key_filtering
|
||||
int num_levels
|
||||
int level0_file_num_compaction_trigger
|
||||
|
|
Loading…
Reference in a new issue