Add process-local memory backend#135
Merged
Merged
Conversation
Owner
Author
|
@davidlatwe, this PR adds the in-memory backend discussed in #69. It supports private test databases and named databases shared within one process, with tests for locking and stale caches. Would you be willing to review it? GitHub will let me add the formal review request after the collaborator invitation is accepted. |
Contributor
|
Thanks for the invite , but its a bit much to read through for my limited free time (already hard for me to work on my montydb!) Since this project is opensourced, I recommend you try https://www.coderabbit.ai/ for review. |
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.
Summary
This adds the roadmap's process-local in-memory backend and closes #69.
backend="memory"support toTinyMongoClientandMongoClient.memory://NAMEnamespaces.Why
Tests and temporary workloads currently need a filesystem-backed database even
when persistence is unwanted. The memory backend provides a zero-file,
zero-extra-dependency option while preserving TinyMongo's existing collection
API and JSON-compatible value behavior. It also establishes the backend needed
before the roadmap's async work can be developed and tested cleanly.
Behavior and design
Isolated clients
Each unnamed client receives a unique namespace. It does not create database or
lock files, and its namespace is cleared when the client closes.
Named sharing
Named clients share data inside the current Python process. Named data can be
reopened after a client closes and remains available until process exit.
Correctness
address.
multiple clients are atomic.
collection refresh cannot hide changes from another collection.
next read.
default JSON backend's value behavior.
cannot remove a newly created replacement entry.
isolated database.
Capabilities and limits
cannot make useful use of process-local state.
Tests
The focused memory suite covers CRUD, isolation, named sharing, lifecycle
behavior, copying and serialization, cache refreshes, retained collection
handles, equality-index invalidation, duplicate IDs, threaded inserts,
concurrent cleanup, URI validation, capability reporting, and both client
classes.
Validation completed locally:
181 passed, 47 deselected, 8 xfailedgit diff --checkpasscontracts
28 passed, 8 xfailedThe eight xfails are existing, explicitly documented compatibility gaps;
memory inherits the cursor pagination gap tracked by #73.
Closes #69