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

View file

@ -1,14 +1,15 @@
from libcpp cimport bool as cpp_bool from libcpp cimport bool as cpp_bool
from libcpp.string cimport string from libcpp.string cimport string
from libc.string cimport const_char
from slice_ cimport Slice from slice_ cimport Slice
cdef extern from "rocksdb/filter_policy.h" namespace "rocksdb": cdef extern from "rocksdb/filter_policy.h" namespace "rocksdb":
cdef cppclass FilterPolicy: cdef cppclass FilterPolicy:
void CreateFilter(const Slice*, int, string*) const void CreateFilter(const Slice*, int, string*) nogil except+
cpp_bool KeyMayMatch(const Slice&, const Slice&) const cpp_bool KeyMayMatch(const Slice&, const Slice&) nogil except+
const char* Name() const 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 void (*create_filter_func)(void*, const Slice*, int, string*)
ctypedef cpp_bool (*key_may_match_func)(void*, const Slice&, const Slice&) 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*,
void*, void*,
create_filter_func, 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 extern from "rocksdb/iterator.h" namespace "rocksdb":
cdef cppclass Iterator: cdef cppclass Iterator:
cpp_bool Valid() const cpp_bool Valid() nogil except+
void SeekToFirst() void SeekToFirst() nogil except+
void SeekToLast() void SeekToLast() nogil except+
void Seek(const Slice&) void Seek(const Slice&) nogil except+
void Next() void Next() nogil except+
void Prev() void Prev() nogil except+
Slice key() const Slice key() nogil except+
Slice value() const Slice value() nogil except+
Status status() const Status status() nogil except+

View file

@ -2,4 +2,4 @@ cdef extern from "rocksdb/env.h" namespace "rocksdb":
cdef cppclass Logger: cdef cppclass Logger:
pass 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 extern from "cpp/merge_operator_wrapper.hpp" namespace "py_rocks":
cdef cppclass AssociativeMergeOperatorWrapper: cdef cppclass AssociativeMergeOperatorWrapper:
AssociativeMergeOperatorWrapper(string, void*, merge_func) AssociativeMergeOperatorWrapper(string, void*, merge_func) nogil except+
cdef cppclass MergeOperatorWrapper: cdef cppclass MergeOperatorWrapper:
MergeOperatorWrapper( MergeOperatorWrapper(
@ -42,4 +42,4 @@ cdef extern from "cpp/merge_operator_wrapper.hpp" namespace "py_rocks":
void*, void*,
void*, void*,
full_merge_func, 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 extern from "rocksdb/slice.h" namespace "rocksdb":
cdef cppclass Slice: cdef cppclass Slice:
Slice() Slice() nogil
Slice(const char*, size_t) Slice(const char*, size_t) nogil
Slice(const string&) Slice(const string&) nogil
Slice(const char*) Slice(const char*) nogil
const char* data() const char* data() nogil
size_t size() size_t size() nogil
cpp_bool empty() cpp_bool empty() nogil
char operator[](int) char operator[](int) nogil
void clear() void clear() nogil
void remove_prefix(size_t) void remove_prefix(size_t) nogil
string ToString() string ToString() nogil
string ToString(cpp_bool) string ToString(cpp_bool) nogil
int compare(const Slice&) int compare(const Slice&) nogil
cpp_bool starts_with(const Slice&) 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 extern from "rocksdb/status.h" namespace "rocksdb":
cdef cppclass Status: cdef cppclass Status:
Status() Status()
cpp_bool ok() const cpp_bool ok() nogil
cpp_bool IsNotFound() const cpp_bool IsNotFound() nogil const
cpp_bool IsCorruption() const cpp_bool IsCorruption() nogil const
cpp_bool IsNotSupported() const cpp_bool IsNotSupported() nogil const
cpp_bool IsInvalidArgument() const cpp_bool IsInvalidArgument() nogil const
cpp_bool IsIOError() const cpp_bool IsIOError() nogil const
cpp_bool IsMergeInProgress() const cpp_bool IsMergeInProgress() nogil const
cpp_bool IsIncomplete() const cpp_bool IsIncomplete() nogil const
string ToString() const string ToString() nogil except+

View file

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