TeskaLabs/asab
View on GitHubStorageService: Add missing methods for InMemory provider
Open
#776 opened on Jul 3, 2026
enhancementgood first issue
Repository metrics
- Stars
- (32 stars)
- PR merge metrics
- (PR metrics pending)
Description
Summary
The InMemory storage backend (asab/storage/inmemory.py) does not fully implement the StorageServiceABC interface. MongoDB is the reference implementation; InMemory is missing several features that application code may rely on.
Feature parity
| Method / feature | MongoDB | InMemory | ElasticSearch |
|---|---|---|---|
get_by() |
✅ | ❌ | ❌ |
generate_id() |
✅ | ✅ | ❌ |
list() |
✅ | ❌ | ✅ |
InMemory gaps (this issue):
| Method / feature | Status |
|---|---|
get_by() |
❌ raises NotImplementedError() |
list() |
❌ not implemented |
Background
InMemory is used for testing and lightweight deployments. Upsertor modifiers ($set, $inc, $push, $unset, $pull) and AES encrypt/decrypt already work. The main gaps are lookup by field, changestream webhooks, and list().
Current state
get_by()—asab/storage/inmemory.py:123–130raisesNotImplementedError()list()— not present on InMemoryStorageService
Proposed work
- Implement
get_by()(scan in-memory collection by key/value; raiseKeyError("NOT-FOUND")when missing, matching MongoDB) - Implement
list()for basic pagination/sorting parity with MongoDB
References
- Backend:
asab/storage/inmemory.py - Reference:
asab/storage/mongodb.py - Webhook base:
asab/storage/upsertor.py - Config:
[asab:storage:changestream](webhook_uri,webhook_auth)
Acceptance criteria
get_by()returns a document by key/value or raisesKeyError("NOT-FOUND")- Tests cover
get_by()and webhook emission