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:recordStorageRecord to be stored
delete_record(record: aries_cloudagent.storage.record.StorageRecord)[source]

Delete an existing record.

Parameters:recordStorageRecord to delete
delete_record_tags(record: aries_cloudagent.storage.record.StorageRecord, tags: (typing.Sequence, typing.Mapping))[source]

Update an existing stored record’s tags.

Parameters:
  • recordStorageRecord 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_record_tags(record: aries_cloudagent.storage.record.StorageRecord, tags: Mapping[KT, VT_co])[source]

Update an existing stored record’s tags.

Parameters:
  • recordStorageRecord to update
  • tags – New tags
update_record_value(record: aries_cloudagent.storage.record.StorageRecord, value: str)[source]

Update an existing stored record’s value.

Parameters:
  • recordStorageRecord to update
  • value – The new value
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.

close()[source]

Dispose of the search query.

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.

open()[source]

Start the search query.

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:

recordStorageRecord to be stored

Raises:
  • StorageError – If no record is provided
  • StorageError – If the record has no ID
delete_record(record: aries_cloudagent.storage.record.StorageRecord)[source]

Delete a record.

Parameters:recordStorageRecord to delete
Raises:StorageNotFoundError – If record not found
delete_record_tags(record: aries_cloudagent.storage.record.StorageRecord, tags: (typing.Sequence, typing.Mapping))[source]

Update an existing stored record’s tags.

Parameters:
  • recordStorageRecord 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_record_tags(record: aries_cloudagent.storage.record.StorageRecord, tags: Mapping[KT, VT_co])[source]

Update an existing stored record’s tags.

Parameters:
  • recordStorageRecord to update
  • tags – New tags
Raises:

StorageNotFoundError – If record not found

update_record_value(record: aries_cloudagent.storage.record.StorageRecord, value: str)[source]

Update an existing stored record’s value.

Parameters:
  • recordStorageRecord to update
  • value – The new value
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.

close()[source]

Dispose of the search query.

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
open()[source]

Start the search query.

opened

Accessor for open state.

Returns:True if opened, else False
aries_cloudagent.storage.basic.basic_tag_query_match(tags: dict, tag_query: dict) → bool[source]

Match simple tag filters (string values).

aries_cloudagent.storage.basic.basic_tag_value_match(value: str, match: dict) → bool[source]

Match a single tag against a tag subquery.

TODO: What type coercion is needed? (support int or float values?)

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:recordStorageRecord to be stored
delete_record(record: aries_cloudagent.storage.record.StorageRecord)[source]

Delete a record.

Parameters:

recordStorageRecord to delete

Raises:
  • StorageNotFoundError – If record not found
  • StorageError – If a libindy error occurs
delete_record_tags(record: aries_cloudagent.storage.record.StorageRecord, tags: (typing.Sequence, typing.Mapping))[source]

Update an existing stored record’s tags.

Parameters:
  • recordStorageRecord 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 provided
  • StorageError – If the record ID not provided
  • StorageNotFoundError – If the record is not found
  • StorageError – 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_record_tags(record: aries_cloudagent.storage.record.StorageRecord, tags: Mapping[KT, VT_co])[source]

Update an existing stored record’s tags.

Parameters:
  • recordStorageRecord to update
  • tags – New tags
Raises:
  • StorageNotFoundError – If record not found
  • StorageError – 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:
  • recordStorageRecord to update
  • value – The new value
Raises:
  • StorageNotFoundError – If record not found
  • StorageError – 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.

close()[source]

Dispose of the search query.

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
open()[source]

Start the search query.

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'}
provide(settings: aries_cloudagent.config.base.BaseSettings, injector: aries_cloudagent.config.base.BaseInjector)[source]

Create and return the storage instance.

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.