PyCyBase 0.1.8.post4__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cbase/__infra__.pxd +6 -0
- cbase/__init__.pxd +6 -0
- cbase/__init__.py +28 -0
- cbase/allocator_protocol/__infra__.pxd +58 -0
- cbase/allocator_protocol/__init__.pxd +58 -0
- cbase/allocator_protocol/__init__.py +45 -0
- cbase/allocator_protocol/c_allocator_protocol.c +31818 -0
- cbase/allocator_protocol/c_allocator_protocol.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_allocator_protocol.h +352 -0
- cbase/allocator_protocol/c_allocator_protocol.pxd +64 -0
- cbase/allocator_protocol/c_allocator_protocol.pyi +144 -0
- cbase/allocator_protocol/c_allocator_protocol.pyx +209 -0
- cbase/allocator_protocol/c_heap_allocator.c +38144 -0
- cbase/allocator_protocol/c_heap_allocator.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_heap_allocator.h +444 -0
- cbase/allocator_protocol/c_heap_allocator.pxd +97 -0
- cbase/allocator_protocol/c_heap_allocator.pyi +161 -0
- cbase/allocator_protocol/c_heap_allocator.pyx +300 -0
- cbase/allocator_protocol/c_nt_shm_allocator.c +33399 -0
- cbase/allocator_protocol/c_nt_shm_allocator.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_nt_shm_allocator.h +996 -0
- cbase/allocator_protocol/c_nt_shm_allocator.pxd +102 -0
- cbase/allocator_protocol/c_nt_shm_allocator.pyx +223 -0
- cbase/allocator_protocol/c_shm_allocator.h +1168 -0
- cbase/allocator_protocol/c_shm_allocator.pxd +142 -0
- cbase/allocator_protocol/c_shm_allocator.pyi +299 -0
- cbase/allocator_protocol/c_shm_allocator.pyx +442 -0
- cbase/allocator_protocol/c_shm_comp.c +4643 -0
- cbase/allocator_protocol/c_shm_comp.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_shm_comp.h +49 -0
- cbase/allocator_protocol/c_shm_comp.pxd +38 -0
- cbase/allocator_protocol/c_shm_comp.pyx +1 -0
- cbase/backports/__infra__.pxd +17 -0
- cbase/backports/__init__.pxd +17 -0
- cbase/backports/__init__.py +9 -0
- cbase/backports/pydict.h +55 -0
- cbase/backports/pydict.pxd +5 -0
- cbase/backports/pylong.c +9946 -0
- cbase/backports/pylong.cp313-win_amd64.pyd +0 -0
- cbase/backports/pylong.h +79 -0
- cbase/backports/pylong.pxd +23 -0
- cbase/backports/pylong.pyx +61 -0
- cbase/bytemap/__infra__.pxd +42 -0
- cbase/bytemap/__init__.pxd +42 -0
- cbase/bytemap/__init__.py +21 -0
- cbase/bytemap/c_bytemap.c +52076 -0
- cbase/bytemap/c_bytemap.cp313-win_amd64.pyd +0 -0
- cbase/bytemap/c_bytemap.h +867 -0
- cbase/bytemap/c_bytemap.pxd +370 -0
- cbase/bytemap/c_bytemap.pyx +1758 -0
- cbase/bytemap/xxh3.h +55 -0
- cbase/bytemap/xxhash.c +42 -0
- cbase/bytemap/xxhash.h +7487 -0
- cbase/env.c +11109 -0
- cbase/env.cp313-win_amd64.pyd +0 -0
- cbase/env.pxd +8 -0
- cbase/env.pyi +48 -0
- cbase/env.pyx +46 -0
- cbase/includes/cbase/allocator_protocol/c_allocator_protocol.c +31818 -0
- cbase/includes/cbase/allocator_protocol/c_allocator_protocol.h +352 -0
- cbase/includes/cbase/allocator_protocol/c_heap_allocator.c +38144 -0
- cbase/includes/cbase/allocator_protocol/c_heap_allocator.h +444 -0
- cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.c +33399 -0
- cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.h +996 -0
- cbase/includes/cbase/allocator_protocol/c_shm_allocator.h +1168 -0
- cbase/includes/cbase/allocator_protocol/c_shm_comp.c +4643 -0
- cbase/includes/cbase/allocator_protocol/c_shm_comp.h +49 -0
- cbase/includes/cbase/backports/pydict.h +55 -0
- cbase/includes/cbase/backports/pylong.c +9946 -0
- cbase/includes/cbase/backports/pylong.h +79 -0
- cbase/includes/cbase/bytemap/c_bytemap.c +52076 -0
- cbase/includes/cbase/bytemap/c_bytemap.h +867 -0
- cbase/includes/cbase/bytemap/xxh3.h +55 -0
- cbase/includes/cbase/bytemap/xxhash.c +42 -0
- cbase/includes/cbase/bytemap/xxhash.h +7487 -0
- cbase/includes/cbase/env.c +11109 -0
- cbase/includes/cbase/int128.h +81 -0
- cbase/includes/cbase/intern_string/c_intern_string.c +28081 -0
- cbase/includes/cbase/intern_string/c_intern_string.h +614 -0
- cbase/includes/cbase/nt/pthread_nt_compat.h +102 -0
- cbase/includes/cbase/nt/regex_nt_compat.h +133 -0
- cbase/includes/cbase/nt/time_sched_nt_compat.h +32 -0
- cbase/int128.h +81 -0
- cbase/int128.pxd +15 -0
- cbase/intern_string/BENCHMARK.md +157 -0
- cbase/intern_string/__infra__.pxd +11 -0
- cbase/intern_string/__init__.pxd +11 -0
- cbase/intern_string/__init__.py +19 -0
- cbase/intern_string/c_intern_string.c +28081 -0
- cbase/intern_string/c_intern_string.cp313-win_amd64.pyd +0 -0
- cbase/intern_string/c_intern_string.h +614 -0
- cbase/intern_string/c_intern_string.pxd +118 -0
- cbase/intern_string/c_intern_string.pyi +376 -0
- cbase/intern_string/c_intern_string.pyx +765 -0
- cbase/nt/pthread_nt_compat.h +102 -0
- cbase/nt/regex_nt_compat.h +133 -0
- cbase/nt/time_sched_nt_compat.h +32 -0
- pycybase-0.1.8.post4.dist-info/METADATA +180 -0
- pycybase-0.1.8.post4.dist-info/RECORD +101 -0
- pycybase-0.1.8.post4.dist-info/WHEEL +5 -0
- pycybase-0.1.8.post4.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
from cpython.object cimport PyObject
|
|
2
|
+
from libc.stdint cimport uint64_t, uintptr_t
|
|
3
|
+
from libcpp cimport bool as c_bool
|
|
4
|
+
|
|
5
|
+
from cbase.allocator_protocol.c_allocator_protocol cimport allocator_protocol
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
cdef extern from "cbase/bytemap/xxh3.h":
|
|
9
|
+
uint64_t XXH3_64bits(const void* input, size_t length) noexcept nogil
|
|
10
|
+
uint64_t XXH3_64bits_withSeed(const void* input, size_t length, uint64_t seed) noexcept nogil
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
cdef extern from "Python.h":
|
|
14
|
+
PyObject* PyDict_GetItem(PyObject* p, PyObject* key)
|
|
15
|
+
int PyDict_SetItem(PyObject* p, PyObject* key, PyObject* val)
|
|
16
|
+
int PyDict_DelItem(PyObject* p, PyObject* key)
|
|
17
|
+
void PyDict_Clear(PyObject* p)
|
|
18
|
+
int PyDict_SetItemString(PyObject* p, const char* key, PyObject* val)
|
|
19
|
+
PyObject* PyDict_GetItemString(PyObject* p, const char* key)
|
|
20
|
+
PyObject* PyFloat_FromDouble(double v)
|
|
21
|
+
void PyErr_Clear()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
cdef extern from "cbase/bytemap/c_bytemap.h":
|
|
25
|
+
const size_t MIN_BYTEMAP_CAPACITY
|
|
26
|
+
const size_t DEFAULT_BYTEMAP_CAPACITY
|
|
27
|
+
const size_t BYTEMAP_GROWTH_FACTOR
|
|
28
|
+
const size_t MAX_BYTEMAP_CAPACITY
|
|
29
|
+
const uint64_t BYTEMAP_SALT_MAGIC
|
|
30
|
+
|
|
31
|
+
ctypedef struct bytemap_entry:
|
|
32
|
+
uint64_t hash
|
|
33
|
+
size_t key_length
|
|
34
|
+
const char* key
|
|
35
|
+
size_t value_length
|
|
36
|
+
c_bool occupied
|
|
37
|
+
c_bool removed
|
|
38
|
+
bytemap_entry* prev
|
|
39
|
+
bytemap_entry* next
|
|
40
|
+
char value[]
|
|
41
|
+
|
|
42
|
+
ctypedef bytemap_entry bytemap_entry_ex
|
|
43
|
+
|
|
44
|
+
ctypedef enum bytemap_callback_event:
|
|
45
|
+
BYTEMAP_CALLBACK_EVENT_MODIFIED
|
|
46
|
+
BYTEMAP_CALLBACK_EVENT_ADDED
|
|
47
|
+
BYTEMAP_CALLBACK_EVENT_POPPED
|
|
48
|
+
BYTEMAP_CALLBACK_EVENT_CLEARED
|
|
49
|
+
BYTEMAP_CALLBACK_EVENT_REHASH
|
|
50
|
+
BYTEMAP_CALLBACK_EVENT_FREED
|
|
51
|
+
|
|
52
|
+
ctypedef void (*bytemap_callback_func)(bytemap_callback_event event, const char* key, size_t key_len, const char* value, size_t value_len, uint64_t seq_id, void* user_data) noexcept
|
|
53
|
+
|
|
54
|
+
ctypedef bytemap_callback_func bytemap_ex_callback_func
|
|
55
|
+
|
|
56
|
+
ctypedef struct bytemap_callback_ctx:
|
|
57
|
+
bytemap_callback_func fn
|
|
58
|
+
void* user_data
|
|
59
|
+
uintptr_t id
|
|
60
|
+
bytemap_callback_ctx* next
|
|
61
|
+
|
|
62
|
+
ctypedef bytemap_callback_ctx bytemap_ex_callback_ctx
|
|
63
|
+
|
|
64
|
+
ctypedef struct bytemap:
|
|
65
|
+
bytemap_entry* table
|
|
66
|
+
bytemap_entry* first
|
|
67
|
+
bytemap_entry* last
|
|
68
|
+
bytemap_callback_ctx* callbacks
|
|
69
|
+
size_t capacity
|
|
70
|
+
size_t size
|
|
71
|
+
size_t occupied
|
|
72
|
+
uint64_t salt
|
|
73
|
+
size_t slot_capacity
|
|
74
|
+
size_t entry_size
|
|
75
|
+
void* table_end
|
|
76
|
+
|
|
77
|
+
ctypedef bytemap bytemap_ex
|
|
78
|
+
|
|
79
|
+
ctypedef enum bytemap_ret_code:
|
|
80
|
+
BYTEMAP_OK
|
|
81
|
+
BYTEMAP_ERR_INVALID_BUF
|
|
82
|
+
BYTEMAP_ERR_INVALID_KEY
|
|
83
|
+
BYTEMAP_ERR_INVALID_VALUE
|
|
84
|
+
BYTEMAP_ERR_NOT_FOUND
|
|
85
|
+
BYTEMAP_ERR_FULL
|
|
86
|
+
BYTEMAP_ERR_EMPTY
|
|
87
|
+
BYTEMAP_ERR_OOM
|
|
88
|
+
|
|
89
|
+
int c_bytemap_hash(const bytemap* bmap, const char* key, size_t key_len, uint64_t* out) noexcept nogil
|
|
90
|
+
const char* c_bytemap_clone_key(const bytemap* bmap, const char* key, size_t key_len) noexcept nogil
|
|
91
|
+
void c_bytemap_free_key(const bytemap* bmap, char* key) noexcept nogil
|
|
92
|
+
uint64_t c_bytemap_gen_seq_id(const void* ptr) noexcept nogil
|
|
93
|
+
bytemap_entry* c_bytemap_entry_at(const bytemap* bmap, size_t idx) noexcept nogil
|
|
94
|
+
bytemap_entry* c_bytemap_entry_next(const bytemap* bmap, bytemap_entry* entry) noexcept nogil
|
|
95
|
+
bytemap_entry* c_bytemap_entry_first(const bytemap* bmap) noexcept nogil
|
|
96
|
+
void c_bytemap_invoke_callbacks(bytemap_callback_event event, const bytemap* bmap, const char* key, size_t key_len, const char* value, size_t value_len, uint64_t seq_id) noexcept nogil
|
|
97
|
+
|
|
98
|
+
int c_bytemap_ex_init(bytemap* bmap, size_t capacity, size_t slot_capacity, allocator_protocol* allocator) noexcept nogil
|
|
99
|
+
void c_bytemap_ex_dealloc(bytemap* bmap) noexcept nogil
|
|
100
|
+
bytemap* c_bytemap_ex_new(size_t capacity, size_t slot_capacity, allocator_protocol* allocator) noexcept nogil
|
|
101
|
+
void c_bytemap_ex_clear(bytemap* bmap) noexcept nogil
|
|
102
|
+
void c_bytemap_ex_free(bytemap* bmap) noexcept nogil
|
|
103
|
+
int c_bytemap_ex_register_callback(bytemap* bmap, bytemap_callback_func callback, void* user_data, uintptr_t* out_id) noexcept nogil
|
|
104
|
+
int c_bytemap_ex_unregister_callback(bytemap* bmap, uintptr_t callback_id) noexcept nogil
|
|
105
|
+
int c_bytemap_ex_get(const bytemap* bmap, const char* key, size_t key_len, char* out, size_t* out_len) noexcept nogil
|
|
106
|
+
int c_bytemap_ex_get_ptr(const bytemap* bmap, const char* key, size_t key_len, char** out, size_t* out_len) noexcept nogil
|
|
107
|
+
int c_bytemap_ex_contains(const bytemap* bmap, const char* key, size_t key_len) noexcept nogil
|
|
108
|
+
int c_bytemap_ex_rehash(bytemap* bmap, size_t new_capacity, uint64_t seq_id) noexcept nogil
|
|
109
|
+
int c_bytemap_ex_set(bytemap* bmap, const char* key, size_t key_len, const char* value, size_t value_len, uint64_t seq_id, bytemap_entry** out) noexcept nogil
|
|
110
|
+
int c_bytemap_ex_pop(bytemap* bmap, const char* key, size_t key_len, uint64_t seq_id, char* out, size_t* out_len) noexcept nogil
|
|
111
|
+
int c_bytemap_ex_pop_ptr(bytemap* bmap, const char* key, size_t key_len, uint64_t seq_id, char** out, size_t* out_len) noexcept nogil
|
|
112
|
+
size_t c_bytemap_ex_len(const bytemap* bmap) noexcept nogil
|
|
113
|
+
bytemap* c_bytemap_ex_clone(const bytemap* src, allocator_protocol* allocator) noexcept nogil
|
|
114
|
+
|
|
115
|
+
int c_bytemap_ex_set_double(bytemap* bmap, const char* key, size_t key_len, double value, uint64_t seq_id) noexcept nogil
|
|
116
|
+
int c_bytemap_ex_get_double(const bytemap* bmap, const char* key, size_t key_len, double* out) noexcept nogil
|
|
117
|
+
int c_bytemap_ex_pop_double(bytemap* bmap, const char* key, size_t key_len, uint64_t seq_id, double* out) noexcept nogil
|
|
118
|
+
|
|
119
|
+
bytemap* c_bytemap_new(size_t capacity, allocator_protocol* allocator) noexcept nogil
|
|
120
|
+
void c_bytemap_clear(bytemap* bmap) noexcept nogil
|
|
121
|
+
void c_bytemap_free(bytemap* bmap) noexcept nogil
|
|
122
|
+
int c_bytemap_register_callback(bytemap* bmap, bytemap_callback_func callback, void* user_data, uintptr_t* out_id) noexcept nogil
|
|
123
|
+
int c_bytemap_unregister_callback(bytemap* bmap, uintptr_t callback_id) noexcept nogil
|
|
124
|
+
int c_bytemap_get(const bytemap* bmap, const char* key, size_t key_len, void** out) noexcept nogil
|
|
125
|
+
int c_bytemap_contains(const bytemap* bmap, const char* key, size_t key_len) noexcept nogil
|
|
126
|
+
int c_bytemap_rehash(bytemap* bmap, size_t new_capacity) noexcept nogil
|
|
127
|
+
int c_bytemap_set(bytemap* bmap, const char* key, size_t key_len, void* value, bytemap_entry** out) noexcept nogil
|
|
128
|
+
int c_bytemap_pop(bytemap* bmap, const char* key, size_t key_len, void** out) noexcept nogil
|
|
129
|
+
size_t c_bytemap_len(const bytemap* bmap) noexcept nogil
|
|
130
|
+
bytemap* c_bytemap_clone(const bytemap* src, allocator_protocol* allocator) noexcept nogil
|
|
131
|
+
bytemap_entry* c_bytemap_first(const bytemap* bmap) noexcept nogil
|
|
132
|
+
bytemap_entry* c_bytemap_last(const bytemap* bmap) noexcept nogil
|
|
133
|
+
bytemap_entry* c_bytemap_next(const bytemap_entry* entry) noexcept nogil
|
|
134
|
+
bytemap_entry* c_bytemap_prev(const bytemap_entry* entry) noexcept nogil
|
|
135
|
+
void* c_bytemap_entry_value(const bytemap_entry* entry) noexcept nogil
|
|
136
|
+
void* c_bytemap_entry_value_as_ptr(const bytemap_entry* entry) noexcept nogil
|
|
137
|
+
uintptr_t c_bytemap_entry_value_as_uintptr(const bytemap_entry* entry) noexcept nogil
|
|
138
|
+
double c_bytemap_entry_value_as_double(const bytemap_entry* entry) noexcept nogil
|
|
139
|
+
|
|
140
|
+
void c_bytemap_entry_value_from_ptr(bytemap_entry* entry, const void* ptr) noexcept nogil
|
|
141
|
+
void c_bytemap_entry_value_from_uintptr(bytemap_entry* entry, uintptr_t val) noexcept nogil
|
|
142
|
+
void c_bytemap_entry_value_from_double(bytemap_entry* entry, double val) noexcept nogil
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
cdef object NO_DEFAULT
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# ============================================================
|
|
149
|
+
# _ByteMapBase — common base for all ByteMap variants
|
|
150
|
+
# ============================================================
|
|
151
|
+
|
|
152
|
+
cdef class _ByteMapBase:
|
|
153
|
+
cdef bytemap* header
|
|
154
|
+
cdef bint owner
|
|
155
|
+
cdef uint64_t seq_id
|
|
156
|
+
|
|
157
|
+
cdef void _init_header(self, size_t slot_capacity, size_t init_capacity)
|
|
158
|
+
|
|
159
|
+
cdef void c_clear(self)
|
|
160
|
+
|
|
161
|
+
cdef void c_rehash(self, size_t new_capacity)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# ============================================================
|
|
165
|
+
# ByteMapEx — str → bytes mapping
|
|
166
|
+
# ============================================================
|
|
167
|
+
|
|
168
|
+
cdef class ByteMapEx(_ByteMapBase):
|
|
169
|
+
@staticmethod
|
|
170
|
+
cdef inline ByteMapEx c_from_header(bytemap* header, bint owner)
|
|
171
|
+
|
|
172
|
+
@staticmethod
|
|
173
|
+
cdef inline const char* c_key_to_string(str key, size_t* key_len)
|
|
174
|
+
|
|
175
|
+
@staticmethod
|
|
176
|
+
cdef inline const char* c_value_to_string(bytes value, size_t* value_len)
|
|
177
|
+
|
|
178
|
+
cdef bytes c_get(self, str key)
|
|
179
|
+
|
|
180
|
+
cdef void c_set(self, str key, bytes value)
|
|
181
|
+
|
|
182
|
+
cdef bytes c_pop(self, str key)
|
|
183
|
+
|
|
184
|
+
cdef bint c_contains(self, str key)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# ============================================================
|
|
188
|
+
# ByteMapExDouble — str → double mapping
|
|
189
|
+
# ============================================================
|
|
190
|
+
|
|
191
|
+
cdef class ByteMapExDouble(_ByteMapBase):
|
|
192
|
+
cdef double c_get_double(self, str key)
|
|
193
|
+
|
|
194
|
+
cdef void c_set_double(self, str key, double value)
|
|
195
|
+
|
|
196
|
+
cdef double c_pop_double(self, str key)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
# ============================================================
|
|
200
|
+
# ByteMap — str/bytes → PyObject* mapping (void* variant)
|
|
201
|
+
# ============================================================
|
|
202
|
+
|
|
203
|
+
cdef class ByteMap(_ByteMapBase):
|
|
204
|
+
@staticmethod
|
|
205
|
+
cdef inline ByteMap c_from_header(bytemap* header, bint owner)
|
|
206
|
+
|
|
207
|
+
cdef inline void* c_get_ptr(self, const char* key_ptr)
|
|
208
|
+
|
|
209
|
+
cdef inline void* c_get_bytes(self, bytes key_bytes)
|
|
210
|
+
|
|
211
|
+
cdef inline void* c_get_str(self, str key_str)
|
|
212
|
+
|
|
213
|
+
cdef inline void c_set_ptr(self, const char* key_ptr, void* value)
|
|
214
|
+
|
|
215
|
+
cdef inline void c_set_bytes(self, bytes key_bytes, void* value)
|
|
216
|
+
|
|
217
|
+
cdef inline void c_set_str(self, str key_str, void* value)
|
|
218
|
+
|
|
219
|
+
cdef inline void c_pop_ptr(self, const char* key_ptr, void** out)
|
|
220
|
+
|
|
221
|
+
cdef inline void c_pop_bytes(self, bytes key_bytes, void** out)
|
|
222
|
+
|
|
223
|
+
cdef inline void c_pop_str(self, str key_str, void** out)
|
|
224
|
+
|
|
225
|
+
cdef inline bint c_contains_ptr(self, const char* key_ptr)
|
|
226
|
+
|
|
227
|
+
cdef inline bint c_contains_bytes(self, bytes key_bytes)
|
|
228
|
+
|
|
229
|
+
cdef inline bint c_contains_str(self, str key_str)
|
|
230
|
+
|
|
231
|
+
cpdef uint64_t hash(self, object key)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# ============================================================
|
|
235
|
+
# _BoundByteMapBase — common base for all bound dict variants
|
|
236
|
+
# ============================================================
|
|
237
|
+
|
|
238
|
+
cdef class _BoundByteMapBase(dict):
|
|
239
|
+
cdef bytemap* header
|
|
240
|
+
cdef bint owner
|
|
241
|
+
cdef uint64_t seq_id
|
|
242
|
+
cdef uintptr_t callback_id
|
|
243
|
+
|
|
244
|
+
@staticmethod
|
|
245
|
+
cdef void c_sync(bytemap_callback_event event, const char* key, size_t key_len, const char* value, size_t value_len, uint64_t seq_id, void* user_data) noexcept
|
|
246
|
+
|
|
247
|
+
cdef void _init_bound_header(self, size_t slot_capacity)
|
|
248
|
+
|
|
249
|
+
cdef void c_bind(self, bytemap* header)
|
|
250
|
+
|
|
251
|
+
cdef void c_rebind(self, bytemap* header)
|
|
252
|
+
|
|
253
|
+
cdef const char* c_serialize_key(self, object obj, size_t* key_len)
|
|
254
|
+
|
|
255
|
+
cdef object c_deserialize_key(self, const char* key, size_t key_len)
|
|
256
|
+
|
|
257
|
+
cdef const char* c_serialize_value(self, object obj, size_t* value_len)
|
|
258
|
+
|
|
259
|
+
cdef object c_deserialize_value(self, const char* value, size_t value_len)
|
|
260
|
+
|
|
261
|
+
cdef void c_sync_key(self, object py_key, const char* c_key, size_t c_key_len)
|
|
262
|
+
|
|
263
|
+
cdef void c_set(self, object py_key, object py_value)
|
|
264
|
+
|
|
265
|
+
cdef object c_pop(self, object py_key, object default=?)
|
|
266
|
+
|
|
267
|
+
cdef void c_update(self, dict payload)
|
|
268
|
+
|
|
269
|
+
cdef void c_clear(self)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# ============================================================
|
|
273
|
+
# BoundByteMapEx — synchronized dict (str → bytes)
|
|
274
|
+
# ============================================================
|
|
275
|
+
|
|
276
|
+
cdef class BoundByteMapEx(_BoundByteMapBase):
|
|
277
|
+
@staticmethod
|
|
278
|
+
cdef BoundByteMapEx c_from_header(bytemap* header, bint owner=?)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
# ============================================================
|
|
282
|
+
# BoundByteMapExDouble — synchronized dict (str → double)
|
|
283
|
+
# ============================================================
|
|
284
|
+
|
|
285
|
+
cdef class BoundByteMapExDouble(_BoundByteMapBase):
|
|
286
|
+
cdef double ws
|
|
287
|
+
|
|
288
|
+
@staticmethod
|
|
289
|
+
cdef BoundByteMapExDouble c_from_header(bytemap* header, bint owner=?)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# ============================================================
|
|
293
|
+
# BoundByteMap — synchronized dict (str/bytes → PyObject*)
|
|
294
|
+
# ============================================================
|
|
295
|
+
|
|
296
|
+
cdef class BoundByteMap(_BoundByteMapBase):
|
|
297
|
+
cdef void* _ws_ptr
|
|
298
|
+
|
|
299
|
+
@staticmethod
|
|
300
|
+
cdef BoundByteMap c_from_header(bytemap* header, bint owner=?)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
# ============================================================
|
|
304
|
+
# BoundByteSet — synchronized set backed by bytemap
|
|
305
|
+
# ============================================================
|
|
306
|
+
|
|
307
|
+
cdef class BoundByteSet(set):
|
|
308
|
+
cdef bytemap* header
|
|
309
|
+
cdef bint owner
|
|
310
|
+
cdef uint64_t seq_id
|
|
311
|
+
cdef uintptr_t callback_id
|
|
312
|
+
|
|
313
|
+
@staticmethod
|
|
314
|
+
cdef BoundByteSet c_from_header(bytemap* header, bint owner=?)
|
|
315
|
+
|
|
316
|
+
@staticmethod
|
|
317
|
+
cdef void c_sync(bytemap_callback_event event, const char* key, size_t key_len, const char* value, size_t value_len, uint64_t seq_id, void* user_data) noexcept
|
|
318
|
+
|
|
319
|
+
cdef void c_bind(self, bytemap* header)
|
|
320
|
+
|
|
321
|
+
cdef void c_rebind(self, bytemap* header)
|
|
322
|
+
|
|
323
|
+
cdef const char* c_serialize_key(self, object obj, size_t* key_len)
|
|
324
|
+
|
|
325
|
+
cdef object c_deserialize_key(self, const char* key, size_t key_len)
|
|
326
|
+
|
|
327
|
+
cdef inline void c_sync_key(self, object py_key, const char* c_key, size_t c_key_len, bint added)
|
|
328
|
+
|
|
329
|
+
cdef void c_add(self, object py_key)
|
|
330
|
+
|
|
331
|
+
cdef object c_discard(self, object py_key)
|
|
332
|
+
|
|
333
|
+
cdef void c_update(self, set payload)
|
|
334
|
+
|
|
335
|
+
cdef void c_clear(self)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
# ============================================================
|
|
339
|
+
# ByteMapPerformanceTestToolkit
|
|
340
|
+
# ============================================================
|
|
341
|
+
|
|
342
|
+
cdef class ByteMapPerformanceTestToolkit:
|
|
343
|
+
cdef PyObject** payloads
|
|
344
|
+
cdef const char** keys
|
|
345
|
+
cdef readonly size_t n_iters
|
|
346
|
+
cdef readonly size_t n_payloads
|
|
347
|
+
cdef readonly list py_keys
|
|
348
|
+
cdef readonly list py_payloads
|
|
349
|
+
cdef bytemap* c_map
|
|
350
|
+
cdef dict py_map
|
|
351
|
+
cdef uintptr_t c_checksum
|
|
352
|
+
cdef uintptr_t py_checksum
|
|
353
|
+
|
|
354
|
+
cdef inline void c_gen_keys(self)
|
|
355
|
+
|
|
356
|
+
cdef inline void c_gen_payloads(self)
|
|
357
|
+
|
|
358
|
+
cdef inline void c_prepare_py_map(self)
|
|
359
|
+
|
|
360
|
+
cdef inline void c_prepare_c_map(self)
|
|
361
|
+
|
|
362
|
+
cpdef double c_map_set_routine(self)
|
|
363
|
+
|
|
364
|
+
cpdef double py_map_set_routine(self)
|
|
365
|
+
|
|
366
|
+
cpdef double c_map_get_routine(self)
|
|
367
|
+
|
|
368
|
+
cpdef double py_map_get_routine(self)
|
|
369
|
+
|
|
370
|
+
cpdef dict run_test(self)
|