evoid-smart-storage
Multi-DB routing — Intent Handler system
Quick Start • Intent Handler • Routing • API
Quick Start
uv add evoid-smart-storage
Method 1: Intent Handler (Recommended)
from evoid_smart_storage import register_handlers
from evoid.core.storage import storage_read, storage_write
# Register Smart Storage as storage handler
register_handlers(config={
"mapping": {
"credentials": "postgresql",
"session": "redis",
"logs": "memory",
},
})
# Routes automatically based on data type
await storage_write("cred:db_pass", {"password": "secret"})
await storage_write("session:abc", {"user": "alice"})
Method 2: Direct API
from evoid_smart_storage import SmartStorage
storage = SmartStorage(config={...})
await storage.write("key", {"data": "value"})
Intent Handler
evoid-smart-storage registers these Intent handlers:
| Intent | Handler | Description |
|---|---|---|
storage.read |
handle_read |
Read with smart routing |
storage.write |
handle_write |
Write with smart routing |
storage.delete |
handle_delete |
Delete with smart routing |
storage.health |
handle_health |
Check all backends |
Routing
Smart Storage routes data based on:
- Data type — credentials → PostgreSQL, sessions → Redis
- Intent level — CRITICAL → PostgreSQL, STANDARD → SQLite
- User ID — multi-tenancy support
- Metadata override — explicit backend selection
Configuration
TOML
[engines]
storage = "smart_storage"
[engines.options.smart_storage]
mapping = { credentials = "postgresql", session = "redis" }
API
register_handlers(config: dict)
Register Smart Storage as Intent handlers.
SmartStorage Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
read |
async read(key: str) |
Any | None |
Read with routing |
write |
async write(key: str, data: dict) |
bool |
Write with routing |
delete |
async delete(key: str) |
bool |
Delete with routing |
health |
async health() |
bool |
Check all backends |
DI Integration
All plugins register with evoid-di for automatic service discovery and fault tolerance.
from evoid_di import di
# Resolve with fallback
storage = di.resolve_with_fallback("storage.postgresql")
# Tries: postgresql → sqlite → redis → cluster peers → None
Dependencies
evoid>=0.4.0- At least one storage plugin (sqlite, postgresql, redis, etc.)
Links
License
MIT
Release files for evoid-smart-storage 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| evoid_smart_storage-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / evoid_smart_storage-0.1.2-py3-none-any.whl
| Download URL | evoid_smart_storage-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
920606e44a97d8d1e781cb788d5cc6bcbbe3c4165953e0287010b834bf13f7f1
|
|
BLAKE2b-256 checksum How to use checksums |
1075d7cc843b4843d871d11c2d45b207949d0ea1d6ddaaecefd4392a489988e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|