64
64
65
65
OnIoDupSuber provides set of insertion ordered values where the where trailing
66
66
part of key is serialized ordinal number so that the ordering within each
67
- key prefix is monotonically increasing numeric.
67
+ key prefix is monotonically increasing numeric. Useful to provide omndices
68
+ for sn ordering of superseding KEL events.
68
69
69
70
Each of these base types for managing the key space may be mixed with other
70
71
Classes that provide different types of values these include.
@@ -638,6 +639,10 @@ class B64SuberBase(SuberBase):
638
639
db (dbing.LMDBer): base LMDB db
639
640
sdb (lmdb._Database): instance of lmdb named sub db for this Suber
640
641
sep (str): separator for combining keys tuple of strs into key bytes
642
+ for db key and also used to convert val iterator to val bytes
643
+ Must not be Base64 character.
644
+ default is self.Sep == '.'
645
+
641
646
"""
642
647
643
648
def __init__ (self , * pa , ** kwa ):
@@ -759,8 +764,6 @@ class B64Suber(B64SuberBase, Suber):
759
764
760
765
.sep must not be Base64 character.
761
766
762
- Each key consistes of pre joined with .sep to ordinal suffix
763
-
764
767
Assumes dupsort==False
765
768
766
769
"""
@@ -775,6 +778,7 @@ def __init__(self, *pa, **kwa):
775
778
each key. Set to False
776
779
sep (str): separator to convert keys iterator to key bytes for db key
777
780
default is self.Sep == '.'
781
+ also used to convert val iterator to val bytes
778
782
Must not be Base64 character.
779
783
verify (bool): True means reverify when ._des from db when applicable
780
784
False means do not reverify. Default False
@@ -2158,13 +2162,44 @@ def getItemIter(self, keys: str | bytes | memoryview | Iterable = "",
2158
2162
yield (self ._tokeys (key ), self ._des (val ))
2159
2163
2160
2164
2165
+ class B64IoDupSuber (B64SuberBase , IoDupSuber ):
2166
+ """
2167
+ Subclass of B64SuberBase and IoDupSuber that serializes and deserializes
2168
+ values as .sep joined strings of Base64 components in insertion ordered
2169
+ duplicates with leading value proem. Proem + .sep joined value and must fit
2170
+ in 511 bytes of keyspace as duplicate
2171
+
2172
+ Assumes dupsort==True
2173
+
2174
+ """
2175
+
2176
+ def __init__ (self , * pa , ** kwa ):
2177
+ """
2178
+ Inherited Parameters:
2179
+ db (dbing.LMDBer): base db
2180
+ subkey (str): LMDB sub database key
2181
+ dupsort (bool): True means enable duplicates at each key
2182
+ False (default) means do not enable duplicates at
2183
+ each key. Set to False
2184
+ sep (str): separator for combining keys tuple of strs into key bytes
2185
+ for db key and also used to convert val iterator to val bytes
2186
+ Must not be Base64 character.
2187
+ default is self.Sep == '.'
2188
+ verify (bool): True means reverify when ._des from db when applicable
2189
+ False means do not reverify. Default False
2190
+ """
2191
+ super (B64IoDupSuber , self ).__init__ (* pa , ** kwa )
2192
+
2193
+
2194
+
2161
2195
class OnIoDupSuber (OnSuberBase , IoDupSuber ):
2162
2196
"""
2163
2197
Sub class of IoDupSuber and OnSuberBase that supports Insertion Ordering
2164
2198
(IoDup) of duplicates but where the trailing part of the key space is
2165
2199
a serialized monotonically increasing ordinal number. This is useful for
2166
- escrows of key events etc where duplicates of likely events are maintained
2167
- in insertion order.
2200
+ escrows of key events which are ordinally numbered such as sn but where
2201
+ duplicates of likely events are also maintained in insertion order.
2202
+
2168
2203
Insertion order is maintained by automagically prepending and stripping an
2169
2204
ordinal ordering proem to/from each duplicate value at a given key.
2170
2205
@@ -2412,3 +2447,39 @@ def getOnItemBackIter(self, keys: str|bytes|memoryview|Iterable = "", on: int=0)
2412
2447
for keys , on , val in (self .db .getOnIoDupItemBackIter (db = self .sdb ,
2413
2448
key = self ._tokey (keys ), on = on , sep = self .sep .encode ())):
2414
2449
yield (self ._tokeys (keys ), on , self ._des (val ))
2450
+
2451
+
2452
+ class B64OnIoDupSuber (B64SuberBase , OnIoDupSuber ):
2453
+ """
2454
+ Subclass of B64SuberBase and OnIoDupSuber that serializes and deserializes
2455
+ values as .sep joined strings of Base64 components in insertion ordered
2456
+ duplicates with leading value proem but where the trailing part of the
2457
+ key space is a serialized monotonically increasing ordinal number.
2458
+ Proem + .sep joined value and must fit n 511 bytes of keyspace as duplicate.
2459
+
2460
+ Insertion order is maintained by automagically prepending and stripping an
2461
+ ordinal ordering proem to/from each duplicate value at a given key.
2462
+
2463
+ OnIoDupSuber adds the convenience methods from OnSuberBase to OnIoDupSuber
2464
+ for those cases where the keyspace has a trailing ordinal part.
2465
+
2466
+ Assumes dupsort==True
2467
+
2468
+ """
2469
+
2470
+ def __init__ (self , * pa , ** kwa ):
2471
+ """
2472
+ Inherited Parameters:
2473
+ db (dbing.LMDBer): base db
2474
+ subkey (str): LMDB sub database key
2475
+ dupsort (bool): True means enable duplicates at each key
2476
+ False (default) means do not enable duplicates at
2477
+ each key. Set to False
2478
+ sep (str): separator for combining keys tuple of strs into key bytes
2479
+ for db key and also used to convert val iterator to val bytes
2480
+ Must not be Base64 character.
2481
+ default is self.Sep == '.'
2482
+ verify (bool): True means reverify when ._des from db when applicable
2483
+ False means do not reverify. Default False
2484
+ """
2485
+ super (B64OnIoDupSuber , self ).__init__ (* pa , ** kwa )
0 commit comments