zlmdb 25.10.1__cp313-cp313-manylinux_2_34_x86_64.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.

Potentially problematic release.


This version of zlmdb might be problematic. Click here for more details.

Files changed (87) hide show
  1. flatbuffers/__init__.py +19 -0
  2. flatbuffers/_version.py +17 -0
  3. flatbuffers/builder.py +776 -0
  4. flatbuffers/compat.py +86 -0
  5. flatbuffers/encode.py +42 -0
  6. flatbuffers/flexbuffers.py +1527 -0
  7. flatbuffers/number_types.py +181 -0
  8. flatbuffers/packer.py +42 -0
  9. flatbuffers/reflection/AdvancedFeatures.py +10 -0
  10. flatbuffers/reflection/BaseType.py +24 -0
  11. flatbuffers/reflection/Enum.py +169 -0
  12. flatbuffers/reflection/EnumVal.py +96 -0
  13. flatbuffers/reflection/Field.py +208 -0
  14. flatbuffers/reflection/KeyValue.py +56 -0
  15. flatbuffers/reflection/Object.py +175 -0
  16. flatbuffers/reflection/RPCCall.py +131 -0
  17. flatbuffers/reflection/Schema.py +206 -0
  18. flatbuffers/reflection/SchemaFile.py +77 -0
  19. flatbuffers/reflection/Service.py +145 -0
  20. flatbuffers/reflection/Type.py +98 -0
  21. flatbuffers/reflection/__init__.py +0 -0
  22. flatbuffers/table.py +129 -0
  23. flatbuffers/util.py +43 -0
  24. zlmdb/__init__.py +312 -0
  25. zlmdb/_database.py +990 -0
  26. zlmdb/_errors.py +31 -0
  27. zlmdb/_meta.py +27 -0
  28. zlmdb/_pmap.py +1667 -0
  29. zlmdb/_schema.py +137 -0
  30. zlmdb/_transaction.py +181 -0
  31. zlmdb/_types.py +1596 -0
  32. zlmdb/_version.py +27 -0
  33. zlmdb/cli.py +41 -0
  34. zlmdb/flatbuffers/__init__.py +5 -0
  35. zlmdb/flatbuffers/reflection/AdvancedFeatures.py +10 -0
  36. zlmdb/flatbuffers/reflection/BaseType.py +25 -0
  37. zlmdb/flatbuffers/reflection/Enum.py +252 -0
  38. zlmdb/flatbuffers/reflection/EnumVal.py +144 -0
  39. zlmdb/flatbuffers/reflection/Field.py +325 -0
  40. zlmdb/flatbuffers/reflection/KeyValue.py +84 -0
  41. zlmdb/flatbuffers/reflection/Object.py +260 -0
  42. zlmdb/flatbuffers/reflection/RPCCall.py +195 -0
  43. zlmdb/flatbuffers/reflection/Schema.py +301 -0
  44. zlmdb/flatbuffers/reflection/SchemaFile.py +112 -0
  45. zlmdb/flatbuffers/reflection/Service.py +213 -0
  46. zlmdb/flatbuffers/reflection/Type.py +148 -0
  47. zlmdb/flatbuffers/reflection/__init__.py +0 -0
  48. zlmdb/flatbuffers/reflection.fbs +152 -0
  49. zlmdb/lmdb/__init__.py +37 -0
  50. zlmdb/lmdb/__main__.py +25 -0
  51. zlmdb/lmdb/_config.py +10 -0
  52. zlmdb/lmdb/_lmdb_cffi.cpython-313-x86_64-linux-gnu.so +0 -0
  53. zlmdb/lmdb/cffi.py +2606 -0
  54. zlmdb/lmdb/tool.py +670 -0
  55. zlmdb/tests/lmdb/__init__.py +0 -0
  56. zlmdb/tests/lmdb/address_book.py +287 -0
  57. zlmdb/tests/lmdb/crash_test.py +339 -0
  58. zlmdb/tests/lmdb/cursor_test.py +333 -0
  59. zlmdb/tests/lmdb/env_test.py +919 -0
  60. zlmdb/tests/lmdb/getmulti_test.py +92 -0
  61. zlmdb/tests/lmdb/iteration_test.py +258 -0
  62. zlmdb/tests/lmdb/package_test.py +70 -0
  63. zlmdb/tests/lmdb/test_lmdb.py +188 -0
  64. zlmdb/tests/lmdb/testlib.py +185 -0
  65. zlmdb/tests/lmdb/tool_test.py +60 -0
  66. zlmdb/tests/lmdb/txn_test.py +575 -0
  67. zlmdb/tests/orm/MNodeLog.py +853 -0
  68. zlmdb/tests/orm/__init__.py +0 -0
  69. zlmdb/tests/orm/_schema_fbs.py +215 -0
  70. zlmdb/tests/orm/_schema_mnode_log.py +1201 -0
  71. zlmdb/tests/orm/_schema_py2.py +250 -0
  72. zlmdb/tests/orm/_schema_py3.py +307 -0
  73. zlmdb/tests/orm/_test_flatbuffers.py +144 -0
  74. zlmdb/tests/orm/_test_serialization.py +144 -0
  75. zlmdb/tests/orm/test_basic.py +217 -0
  76. zlmdb/tests/orm/test_etcd.py +275 -0
  77. zlmdb/tests/orm/test_pmap_indexes.py +466 -0
  78. zlmdb/tests/orm/test_pmap_types.py +90 -0
  79. zlmdb/tests/orm/test_pmaps.py +295 -0
  80. zlmdb/tests/orm/test_select.py +619 -0
  81. zlmdb-25.10.1.dist-info/METADATA +264 -0
  82. zlmdb-25.10.1.dist-info/RECORD +87 -0
  83. zlmdb-25.10.1.dist-info/WHEEL +5 -0
  84. zlmdb-25.10.1.dist-info/entry_points.txt +2 -0
  85. zlmdb-25.10.1.dist-info/licenses/LICENSE +137 -0
  86. zlmdb-25.10.1.dist-info/licenses/NOTICE +41 -0
  87. zlmdb-25.10.1.dist-info/top_level.txt +2 -0
flatbuffers/util.py ADDED
@@ -0,0 +1,43 @@
1
+ # Copyright 2017 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from . import encode
16
+ from . import number_types
17
+ from . import packer
18
+
19
+ def GetSizePrefix(buf, offset):
20
+ """Extract the size prefix from a buffer."""
21
+ return encode.Get(packer.int32, buf, offset)
22
+
23
+ def GetBufferIdentifier(buf, offset, size_prefixed=False):
24
+ """Extract the file_identifier from a buffer"""
25
+ if size_prefixed:
26
+ # increase offset by size of UOffsetTFlags
27
+ offset += number_types.UOffsetTFlags.bytewidth
28
+ # increase offset by size of root table pointer
29
+ offset += number_types.UOffsetTFlags.bytewidth
30
+ # end of FILE_IDENTIFIER
31
+ end = offset + encode.FILE_IDENTIFIER_LENGTH
32
+ return buf[offset:end]
33
+
34
+ def BufferHasIdentifier(buf, offset, file_identifier, size_prefixed=False):
35
+ got = GetBufferIdentifier(buf, offset, size_prefixed=size_prefixed)
36
+ return got == file_identifier
37
+
38
+ def RemoveSizePrefix(buf, offset):
39
+ """
40
+ Create a slice of a size-prefixed buffer that has
41
+ its position advanced just past the size prefix.
42
+ """
43
+ return buf, offset + number_types.Int32Flags.bytewidth
zlmdb/__init__.py ADDED
@@ -0,0 +1,312 @@
1
+ ###############################################################################
2
+ #
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) typedef int GmbH
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+ #
25
+ ###############################################################################
26
+ """ZLMDB - Object-relational zero-copy in-memory database layer for LMDB."""
27
+
28
+ import uuid
29
+
30
+ from typing import Dict # noqa
31
+
32
+ from ._version import __version__
33
+
34
+ from ._errors import NullValueConstraint
35
+
36
+ from ._pmap import (
37
+ PersistentMap,
38
+ MapSlotUuidUuid,
39
+ MapUuidString,
40
+ MapUuidOid,
41
+ MapUuidUuid,
42
+ MapUuidJson,
43
+ MapUuidCbor,
44
+ MapUuidPickle,
45
+ MapUuidFlatBuffers,
46
+ MapUuidTimestampFlatBuffers,
47
+ MapUuidBytes20Uint8FlatBuffers,
48
+ MapUuidBytes20Uint8UuidFlatBuffers,
49
+ MapUuidBytes20Bytes20Uint8UuidFlatBuffers,
50
+ MapUuidTimestampCbor,
51
+ MapTimestampFlatBuffers,
52
+ MapTimestampStringFlatBuffers,
53
+ MapTimestampUuidFlatBuffers,
54
+ MapTimestampUuidStringFlatBuffers,
55
+ MapUuidTimestampUuidFlatBuffers,
56
+ MapUint64TimestampUuid,
57
+ MapTimestampUuidCbor,
58
+ MapUuidTimestampUuid,
59
+ MapUuidStringUuid,
60
+ MapUuidUuidStringUuid,
61
+ MapUuidUuidUuidStringUuid,
62
+ MapUuidStringOid,
63
+ MapUuidUuidCbor,
64
+ MapUuidUuidSet,
65
+ MapUuidUuidUuid,
66
+ MapUuidUuidUuidUuid,
67
+ MapUuidUuidUuidUuidUuid,
68
+ MapUuidTimestampBytes32,
69
+ MapUuidUuidFlatBuffers,
70
+ MapUuidUuidStringFlatBuffers,
71
+ MapUuidStringFlatBuffers,
72
+ MapStringString,
73
+ MapStringOid,
74
+ MapStringOidOid,
75
+ MapStringUuid,
76
+ MapStringStringUuid,
77
+ MapStringStringStringUuid,
78
+ MapStringJson,
79
+ MapStringCbor,
80
+ MapStringPickle,
81
+ MapStringFlatBuffers,
82
+ MapStringTimestampCbor,
83
+ MapTimestampStringCbor,
84
+ MapOidString,
85
+ MapOidOid,
86
+ MapOidUuid,
87
+ MapOidJson,
88
+ MapOidCbor,
89
+ MapOidPickle,
90
+ MapOidFlatBuffers,
91
+ MapOidOidFlatBuffers,
92
+ MapOid3FlatBuffers,
93
+ MapOidOidSet,
94
+ MapOidStringOid,
95
+ MapOidOidOid,
96
+ MapOidTimestampOid,
97
+ MapOidTimestampFlatBuffers,
98
+ MapOidTimestampStringOid,
99
+ MapUint16UuidTimestampFlatBuffers,
100
+ MapBytes32Uuid,
101
+ MapBytes32Timestamp,
102
+ MapBytes32Bytes32,
103
+ MapBytes32FlatBuffers,
104
+ MapBytes32UuidFlatBuffers,
105
+ MapUuidBytes32FlatBuffers,
106
+ MapBytes32Bytes32FlatBuffers,
107
+ MapBytes32StringFlatBuffers,
108
+ MapTimestampBytes32FlatBuffers,
109
+ MapBytes20Uuid,
110
+ MapBytes20Bytes16,
111
+ MapBytes20Bytes20,
112
+ MapBytes20Bytes20Timestamp,
113
+ MapBytes20TimestampBytes20,
114
+ MapBytes20TimestampUuid,
115
+ MapBytes16FlatBuffers,
116
+ MapBytes16TimestampUuid,
117
+ MapBytes16TimestampUuidFlatBuffers,
118
+ MapBytes20FlatBuffers,
119
+ MapBytes20Bytes20FlatBuffers,
120
+ MapBytes20StringFlatBuffers,
121
+ )
122
+
123
+ from ._transaction import Transaction, TransactionStats
124
+ from ._database import Database
125
+ from ._schema import Schema
126
+
127
+ __all__ = (
128
+ "__version__",
129
+ "Schema",
130
+ "Database",
131
+ "Transaction",
132
+ "TransactionStats",
133
+ "MapSlotUuidUuid",
134
+ "table",
135
+ #
136
+ # Errors
137
+ #
138
+ "NullValueConstraint",
139
+ #
140
+ # UUID pmaps
141
+ #
142
+ # UUID (uint128) based pmap types for object containers
143
+ "MapUuidString",
144
+ "MapUuidOid",
145
+ "MapUuidJson",
146
+ "MapUuidCbor",
147
+ "MapUuidPickle",
148
+ "MapUuidFlatBuffers",
149
+ # UUID/Timestamp-combined pmap types for flatbuffers values
150
+ "MapUuidTimestampFlatBuffers",
151
+ "MapTimestampUuidFlatBuffers",
152
+ "MapTimestampFlatBuffers",
153
+ "MapTimestampStringFlatBuffers",
154
+ "MapTimestampUuidStringFlatBuffers",
155
+ "MapUuidTimestampUuidFlatBuffers",
156
+ "MapUuidBytes20Uint8FlatBuffers",
157
+ "MapUuidBytes20Uint8UuidFlatBuffers",
158
+ "MapUuidBytes20Bytes20Uint8UuidFlatBuffers",
159
+ "MapUint16UuidTimestampFlatBuffers",
160
+ # UUID (uint128) based pmap types for indexes
161
+ "MapUuidUuid",
162
+ "MapUuidStringUuid",
163
+ "MapUuidUuidStringUuid",
164
+ "MapUuidUuidUuidStringUuid",
165
+ "MapUint64TimestampUuid",
166
+ # more UUID (uint128) based pmap types for indexes
167
+ "MapUuidUuidSet",
168
+ "MapUuidStringOid",
169
+ # UUID-UUID based pmap types
170
+ "MapUuidUuidFlatBuffers",
171
+ "MapUuidStringFlatBuffers",
172
+ "MapUuidUuidCbor",
173
+ "MapUuidUuidUuid",
174
+ "MapUuidUuidUuidUuid",
175
+ "MapUuidUuidUuidUuidUuid",
176
+ "MapUuidTimestampUuid",
177
+ "MapUuidTimestampBytes32",
178
+ "MapUuidTimestampCbor",
179
+ "MapTimestampUuidCbor",
180
+ #
181
+ # String pmaps
182
+ #
183
+ # String (utf8) based pmap types for object containers
184
+ "MapStringUuid",
185
+ "MapStringStringUuid",
186
+ "MapStringStringStringUuid",
187
+ "MapStringOid",
188
+ "MapStringOidOid",
189
+ "MapStringJson",
190
+ "MapStringCbor",
191
+ "MapStringPickle",
192
+ "MapStringFlatBuffers",
193
+ "MapStringTimestampCbor",
194
+ "MapTimestampStringCbor",
195
+ # String (utf8) based pmap types for indexes
196
+ "MapStringString",
197
+ #
198
+ # OID pmaps
199
+ #
200
+ # OID (uint64) based pmap types for object containers
201
+ "MapOidString",
202
+ "MapOidUuid",
203
+ "MapOidJson",
204
+ "MapOidCbor",
205
+ "MapOidPickle",
206
+ "MapOidFlatBuffers",
207
+ "MapOidOidFlatBuffers",
208
+ "MapOidTimestampFlatBuffers",
209
+ "MapOid3FlatBuffers",
210
+ # OID (uint64) based pmap types for indexes
211
+ "MapOidOid",
212
+ "MapOidOidSet",
213
+ "MapOidStringOid",
214
+ "MapOidOidOid",
215
+ "MapOidTimestampOid",
216
+ "MapOidTimestampStringOid",
217
+ #
218
+ # Bytes32 pmaps
219
+ #
220
+ "MapBytes32Uuid",
221
+ "MapBytes32Timestamp",
222
+ "MapBytes32Bytes32",
223
+ "MapBytes32FlatBuffers",
224
+ "MapBytes32UuidFlatBuffers",
225
+ "MapUuidBytes32FlatBuffers",
226
+ "MapBytes32Bytes32FlatBuffers",
227
+ "MapBytes32StringFlatBuffers",
228
+ "MapTimestampBytes32FlatBuffers",
229
+ "MapUuidUuidStringFlatBuffers",
230
+ #
231
+ # Bytes20 pmaps
232
+ #
233
+ "MapBytes20Uuid",
234
+ "MapBytes20Bytes16",
235
+ "MapBytes20Bytes20",
236
+ "MapBytes20Bytes20Timestamp",
237
+ "MapBytes20TimestampBytes20",
238
+ "MapBytes20TimestampUuid",
239
+ "MapBytes20FlatBuffers",
240
+ "MapBytes20Bytes20FlatBuffers",
241
+ "MapBytes20StringFlatBuffers",
242
+ #
243
+ # Bytes16 pmaps
244
+ #
245
+ "MapBytes16FlatBuffers",
246
+ "MapBytes16TimestampUuid",
247
+ "MapBytes16TimestampUuidFlatBuffers",
248
+ )
249
+
250
+ TABLES_BY_UUID: Dict[uuid.UUID, PersistentMap] = {}
251
+ """
252
+ Map of table UUIDs to persistent maps stored in slots in a KV store.
253
+ """
254
+
255
+
256
+ def table(oid, marshal=None, parse=None, build=None, cast=None, compress=None):
257
+ if type(oid) == str:
258
+ oid = uuid.UUID(oid)
259
+
260
+ assert isinstance(oid, uuid.UUID)
261
+ assert marshal is None or callable(marshal)
262
+ assert parse is None or callable(parse)
263
+ assert build is None or callable(build)
264
+ assert cast is None or callable(cast)
265
+ assert compress is None or compress in [
266
+ PersistentMap.COMPRESS_ZLIB,
267
+ PersistentMap.COMPRESS_SNAPPY,
268
+ ]
269
+
270
+ def decorate(o):
271
+ if oid in TABLES_BY_UUID:
272
+ assert TABLES_BY_UUID[oid]._zlmdb_oid == oid, "{} != {}".format(
273
+ TABLES_BY_UUID[oid]._zlmdb_oid, oid
274
+ )
275
+ assert TABLES_BY_UUID[oid]._zlmdb_marshal == marshal, "{} != {}".format(
276
+ TABLES_BY_UUID[oid]._zlmdb_marshal, marshal
277
+ )
278
+ assert TABLES_BY_UUID[oid]._zlmdb_parse == parse, "{} != {}".format(
279
+ TABLES_BY_UUID[oid]._zlmdb_parse, parse
280
+ )
281
+ assert TABLES_BY_UUID[oid]._zlmdb_build == build, "{} != {}".format(
282
+ TABLES_BY_UUID[oid]._zlmdb_build, build
283
+ )
284
+ assert TABLES_BY_UUID[oid]._zlmdb_cast == cast, "{} != {}".format(
285
+ TABLES_BY_UUID[oid]._zlmdb_cast, cast
286
+ )
287
+ assert TABLES_BY_UUID[oid]._zlmdb_compress == compress, "{} != {}".format(
288
+ TABLES_BY_UUID[oid]._zlmdb_compress, compress
289
+ )
290
+ return
291
+ assert oid not in TABLES_BY_UUID, (
292
+ "oid {} already in map (pointing to {})".format(oid, TABLES_BY_UUID[oid])
293
+ )
294
+
295
+ # slot UUID that is mapped to a slot index later when attaching to db
296
+ o._zlmdb_oid = oid
297
+
298
+ # for CBOR/JSON
299
+ o._zlmdb_marshal = marshal
300
+ o._zlmdb_parse = parse
301
+
302
+ # for Flatbuffers
303
+ o._zlmdb_build = build
304
+ o._zlmdb_cast = cast
305
+
306
+ # for value compression
307
+ o._zlmdb_compress = compress
308
+
309
+ TABLES_BY_UUID[oid] = o
310
+ return o
311
+
312
+ return decorate