praval.storage.data_manager๏
Data Manager - Unified interface for storage operations
Provides a high-level interface for agents to interact with multiple storage providers through a single, consistent API.
Functions
|
Delete data using the global data manager. |
|
Retrieve data using the global data manager. |
Get the global data manager instance. |
|
|
Query data using the global data manager. |
|
Store data using the global data manager. |
Classes
|
Unified data management interface for agents. |
- class praval.storage.data_manager.DataManager(registry=None)[source]๏
Bases:
objectUnified data management interface for agents.
Provides high-level methods for storing, retrieving, and querying data across multiple storage backends through a single interface.
Features: - Automatic provider selection based on data type - Cross-provider queries and operations - Data reference management for spore communication - Storage optimization and caching - Transaction-like operations across providers
- Parameters:
registry (StorageRegistry | None)
- __init__(registry=None)[source]๏
Initialize data manager.
- Parameters:
registry (
Optional[StorageRegistry]) โ Storage registry to use (defaults to global registry)
- set_agent_context(agent_name)[source]๏
Set the current agent context for permission checking.
- Parameters:
agent_name (str)
- async store(provider, resource, data, **kwargs)[source]๏
Store data in a specific provider.
- Parameters:
- Return type:
- Returns:
StorageResult with operation outcome
- async get(provider, resource, **kwargs)[source]๏
Retrieve data from a specific provider.
- Parameters:
- Return type:
- Returns:
StorageResult with retrieved data
- async query(provider, resource, query, **kwargs)[source]๏
Execute a query on a specific provider.
- Parameters:
- Return type:
- Returns:
StorageResult with query results
- async delete(provider, resource, **kwargs)[source]๏
Delete data from a specific provider.
- Parameters:
- Return type:
- Returns:
StorageResult with operation outcome
- async smart_store(data, resource=None, preferred_provider=None, **kwargs)[source]๏
Intelligently store data by selecting the best provider.
- async smart_search(query, providers=None, **kwargs)[source]๏
Search across multiple providers intelligently.
- create_data_reference(provider, resource, **metadata)[source]๏
Create a data reference for spore communication.
- Parameters:
- Return type:
- Returns:
DataReference object
- async resolve_data_reference(data_ref, **kwargs)[source]๏
Resolve a data reference to actual data.
- Parameters:
data_ref (
Union[DataReference,str]) โ DataReference object or URI string**kwargs โ Retrieval parameters
- Return type:
- Returns:
StorageResult with resolved data
- praval.storage.data_manager.get_data_manager()[source]๏
Get the global data manager instance.
- Return type:
- async praval.storage.data_manager.store_data(provider, resource, data, **kwargs)[source]๏
Store data using the global data manager.
- Return type:
- Parameters:
- async praval.storage.data_manager.get_data(provider, resource, **kwargs)[source]๏
Retrieve data using the global data manager.
- Return type:
- Parameters:
- async praval.storage.data_manager.query_data(provider, resource, query, **kwargs)[source]๏
Query data using the global data manager.
- Return type:
- Parameters: