Skip to content

Commit

Permalink
Add types.pxd to make types available to all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mharshe committed Nov 15, 2021
1 parent a5c23fa commit 6716ac2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rocksdb/db.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from libcpp.vector cimport vector
from libcpp.map cimport map
from libcpp.unordered_map cimport unordered_map
from libcpp.memory cimport shared_ptr
from .types cimport SequenceNumber
from .slice_ cimport Slice
from .snapshot cimport Snapshot
from .iterator cimport Iterator
Expand Down Expand Up @@ -46,7 +47,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

# todo TableProperties
Expand Down
6 changes: 1 addition & 5 deletions rocksdb/metadata.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ from libcpp cimport bool as cpp_bool
from libcpp.string cimport string
from libcpp.vector cimport vector
from libc.stdint cimport uint64_t
from libc.stdint cimport uint32_t
from libc.stdint cimport int64_t
from libc.stdint cimport int32_t
from .logger cimport Logger
from .slice_ cimport Slice
from .snapshot cimport Snapshot
from .db cimport SequenceNumber
from .types cimport SequenceNumber

cdef extern from "rocksdb/metadata.h" namespace "rocksdb":
cdef cppclass ColumnFamilyMetaData:
Expand Down
2 changes: 1 addition & 1 deletion rocksdb/options.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ from . cimport advanced_options
from .advanced_options cimport CompressionOptions
from .advanced_options cimport AdvancedColumnFamilyOptions
from .env cimport Env
from .db cimport SequenceNumber
from .types cimport SequenceNumber

cdef extern from "rocksdb/options.h" namespace "rocksdb":
ctypedef enum CompressionType:
Expand Down
28 changes: 28 additions & 0 deletions rocksdb/types.pxd
Original file line number Diff line number Diff line change
@@ -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*)

0 comments on commit 6716ac2

Please sign in to comment.