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

Add arguments for flush method #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

setup(
name="aimrocks",
version='0.0.10',
version='0.0.11',
description='RocksDB wrapper implemented in Cython.',
setup_requires=['setuptools>=25', 'Cython==3.0.0a9'],
packages=find_packages('./src'),
Expand Down
14 changes: 10 additions & 4 deletions src/aimrocks/_rocksdb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1801,13 +1801,19 @@ cdef class DB(object):
st = self.db.DeleteRange(opts, cf_handle, c_begin_key, c_end_key)
check_status(st)

def flush(self):
def flush(self, ColumnFamilyHandle column_family=None, **py_options):
cdef Status st
cdef FlushOptions options
cdef db.ColumnFamilyHandle* cf_handle = self.db.DefaultColumnFamily()

cdef FlushOptions c_options
c_options.wait = py_options.get('wait', True)
c_options.allow_write_stall = py_options.get('allow_write_stall', False)

cdef db.ColumnFamilyHandle * cf_handle = self.db.DefaultColumnFamily()
if column_family:
cf_handle = (<ColumnFamilyHandle?> column_family).get_handle()

with nogil:
st = self.db.Flush(options, cf_handle)
st = self.db.Flush(c_options, cf_handle)
check_status(st)

def flush_wal(self, sync=False):
Expand Down
1 change: 1 addition & 0 deletions src/aimrocks/options.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":

cdef cppclass FlushOptions:
cpp_bool wait
cpp_bool allow_write_stall

ctypedef enum BottommostLevelCompaction:
blc_skip "rocksdb::BottommostLevelCompaction::kSkip"
Expand Down