store: memory + sqlite backends + --store scheme#26
Merged
Conversation
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.
Closes #22.
Implements the memory and SQLite store backends and the
--storescheme (SPEC §8/§13.1).store.pyrefactor to a smallStoreinterface (abstractload/save) with threebackends behind it:
FileStore— the existing JSON-files-in-a-dir store (file:<dir>/ bare<dir>).MemoryStore— in-process, ephemeral (mem:); holds the state in memory, isolated perprocess (a
runsession, §13.7).SqliteStore— single-file persistent DB (sqlite:<path>);sqlite3is stdlib, no newdependency.
open_store(spec)parses the scheme (file:/mem:/sqlite:, bare =file).CLI:
--storenow selects a backend viaopen_store; the default is unchanged(
./.harel, file). All backends are behaviorally identical — same CLI results and the same§8 snapshot JSON (the on-disk/in-memory layout is an implementation detail).
Tests: round-trip an instance through each backend (parity of snapshot JSON); a
sqlite:store persists across CLI invocations; a
mem:store is isolated per process but holds statewithin one
runsession;fileandsqliteproduce identical CLI results. ruff + mypyclean; 164 tests pass; the
cli/03-steppingblack-box case still passes.