[POC] In-memory lmdb adapter for Pyodide/WASM - #16
Draft
jaelliot wants to merge 1 commit into
Draft
Conversation
- Dict-backed implementation of lmdb API subset used by keripy - Covers Environment, Transaction, Cursor, and Database classes - Supports dupsort databases with sorted duplicate values - Matches real lmdb delete semantics (empty val deletes all dups) - Passes 44 unit tests and LMDBer integration test - Data is volatile (in-memory only), persistence deferred to Phase 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proof of Concept / Demo
This is a volatile, in-memory
lmdbAPI adapter that allows keripy'sLMDBerto boot inside Pyodide (WASM) where the real lmdb C extension cannot load.Status: Proof of concept — not production-ready. Data is lost on page refresh.
What it does
lmdbAPI subset that keripy actually callsLMDBer(name=..., temp=True, reopen=True)to succeed in PyodideEnvironment,_Transaction,_Cursor,_Database,BadValsizeErrorWhat it does NOT do
Validated against
dbing.pycursor patternssetVer/getVer,putVal/getVal/delVal,setVal,getTopItemIter,cntTop,remTop,cntAll, dupsortputVals/getVals/cntVals/getValLast/delVals,closeBug found and fixed during integration
txn.delete(key, b'')on dupsort databases: real lmdb treats empty val as "delete all dups at key." The adapter initially treatedb''as a specific value lookup. Fixed to match real lmdb semantics.Files changed
python/lmdb.py— single new file, ~499 lines, zero external dependencies (onlybisectfrom stdlib)