From 3bb2be4467f8e1a4751b3448a47279ffc21dfc1a Mon Sep 17 00:00:00 2001 From: Mandar Harshe <mandarharshe@gmail.com> Date: Sat, 20 Nov 2021 19:58:51 +0100 Subject: [PATCH] Add types.pxd to make types available to all modules --- rocksdb/db.pxd | 2 +- rocksdb/types.pxd | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 rocksdb/types.pxd diff --git a/rocksdb/db.pxd b/rocksdb/db.pxd index e5c239c..6cc4d11 100644 --- a/rocksdb/db.pxd +++ b/rocksdb/db.pxd @@ -4,6 +4,7 @@ from .status cimport Status from libcpp cimport bool as cpp_bool from libcpp.string cimport string from libcpp.vector cimport vector +from .types cimport SequenceNumber from .slice_ cimport Slice from .snapshot cimport Snapshot from .iterator cimport Iterator @@ -39,7 +40,6 @@ cdef extern from "cpp/write_batch_iter_helper.hpp" namespace "py_rocks": cdef extern from "rocksdb/db.h" namespace "rocksdb": - ctypedef uint64_t SequenceNumber string kDefaultColumnFamilyName cdef struct LiveFileMetaData: diff --git a/rocksdb/types.pxd b/rocksdb/types.pxd new file mode 100644 index 0000000..b8c9ca9 --- /dev/null +++ b/rocksdb/types.pxd @@ -0,0 +1,28 @@ +from libc.stdint cimport uint64_t, uint32_t +from .slice_ cimport Slice +from libcpp.string cimport string +from libcpp cimport bool as cpp_bool + +cdef extern from "rocksdb/types.h" namespace "rocksdb": + ctypedef uint64_t SequenceNumber + + cdef enum EntryType: + kEntryPut + kEntryDelete + kEntrySingleDelete + kEntryMerge + kEntryRangeDeletion + kEntryBlobIndex + kEntryOther + + cdef cppclass FullKey: + Slice user_key + SequenceNumber sequence + EntryType type + + FullKey() except+ + FullKey(const Slice&, const SequenceNumber&, EntryType) except+ + string DebugString(cpp_bool hex) nogil except+ + void clear() nogil except+ + + cpp_bool ParseFullKey(const Slice&, FullKey*) -- GitLab