Tag all the C++ functions with nogil and except+

This commit is contained in:
hofmockel 2014-01-17 20:06:17 +01:00
parent 828be96dba
commit 86e6aef6cb
9 changed files with 82 additions and 82 deletions

View file

@ -5,10 +5,10 @@ cdef extern from "rocksdb/comparator.h" namespace "rocksdb":
const char* Name()
int Compare(const Slice&, const Slice&) const
cdef extern const Comparator* BytewiseComparator()
cdef extern const Comparator* BytewiseComparator() nogil except +
ctypedef int (*compare_func)(void*, const Slice&, const Slice&)
cdef extern from "cpp/comparator_wrapper.hpp" namespace "py_rocks":
cdef cppclass ComparatorWrapper:
ComparatorWrapper(string, void*, compare_func)
ComparatorWrapper(string, void*, compare_func) nogil except +

View file

@ -8,18 +8,17 @@ from slice_ cimport Slice
from snapshot cimport Snapshot
from iterator cimport Iterator
# TODO: Move this to a separate .pxd file
cdef extern from "rocksdb/write_batch.h" namespace "rocksdb":
cdef cppclass WriteBatch:
WriteBatch() except +
WriteBatch(string) except +
void Put(const Slice&, const Slice&)
void Merge(const Slice&, const Slice&)
void Delete(const Slice&)
void PutLogData(const Slice&)
void Clear()
string Data()
int Count() const
WriteBatch() nogil except+
WriteBatch(string) nogil except+
void Put(const Slice&, const Slice&) nogil except+
void Merge(const Slice&, const Slice&) nogil except+
void Delete(const Slice&) nogil except+
void PutLogData(const Slice&) nogil except+
void Clear() nogil except+
string Data() nogil except+
int Count() nogil const
cdef extern from "rocksdb/db.h" namespace "rocksdb":
ctypedef uint64_t SequenceNumber
@ -40,71 +39,71 @@ cdef extern from "rocksdb/db.h" namespace "rocksdb":
Status Put(
const options.WriteOptions&,
const Slice&,
const Slice&)
const Slice&) nogil except+
Status Delete(
const options.WriteOptions&,
const Slice&)
const Slice&) nogil except+
Status Merge(
const options.WriteOptions&,
const Slice&,
const Slice&)
const Slice&) nogil except+
Status Write(
const options.WriteOptions&,
WriteBatch*)
WriteBatch*) nogil except+
Status Get(
const options.ReadOptions&,
const Slice&,
string*)
string*) nogil except+
vector[Status] MultiGet(
const options.ReadOptions&,
const vector[Slice]&,
vector[string]*)
vector[string]*) nogil except+
cpp_bool KeyMayExist(
const options.ReadOptions&,
Slice&,
string*,
cpp_bool*)
cpp_bool*) nogil except+
cpp_bool KeyMayExist(
const options.ReadOptions&,
Slice&,
string*)
string*) nogil except+
Iterator* NewIterator(
const options.ReadOptions&)
const options.ReadOptions&) nogil except+
const Snapshot* GetSnapshot()
const Snapshot* GetSnapshot() nogil except+
void ReleaseSnapshot(const Snapshot*)
void ReleaseSnapshot(const Snapshot*) nogil except+
cpp_bool GetProperty(
const Slice&,
string*)
string*) nogil except+
void GetApproximateSizes(
const Range*
int,
uint64_t*)
uint64_t*) nogil except+
void CompactRange(
const Slice*,
const Slice*,
bool,
int)
int) nogil except+
int NumberLevels()
int MaxMemCompactionLevel()
int Level0StopWriteTrigger()
const string& GetName() const
Status Flush(const options.FlushOptions&)
Status DisableFileDeletions()
Status EnableFileDeletions()
int NumberLevels() nogil except+
int MaxMemCompactionLevel() nogil except+
int Level0StopWriteTrigger() nogil except+
const string& GetName() nogil except+
Status Flush(const options.FlushOptions&) nogil except+
Status DisableFileDeletions() nogil except+
Status EnableFileDeletions() nogil except+
# TODO: Status GetSortedWalFiles(VectorLogPtr& files)
# TODO: SequenceNumber GetLatestSequenceNumber()
@ -112,17 +111,17 @@ cdef extern from "rocksdb/db.h" namespace "rocksdb":
# SequenceNumber seq_number,
# unique_ptr[TransactionLogIterator]*)
Status DeleteFile(string)
void GetLiveFilesMetaData(vector[LiveFileMetaData]*)
Status DeleteFile(string) nogil except+
void GetLiveFilesMetaData(vector[LiveFileMetaData]*) nogil except+
cdef Status DB_Open "rocksdb::DB::Open"(
const options.Options&,
const string&,
DB**)
DB**) nogil except+
cdef Status DB_OpenForReadOnly "rocksdb::DB::OpenForReadOnly"(
const options.Options&,
const string&,
DB**,
cpp_bool)
cpp_bool) nogil except+

View file

@ -1,14 +1,15 @@
from libcpp cimport bool as cpp_bool
from libcpp.string cimport string
from libc.string cimport const_char
from slice_ cimport Slice
cdef extern from "rocksdb/filter_policy.h" namespace "rocksdb":
cdef cppclass FilterPolicy:
void CreateFilter(const Slice*, int, string*) const
cpp_bool KeyMayMatch(const Slice&, const Slice&) const
const char* Name() const
void CreateFilter(const Slice*, int, string*) nogil except+
cpp_bool KeyMayMatch(const Slice&, const Slice&) nogil except+
const_char* Name() nogil except+
cdef extern const FilterPolicy* NewBloomFilterPolicy(int)
cdef extern const FilterPolicy* NewBloomFilterPolicy(int) nogil except+
ctypedef void (*create_filter_func)(void*, const Slice*, int, string*)
ctypedef cpp_bool (*key_may_match_func)(void*, const Slice&, const Slice&)
@ -20,4 +21,4 @@ cdef extern from "cpp/filter_policy_wrapper.hpp" namespace "py_rocks":
void*,
void*,
create_filter_func,
key_may_match_func)
key_may_match_func) nogil except+

View file

@ -4,12 +4,12 @@ from status cimport Status
cdef extern from "rocksdb/iterator.h" namespace "rocksdb":
cdef cppclass Iterator:
cpp_bool Valid() const
void SeekToFirst()
void SeekToLast()
void Seek(const Slice&)
void Next()
void Prev()
Slice key() const
Slice value() const
Status status() const
cpp_bool Valid() nogil except+
void SeekToFirst() nogil except+
void SeekToLast() nogil except+
void Seek(const Slice&) nogil except+
void Next() nogil except+
void Prev() nogil except+
Slice key() nogil except+
Slice value() nogil except+
Status status() nogil except+

View file

@ -2,4 +2,4 @@ cdef extern from "rocksdb/env.h" namespace "rocksdb":
cdef cppclass Logger:
pass
void Log(Logger*, const char*, ...)
void Log(Logger*, const char*, ...) nogil except+

View file

@ -34,7 +34,7 @@ ctypedef cpp_bool (*partial_merge_func)(
cdef extern from "cpp/merge_operator_wrapper.hpp" namespace "py_rocks":
cdef cppclass AssociativeMergeOperatorWrapper:
AssociativeMergeOperatorWrapper(string, void*, merge_func)
AssociativeMergeOperatorWrapper(string, void*, merge_func) nogil except+
cdef cppclass MergeOperatorWrapper:
MergeOperatorWrapper(
@ -42,4 +42,4 @@ cdef extern from "cpp/merge_operator_wrapper.hpp" namespace "py_rocks":
void*,
void*,
full_merge_func,
partial_merge_func)
partial_merge_func) nogil except+

View file

@ -3,18 +3,18 @@ from libcpp cimport bool as cpp_bool
cdef extern from "rocksdb/slice.h" namespace "rocksdb":
cdef cppclass Slice:
Slice()
Slice(const char*, size_t)
Slice(const string&)
Slice(const char*)
Slice() nogil
Slice(const char*, size_t) nogil
Slice(const string&) nogil
Slice(const char*) nogil
const char* data()
size_t size()
cpp_bool empty()
char operator[](int)
void clear()
void remove_prefix(size_t)
string ToString()
string ToString(cpp_bool)
int compare(const Slice&)
cpp_bool starts_with(const Slice&)
const char* data() nogil
size_t size() nogil
cpp_bool empty() nogil
char operator[](int) nogil
void clear() nogil
void remove_prefix(size_t) nogil
string ToString() nogil
string ToString(cpp_bool) nogil
int compare(const Slice&) nogil
cpp_bool starts_with(const Slice&) nogil

View file

@ -4,12 +4,12 @@ from libcpp.string cimport string
cdef extern from "rocksdb/status.h" namespace "rocksdb":
cdef cppclass Status:
Status()
cpp_bool ok() const
cpp_bool IsNotFound() const
cpp_bool IsCorruption() const
cpp_bool IsNotSupported() const
cpp_bool IsInvalidArgument() const
cpp_bool IsIOError() const
cpp_bool IsMergeInProgress() const
cpp_bool IsIncomplete() const
string ToString() const
cpp_bool ok() nogil
cpp_bool IsNotFound() nogil const
cpp_bool IsCorruption() nogil const
cpp_bool IsNotSupported() nogil const
cpp_bool IsInvalidArgument() nogil const
cpp_bool IsIOError() nogil const
cpp_bool IsMergeInProgress() nogil const
cpp_bool IsIncomplete() nogil const
string ToString() nogil except+

View file

@ -1,7 +1,7 @@
cdef extern from "<memory>" namespace "std":
cdef cppclass shared_ptr[T]:
shared_ptr()
shared_ptr(T*)
void reset()
void reset(T*)
T* get()
shared_ptr() nogil except+
shared_ptr(T*) nogil except+
void reset() nogil except+
void reset(T*) nogil except+
T* get() nogil except+