Skip to content

Commit

Permalink
Test2
Browse files Browse the repository at this point in the history
  • Loading branch information
s-a-tanjim committed Aug 27, 2024
1 parent 0804ea9 commit 1454600
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/keri/db/dbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,20 @@

from hio.base import filing

from .. import help
from ..help import helping

logger = help.ogler.getLogger()

ProemSize = 32 # does not include trailing separator
MaxProem = int("f"*(ProemSize), 16)
MaxON = int("f"*32, 16) # largest possible ordinal number, sequence or first seen

SuffixSize = 32 # does not include trailing separator
MaxSuffix = int("f"*(SuffixSize), 16)

KERIDBMapSizeKey = "KERI_DB_MAP_SIZE"

def dgKey(pre, dig):
"""
Returns bytes DB key from concatenation of '.' with qualified Base64 prefix
Expand Down Expand Up @@ -381,7 +386,13 @@ def reopen(self, readonly=False, **kwa):

# open lmdb major database instance
# creates files data.mdb and lock.mdb in .dbDirPath
print(f"Opening DB with map size: {self.MapSize}")
if (mapSize := os.getenv(KERIDBMapSizeKey)) is not None:
try:
self.MapSize = int(mapSize)
except ValueError:
logger.error("KERI_DB_MAP_SIZE must be an integer value >1!")
raise

self.env = lmdb.open(self.path, max_dbs=self.MaxNamedDBs, map_size=self.MapSize,
mode=self.perm, readonly=self.readonly)
self.opened = True if opened and self.env else False
Expand Down

0 comments on commit 1454600

Please sign in to comment.