Update _rocksdb.pyx

This commit is contained in:
iFA 2019-04-22 20:45:29 +02:00 committed by GitHub
parent 88ee8ef45c
commit 57397cd077
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1258,6 +1258,9 @@ cdef class Options(ColumnFamilyOptions):
for key, value in kwargs.items(): for key, value in kwargs.items():
setattr(self, key, value) setattr(self, key, value)
def IncreaseParallelism(self, int total_threads=16):
self.opts.IncreaseParallelism(total_threads)
property create_if_missing: property create_if_missing:
def __get__(self): def __get__(self):
return self.opts.create_if_missing return self.opts.create_if_missing
@ -1671,11 +1674,8 @@ cdef class DB(object):
self.opts.in_use = True self.opts.in_use = True
def __dealloc__(self): def __dealloc__(self):
self.close()
def close(self):
cdef ColumnFamilyOptions copts cdef ColumnFamilyOptions copts
if not self.db == NULL: if self.db != NULL:
# We have to make sure we delete the handles so rocksdb doesn't # We have to make sure we delete the handles so rocksdb doesn't
# assert when we delete the db # assert when we delete the db
self.cf_handles.clear() self.cf_handles.clear()
@ -1683,12 +1683,13 @@ cdef class DB(object):
if copts: if copts:
copts.in_use = False copts.in_use = False
self.cf_options.clear() self.cf_options.clear()
with nogil: with nogil:
del self.db del self.db
if self.opts is not None: if self.opts is not None:
self.opts.in_use = False self.opts.in_use = False
@property @property
def column_families(self): def column_families(self):