Skip to main content

PyPI Python License

evoid-smart-storage

Multi-DB routing — Intent Handler system

Quick StartIntent HandlerRoutingAPI


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:

  1. Data type — credentials → PostgreSQL, sessions → Redis
  2. Intent level — CRITICAL → PostgreSQL, STANDARD → SQLite
  3. User ID — multi-tenancy support
  4. 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)

Table of built distributions (wheels) for evoid-smart-storage 0.1.2
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

0.2.0

1 release file

This release

0.1.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page