aea.helpers.storage.generic_storage
This module contains the storage implementation.
AsyncCollection Objects
Async collection.
__init__
Init collection object.
Arguments:
storage_backend: storage backed to use.collection_name: str
put
Put object into collection.
Arguments:
object_id: str object idobject_body: python dict, json compatible.
Returns:
None
get
Get object from the collection.
Arguments:
object_id: str object id
Returns:
dict if object exists in collection otherwise None
remove
Remove object from the collection.
Arguments:
object_id: str object id
Returns:
None
find
Get objects from the collection by filtering by field value.
Arguments:
field: field name to search: example "parent.field"equals: value field should be equal to
Returns:
None
list
List all objects with keys from the collection.
Returns:
Tuple of objects keys, bodies.
SyncCollection Objects
Async collection.
__init__
Init collection object.
Arguments:
async_collection_coro: coroutine returns async collection.loop: abstract event loop where storage is running.
put
Put object into collection.
Arguments:
object_id: str object idobject_body: python dict, json compatible.
Returns:
None
get
Get object from the collection.
Arguments:
object_id: str object id
Returns:
dict if object exists in collection otherwise None
remove
Remove object from the collection.
Arguments:
object_id: str object id
Returns:
None
find
Get objects from the collection by filtering by field value.
Arguments:
field: field name to search: example "parent.field"equals: value field should be equal to
Returns:
List of object bodies
list
List all objects with keys from the collection.
Returns:
Tuple of objects keys, bodies.
Storage Objects
Generic storage.
__init__
| __init__(storage_uri: str, loop: asyncio.AbstractEventLoop = None, threaded: bool = False) -> None
Init storage.
Arguments:
storage_uri: configuration string for storage.loop: asyncio event loop to use.threaded: bool. start in thread if True.
wait_connected
Wait generic storage is connected.
is_connected
Get running state of the storage.
run
Connect storage.
get_collection
Get async collection.
get_sync_collection
Get sync collection.
__repr__
Get string representation of the storage.