aries_cloudagent.storage package¶
Submodules¶
aries_cloudagent.storage.base module¶
Abstract base classes for non-secrets storage.
-
class
aries_cloudagent.storage.base.
BaseStorage
[source]¶ Bases:
abc.ABC
Abstract Non-Secrets interface.
-
add_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Add a new record to the store.
Parameters: record – StorageRecord to be stored
-
delete_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Delete an existing record.
Parameters: record – StorageRecord to delete
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to delete
- tags – Tags
-
get_record
(record_type: str, record_id: str, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a record from the store by type and ID.
Parameters: - record_type – The record type
- record_id – The record id
- options – A dictionary of backend-specific options
Returns: A StorageRecord instance
-
search_records
(type_filter: str, tag_query: Mapping[KT, VT_co] = None, page_size: int = None, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.base.BaseStorageRecordSearch[source]¶ Create a new record query.
Parameters: - type_filter – Filter string
- tag_query – Tags to query
- page_size – Page size
- options – Dictionary of backend-specific options
Returns: An instance of BaseStorageRecordSearch
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to update
- tags – New tags
-
-
class
aries_cloudagent.storage.base.
BaseStorageRecordSearch
(store: aries_cloudagent.storage.base.BaseStorage, type_filter: str, tag_query: Mapping[KT, VT_co], page_size: int = None, options: Mapping[KT, VT_co] = None)[source]¶ Bases:
abc.ABC
Represent an active stored records search.
-
fetch
(max_count: int) → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch the next list of results from the store.
Parameters: max_count – Max number of records to return Returns: A list of StorageRecord
-
fetch_all
() → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch all records from the query.
-
fetch_single
() → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a single query result.
-
handle
¶ Handle a search request.
-
opened
¶ Accessor for open state.
Returns: True if opened, else False
-
option
(name: str, default=None)[source]¶ Fetch a named search option, if defined.
Returns: The option value or default
-
options
¶ Accessor for the search options.
Returns: The search options
-
page_size
¶ Accessor for page size.
Returns: The page size
-
store
¶ BaseStorage backend for this implementation.
Returns: The BaseStorage implementation being used
-
tag_query
¶ Accessor for tag query.
Returns: The tag query
-
type_filter
¶ Accessor for type filter.
Returns: The type filter
-
aries_cloudagent.storage.basic module¶
Basic in-memory storage implementation (non-wallet).
-
class
aries_cloudagent.storage.basic.
BasicStorage
(_wallet: aries_cloudagent.wallet.base.BaseWallet = None)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorage
Basic in-memory storage class.
-
add_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Add a new record to the store.
Parameters: record – StorageRecord to be stored
Raises: StorageError
– If no record is providedStorageError
– If the record has no ID
-
delete_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Delete a record.
Parameters: record – StorageRecord to delete Raises: StorageNotFoundError
– If record not found
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to delete
- tags – Tags
Raises: StorageNotFoundError
– If record not found
-
get_record
(record_type: str, record_id: str, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a record from the store by type and ID.
Parameters: - record_type – The record type
- record_id – The record id
- options – A dictionary of backend-specific options
Returns: A StorageRecord instance
Raises: StorageNotFoundError
– If the record is not found
-
search_records
(type_filter: str, tag_query: Mapping[KT, VT_co] = None, page_size: int = None, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.basic.BasicStorageRecordSearch[source]¶ Search stored records.
Parameters: - type_filter – Filter string
- tag_query – Tags to query
- page_size – Page size
- options – Dictionary of backend-specific options
Returns: An instance of BaseStorageRecordSearch
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to update
- tags – New tags
Raises: StorageNotFoundError
– If record not found
-
-
class
aries_cloudagent.storage.basic.
BasicStorageRecordSearch
(store: aries_cloudagent.storage.basic.BasicStorage, type_filter: str, tag_query: Mapping[KT, VT_co], page_size: int = None, options: Mapping[KT, VT_co] = None)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorageRecordSearch
Represent an active stored records search.
-
fetch
(max_count: int) → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch the next list of results from the store.
Parameters: max_count – Max number of records to return Returns: A list of StorageRecord Raises: StorageSearchError
– If the search query has not been opened
-
opened
¶ Accessor for open state.
Returns: True if opened, else False
-
aries_cloudagent.storage.error module¶
Storage-related exceptions.
-
exception
aries_cloudagent.storage.error.
StorageDuplicateError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.storage.error.StorageError
Duplicate record found in storage.
-
exception
aries_cloudagent.storage.error.
StorageError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseError
Base class for Storage errors.
-
exception
aries_cloudagent.storage.error.
StorageNotFoundError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.storage.error.StorageError
Record not found in storage.
-
exception
aries_cloudagent.storage.error.
StorageSearchError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.storage.error.StorageError
General exception during record search.
aries_cloudagent.storage.indy module¶
Indy implementation of BaseStorage interface.
-
class
aries_cloudagent.storage.indy.
IndyStorage
(wallet: aries_cloudagent.wallet.indy.IndyWallet)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorage
Indy Non-Secrets interface.
-
add_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Add a new record to the store.
Parameters: record – StorageRecord to be stored
-
delete_record
(record: aries_cloudagent.storage.record.StorageRecord)[source]¶ Delete a record.
Parameters: record – StorageRecord to delete
Raises: StorageNotFoundError
– If record not foundStorageError
– If a libindy error occurs
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to delete
- tags – Tags
-
get_record
(record_type: str, record_id: str, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.record.StorageRecord[source]¶ Fetch a record from the store by type and ID.
Parameters: - record_type – The record type
- record_id – The record id
- options – A dictionary of backend-specific options
Returns: A StorageRecord instance
Raises: StorageError
– If the record is not providedStorageError
– If the record ID not providedStorageNotFoundError
– If the record is not foundStorageError
– If record not found
-
search_records
(type_filter: str, tag_query: Mapping[KT, VT_co] = None, page_size: int = None, options: Mapping[KT, VT_co] = None) → aries_cloudagent.storage.indy.IndyStorageRecordSearch[source]¶ Search stored records.
Parameters: - type_filter – Filter string
- tag_query – Tags to query
- page_size – Page size
- options – Dictionary of backend-specific options
Returns: An instance of IndyStorageRecordSearch
Update an existing stored record’s tags.
Parameters: - record – StorageRecord to update
- tags – New tags
Raises: StorageNotFoundError
– If record not foundStorageError
– If a libindy error occurs
-
update_record_value
(record: aries_cloudagent.storage.record.StorageRecord, value: str)[source]¶ Update an existing stored record’s value.
Parameters: - record – StorageRecord to update
- value – The new value
Raises: StorageNotFoundError
– If record not foundStorageError
– If a libindy error occurs
-
wallet
¶ Accessor for IndyWallet instance.
-
-
class
aries_cloudagent.storage.indy.
IndyStorageRecordSearch
(store: aries_cloudagent.storage.indy.IndyStorage, type_filter: str, tag_query: Mapping[KT, VT_co], page_size: int = None, options: Mapping[KT, VT_co] = None)[source]¶ Bases:
aries_cloudagent.storage.base.BaseStorageRecordSearch
Represent an active stored records search.
-
fetch
(max_count: int) → Sequence[aries_cloudagent.storage.record.StorageRecord][source]¶ Fetch the next list of results from the store.
Parameters: max_count – Max number of records to return Returns: A list of StorageRecord Raises: StorageSearchError
– If the search query has not been opened
-
handle
¶ Accessor for search handle.
Returns: The handle
-
opened
¶ Accessor for open state.
Returns: True if opened, else False
-
aries_cloudagent.storage.provider module¶
Default storage provider classes.
-
class
aries_cloudagent.storage.provider.
StorageProvider
[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for the default configurable storage classes.
-
STORAGE_TYPES
= {'basic': 'aries_cloudagent.storage.basic.BasicStorage', 'indy': 'aries_cloudagent.storage.indy.IndyStorage', 'postgres_storage': 'aries_cloudagent.storage.indy.IndyStorage'}¶
-
aries_cloudagent.storage.record module¶
Record instance stored and searchable by BaseStorage implementation.
-
class
aries_cloudagent.storage.record.
StorageRecord
[source]¶ Bases:
aries_cloudagent.storage.record.StorageRecord
Storage record class.