/
_pmap.py
1427 lines (1116 loc) · 50.4 KB
/
_pmap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) typedef int GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
###############################################################################
"""Persistent mappings."""
import struct
import sys
import uuid
import zlib
from typing import Optional, List, Callable, Any, Tuple, Dict
from zlmdb import _types, _errors
from zlmdb._transaction import Transaction
try:
import snappy
except ImportError:
HAS_SNAPPY = False
else:
HAS_SNAPPY = True
if sys.version_info < (3, ):
from UserDict import DictMixin as MutableMapping
_NATIVE_PICKLE_PROTOCOL = 2
else:
from collections.abc import MutableMapping
_NATIVE_PICKLE_PROTOCOL = 4
class Index(object):
"""
Holds book-keeping metadata for indexes on tables (pmaps).
"""
def __init__(self, name, fkey, pmap, nullable=False, unique=True):
"""
:param name: Index name.
:type name: str
:param fkey: Function that extracts the indexed value from the indexed table.
:type fkey: callable
:param pmap: Persistent map for index storage.
:type pmap: :class:`zlmdb._pmap.PersistentMap`
:param nullable: Whether the indexed table column is allowed to
take ``None`` values.
:type nullable: bool
:param unique: Whether the indexed table column must take unique values.
:type unique: bool
"""
self._name = name
self._fkey = fkey
self._pmap = pmap
self._nullable = nullable
self._unique = unique
@property
def name(self):
"""
Index name property.
:return: Name of the index (on the indexed table).
:rtype: str
"""
return self._name
@property
def fkey(self):
"""
Indexed value extractor property.
:return: Function to extract indexed value from the indexed table.
:rtype: callable
"""
return self._fkey
@property
def pmap(self):
"""
Index table (pmap) property.
:return: Persistent map for index storage.
:rtype: :class:`zlmdb._pmap.PersistentMap`
"""
return self._pmap
@property
def nullable(self):
"""
Index nullable property.
:return: Whether the indexed table column is allowed to
take ``None`` values.
:rtype: bool
"""
return self._nullable
@property
def unique(self):
"""
Index uniqueness property-
:return: Whether the indexed table column must take unique values.
:rtype: bool
"""
return self._unique
def is_null(value):
"""
Check if the scalar value or tuple/list value is NULL.
:param value: Value to check.
:type value: a scalar or tuple or list
:return: Returns ``True`` if and only if the value is NULL (scalar value is None
or _any_ tuple/list elements are None).
:rtype: bool
"""
if type(value) in (tuple, list):
for v in value:
if v is None:
return True
return False
else:
return value is None
def qual(obj):
"""
Return fully qualified name of a class.
"""
return u'{}.{}'.format(obj.__class__.__module__, obj.__class__.__name__)
class PersistentMap(MutableMapping):
"""
Abstract base class for persistent maps stored in LMDB.
"""
COMPRESS_ZLIB = 1
COMPRESS_SNAPPY = 2
# these are filled by table decorate @zlmdb.table
_zlmdb_oid: Optional[uuid.UUID] = None
_zlmdb_marshal: Optional[Callable] = None
_zlmdb_parse: Optional[Callable] = None
_zlmdb_build: Optional[Callable] = None
_zlmdb_cast: Optional[Callable] = None
_zlmdb_compress: Optional[int] = None
def __init__(self, slot: Optional[int], compress: Optional[int] = None):
"""
:param slot:
:param compress:
"""
assert slot is None or type(slot) == int
assert compress is None or compress in [PersistentMap.COMPRESS_ZLIB, PersistentMap.COMPRESS_SNAPPY]
self._slot = slot
if compress:
if compress not in [PersistentMap.COMPRESS_ZLIB, PersistentMap.COMPRESS_SNAPPY]:
raise Exception('invalid compression mode')
if compress == PersistentMap.COMPRESS_SNAPPY and not HAS_SNAPPY:
raise Exception('snappy compression requested, but snappy is not installed')
if compress == PersistentMap.COMPRESS_ZLIB:
self._compress = zlib.compress
self._decompress = zlib.decompress
elif compress == PersistentMap.COMPRESS_SNAPPY:
self._compress = snappy.compress
self._decompress = snappy.uncompress
else:
raise Exception('logic error')
else:
self._compress = lambda data: data # type: ignore
self._decompress = lambda data: data # type: ignore
# if this pmap is an index, the table-pmap the index-pmap is attached to
self._index_attached_to = None
# if this pmap is NOT an index, any indexes attached to this (table-)pmap
self._indexes: Dict[str, Index] = {}
def indexes(self) -> List[str]:
"""
:return:
"""
return sorted(self._indexes.keys())
def is_index(self) -> bool:
"""
Flag indicating whether this pmap is used as an index.
:return:
"""
return self._index_attached_to is not None
def attach_index(self,
name: str,
pmap: 'PersistentMap',
fkey: Callable,
nullable: bool = False,
unique: bool = True):
"""
:param name:
:param pmap:
:param fkey:
:param nullable:
:param unique:
"""
if self._index_attached_to:
raise Exception('cannot attach an index to an index (this pmap is already an index attached to {})'.format(
self._index_attached_to))
if pmap._index_attached_to:
raise Exception('index already attached (to {})'.format(pmap._index_attached_to))
if name in self._indexes:
raise Exception('index with name "{}" already exists'.format(name))
self._indexes[name] = Index(name, fkey, pmap, nullable, unique)
pmap._index_attached_to = self # type: ignore
def detach_index(self, name: str):
"""
:param name:
"""
if name in self._indexes:
del self._indexes[name]
def _serialize_key(self, key):
raise Exception('must be implemented in derived class')
def _deserialize_key(self, data):
raise Exception('must be implemented in derived class')
def _serialize_value(self, value):
raise Exception('must be implemented in derived class')
def _deserialize_value(self, data):
raise Exception('must be implemented in derived class')
def __contains__(self, txn_key):
"""
:param txn_key:
:return:
"""
assert type(txn_key) == tuple and len(txn_key) == 2
txn, key = txn_key
assert isinstance(txn, Transaction)
_key = struct.pack('>H', self._slot) + self._serialize_key(key)
_data = txn.get(_key)
return _data is not None
def __getitem__(self, txn_key):
"""
:param txn_key:
:return:
"""
assert type(txn_key) == tuple and len(txn_key) == 2
txn, key = txn_key
assert isinstance(txn, Transaction)
_key = struct.pack('>H', self._slot) + self._serialize_key(key)
_data = txn.get(_key)
if _data:
if self._decompress:
_data = self._decompress(_data)
return self._deserialize_value(_data)
else:
return None
def __setitem__(self, txn_key, value):
"""
:param txn_key:
:param value:
:return:
"""
assert type(txn_key) == tuple and len(txn_key) == 2
txn, key = txn_key
assert isinstance(txn, Transaction)
_key = struct.pack('>H', self._slot) + self._serialize_key(key)
_data = self._serialize_value(value)
if self._compress:
_data = self._compress(_data)
# if there are indexes defined, get existing object (if any),
# so that we can properly maintain the indexes, should indexed
# columns be set to NULL, in which case we need to delete the
# respective index record
_old_value = None
if self._indexes:
_old_data = txn.get(_key)
if _old_data:
if self._decompress:
_old_data = self._decompress(_old_data)
_old_value = self._deserialize_value(_old_data)
# insert data record
txn.put(_key, _data)
# insert records into indexes
for index in self._indexes.values():
# extract indexed column value, which will become the index record key
_fkey = index.fkey(value)
if _old_value:
_fkey_old = index.fkey(_old_value)
if not is_null(_fkey_old) and _fkey_old != _fkey:
_idx_key = struct.pack('>H', index.pmap._slot) + index.pmap._serialize_key(_fkey_old)
txn.delete(_idx_key)
if is_null(_fkey):
if not index.nullable:
raise _errors.NullValueConstraint(
'cannot insert NULL value into non-nullable index "{}::{}"'.format(qual(self), index.name))
else:
_key = struct.pack('>H', index.pmap._slot) + index.pmap._serialize_key(_fkey)
_data = index.pmap._serialize_value(key)
txn.put(_key, _data)
def __delitem__(self, txn_key):
"""
:param txn_key:
:return:
"""
assert type(txn_key) == tuple and len(txn_key) == 2
txn, key = txn_key
assert isinstance(txn, Transaction)
_key = struct.pack('>H', self._slot) + self._serialize_key(key)
# delete records from indexes
if self._indexes:
value = self.__getitem__(txn_key)
if value:
for index in self._indexes.values():
_idx_key = struct.pack('>H', index.pmap._slot) + index.pmap._serialize_key(index.fkey(value))
txn.delete(_idx_key)
# delete actual data record
txn.delete(_key)
def __len__(self):
raise NotImplementedError()
def __iter__(self):
raise NotImplementedError()
def select(self,
txn: Transaction,
from_key: Any = None,
to_key: Any = None,
return_keys: bool = True,
return_values: bool = True,
reverse: bool = False,
limit: Optional[int] = None) -> 'PersistentMapIterator':
"""
Select all records (key-value pairs) in table, optionally within a given key range.
:param txn: The transaction in which to run.
:param from_key: Return records starting from (and including) this key.
:param to_key: Return records up to (but not including) this key.
:param return_keys: If ``True`` (default), return keys of records.
:param return_values: If ``True`` (default), return values of records.
:param reverse: If ``True``, return records in reverse order.
:param limit: Limit number of records returned.
:return:
"""
assert type(return_keys) == bool
assert type(return_values) == bool
assert type(reverse) == bool
assert limit is None or (type(limit) == int and limit > 0 and limit < 10000000)
return PersistentMapIterator(txn,
self,
from_key=from_key,
to_key=to_key,
return_keys=return_keys,
return_values=return_values,
reverse=reverse,
limit=limit)
def count(self, txn: Transaction, prefix: Any = None) -> int:
"""
Count number of records in the persistent map. When no prefix
is given, the total number of records is returned. When a prefix
is given, only the number of records with keys that have this
prefix are counted.
:param txn: The transaction in which to run.
:param prefix: The key prefix of records to count.
:returns: The number of records.
"""
assert txn._txn
key_from = struct.pack('>H', self._slot)
if prefix:
key_from += self._serialize_key(prefix)
kfl = len(key_from)
cnt = 0
cursor = txn._txn.cursor()
has_more = cursor.set_range(key_from)
while has_more:
_key = cursor.key()
_prefix = _key[:kfl]
if _prefix != key_from:
break
cnt += 1
has_more = cursor.next()
return cnt
def count_range(self, txn: Transaction, from_key: Any, to_key: Any) -> int:
"""
Counter number of records in the perstistent map with keys
within the given range.
:param txn: The transaction in which to run.
:param from_key: Count records starting and including from this key.
:param to_key: End counting records before this key.
:returns: The number of records.
"""
assert txn._txn
key_from = struct.pack('>H', self._slot) + self._serialize_key(from_key)
to_key = struct.pack('>H', self._slot) + self._serialize_key(to_key)
cnt = 0
cursor = txn._txn.cursor()
has_more = cursor.set_range(key_from)
while has_more:
if cursor.key() >= to_key:
break
cnt += 1
has_more = cursor.next()
return cnt
def truncate(self, txn: Transaction, rebuild_indexes: bool = True) -> int:
"""
:param txn:
:param rebuild_indexes:
:return:
"""
assert txn._txn
assert self._slot
key_from = struct.pack('>H', self._slot)
key_to = struct.pack('>H', self._slot + 1)
cursor = txn._txn.cursor()
cnt = 0
if cursor.set_range(key_from):
key = cursor.key()
while key < key_to:
if not cursor.delete(dupdata=True):
break
cnt += 1
if txn._stats:
txn._stats.dels += 1
if rebuild_indexes:
deleted, _ = self.rebuild_indexes(txn)
cnt += deleted
return cnt
def rebuild_indexes(self, txn: Transaction) -> Tuple[int, int]:
"""
:param txn:
:return:
"""
assert txn._txn
total_deleted = 0
total_inserted = 0
for name in sorted(self._indexes.keys()):
deleted, inserted = self.rebuild_index(txn, name)
total_deleted += deleted
total_inserted += inserted
return total_deleted, total_inserted
def rebuild_index(self, txn: Transaction, name: str) -> Tuple[int, int]:
"""
:param txn:
:param name:
:return:
"""
assert txn._txn
assert self._slot
if name in self._indexes:
index = self._indexes[name]
deleted = index.pmap.truncate(txn)
key_from = struct.pack('>H', self._slot)
key_to = struct.pack('>H', self._slot + 1)
cursor = txn._txn.cursor()
inserted = 0
if cursor.set_range(key_from):
while cursor.key() < key_to:
data = cursor.value()
if data:
value = self._deserialize_value(data)
_key = struct.pack('>H', index.pmap._slot) + index.pmap._serialize_key(index.fkey(value))
_data = index.pmap._serialize_value(value.oid)
txn.put(_key, _data)
inserted += 1
if not cursor.next():
break
return deleted, inserted
else:
raise Exception('no index "{}" attached'.format(name))
class PersistentMapIterator(object):
"""
Iterator that walks over zLMDB database records.
"""
def __init__(self,
txn: Transaction,
pmap: PersistentMap,
from_key: Any = None,
to_key: Any = None,
return_keys: bool = True,
return_values: bool = True,
reverse: bool = False,
limit: Optional[int] = None):
"""
:param txn:
:param pmap:
:param from_key:
:param to_key:
:param return_keys:
:param return_values:
:param reverse:
:param limit:
"""
self._txn = txn
self._pmap = pmap
assert pmap._slot
if from_key:
self._from_key = struct.pack('>H', pmap._slot) + pmap._serialize_key(from_key)
else:
self._from_key = struct.pack('>H', pmap._slot)
if to_key:
self._to_key = struct.pack('>H', pmap._slot) + pmap._serialize_key(to_key)
else:
self._to_key = struct.pack('>H', pmap._slot + 1)
self._reverse = reverse
self._return_keys = return_keys
self._return_values = return_values
self._limit = limit
self._read = 0
self._cursor = None
self._found = None
def __iter__(self) -> 'PersistentMapIterator':
assert self._txn._txn
self._cursor = self._txn._txn.cursor()
assert self._cursor
# https://lmdb.readthedocs.io/en/release/#lmdb.Cursor.set_range
if self._reverse:
# seek to the first record starting from to_key (and going reverse)
self._found = self._cursor.set_range(self._to_key)
if self._found:
# to_key is _not_ inclusive, so we move on one record
self._found = self._cursor.prev()
else:
self._found = self._cursor.last()
else:
# seek to the first record starting from from_key
self._found = self._cursor.set_range(self._from_key)
return self
def __next__(self):
"""
:return: Return either ``(key, value)``, ``key`` or ``value``, depending on ``return_keys``
and ``return_values``.
"""
# stop criteria: no more records or limit reached
if not self._found or (self._limit and self._read >= self._limit):
raise StopIteration
self._read += 1
# stop criteria: end of key-range reached
_key = self._cursor.key()
if self._reverse:
if _key < self._from_key:
raise StopIteration
else:
if _key >= self._to_key:
raise StopIteration
# read actual app key-value (before moving cursor)
_key = self._pmap._deserialize_key(_key[2:])
if self._return_values:
_data = self._cursor.value()
if _data:
if self._pmap._decompress:
_data = self._pmap._decompress(_data)
_data = self._pmap._deserialize_value(_data)
else:
_data = None
# move the cursor
if self._reverse:
self._found = self._cursor.prev()
else:
self._found = self._cursor.next()
# return app key-value
if self._return_keys and self._return_values:
return _key, _data
elif self._return_values:
return _data
elif self._return_keys:
return _key
else:
return None
next = __next__ # Python 2
#
# Key: UUID -> Value: String, OID, UUID, JSON, CBOR, Pickle, FlatBuffers
#
class MapSlotUuidUuid(_types._SlotUuidKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (slot, UUID) and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidString(_types._UuidKeysMixin, _types._StringValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and string (utf8) values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidOid(_types._UuidKeysMixin, _types._OidValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and OID (uint64) values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuid(_types._UuidKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and UUID (16 bytes) values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidCbor(_types._UuidUuidKeysMixin, _types._CborValuesMixin, PersistentMap):
"""
Persistent map with (UUID, UUID) keys and CBOR values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._CborValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)
class MapUuidTimestampBytes32(_types._UuidTimestampKeysMixin, _types._Bytes32ValuesMixin, PersistentMap):
"""
Persistent map with (UUID, Timestamp) keys and Bytes32 values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUint64TimestampUuid(_types._Uint64TimestampKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (Uint64, Timestamp) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidUuid(_types._UuidUuidKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, UUID) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidTimestampUuid(_types._UuidTimestampKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, timestamp) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidStringUuid(_types._UuidStringKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, string) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidStringUuid(_types._UuidUuidStringKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, UUID, string) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidUuidStringUuid(_types._UuidUuidUuidStringKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, UUID, UUID, string) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidUuidUuid(_types._UuidUuidUuidKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, UUID, UUID) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidUuidUuidUuid(_types._UuidUuidUuidUuidKeysMixin, _types._UuidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, UUID, UUID, UUID) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidStringOid(_types._UuidStringKeysMixin, _types._OidValuesMixin, PersistentMap):
"""
Persistent map with (UUID, string) keys and Oid values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidUuidSet(_types._UuidKeysMixin, _types._UuidSetValuesMixin, PersistentMap):
"""
Persistent map with (UUID, string) keys and UUID values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidJson(_types._UuidKeysMixin, _types._JsonValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and JSON values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._JsonValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)
class MapUuidCbor(_types._UuidKeysMixin, _types._CborValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and CBOR values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._CborValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)
class MapUuidPickle(_types._UuidKeysMixin, _types._PickleValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and Python Pickle values.
"""
def __init__(self, slot=None, compress=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
class MapUuidFlatBuffers(_types._UuidKeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with UUID (16 bytes) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUuidTimestampFlatBuffers(_types._UuidTimestampKeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with (UUID, Timestamp) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapTimestampFlatBuffers(_types._TimestampKeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with Timestamp keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapTimestampUuidFlatBuffers(_types._TimestampUuidKeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with (Timestamp, UUID) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUuidTimestampUuidFlatBuffers(_types._UuidTimestampUuidKeysMixin, _types._FlatBuffersValuesMixin,
PersistentMap):
"""
Persistent map with (UUID, Timestamp, UUID) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUint16UuidTimestampFlatBuffers(_types._Uint16UuidTimestampKeysMixin, _types._FlatBuffersValuesMixin,
PersistentMap):
"""
Persistent map with (uint16, UUID, Timestamp) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUuidBytes20Uint8FlatBuffers(_types._UuidBytes20Uint8KeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with (UUID, bytes[20], uint8) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUuidBytes20Uint8UuidFlatBuffers(_types._UuidBytes20Uint8UuidKeysMixin, _types._FlatBuffersValuesMixin,
PersistentMap):
"""
Persistent map with (UUID, bytes[20], uint8, UUID) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUuidBytes20Bytes20Uint8UuidFlatBuffers(_types._UuidBytes20Bytes20Uint8UuidKeysMixin,
_types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with (UUID, bytes[20], bytes[20], uint8, UUID) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapTimestampUuidStringFlatBuffers(_types._TimestampUuidStringKeysMixin, _types._FlatBuffersValuesMixin,
PersistentMap):
"""
Persistent map with (Timestamp, UUID, String) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapTimestampBytes32FlatBuffers(_types._TimestampBytes32KeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with (Timestamp, Bytes32) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapTimestampStringFlatBuffers(_types._TimestampStringKeysMixin, _types._FlatBuffersValuesMixin, PersistentMap):
"""
Persistent map with (Timestamp, String) keys and FlatBuffers values.
"""
def __init__(self, slot=None, compress=None, build=None, cast=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._FlatBuffersValuesMixin.__init__(self, build=build, cast=cast)
class MapUuidTimestampCbor(_types._UuidTimestampKeysMixin, _types._CborValuesMixin, PersistentMap):
"""
Persistent map with (UUID, Timestamp) keys and CBOR values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._CborValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)
class MapTimestampUuidCbor(_types._TimestampUuidKeysMixin, _types._CborValuesMixin, PersistentMap):
"""
Persistent map with (Timestamp, UUID) keys and CBOR values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._CborValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)
class MapStringTimestampCbor(_types._StringTimestampKeysMixin, _types._CborValuesMixin, PersistentMap):
"""
Persistent map with (String, Timestamp) keys and CBOR values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._CborValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)
class MapTimestampStringCbor(_types._TimestampStringKeysMixin, _types._CborValuesMixin, PersistentMap):
"""
Persistent map with (Timestamp, String) keys and CBOR values.
"""
def __init__(self, slot=None, compress=None, marshal=None, unmarshal=None):
PersistentMap.__init__(self, slot=slot, compress=compress)
_types._CborValuesMixin.__init__(self, marshal=marshal, unmarshal=unmarshal)