Thread/Process safe shelves and other lam-db helpers
pip install lsm-db-extras
from lsm_extras import Shelf, LSMDict, LSMTree
with Shelf("/tmp/test.ldb") as shelf:
shelf["foo"] = True
with Shelf("/tmp/test.ldb") as shelf:
print(shelf["foo"])
with LSMDict("/tmp/test-dict.ldb") as storage:
storage[1] = True
with LSMDict("/tmp/test-dict.ldb") as storage:
print(storage[1])
with LSMTree("/tmp/test-tree.ldb") as storage:
with tree.transaction():
for i in range(10):
tree['numbers', i] = i * 2
tree['strings', i] = str(i)
print(list(tree.find('strings')))