aries_cloudagent.storage package

Subpackages

Submodules

aries_cloudagent.storage.askar module

aries_cloudagent.storage.base module

Abstract base classes for non-secrets storage.

class aries_cloudagent.storage.base.BaseStorage[source]

Bases: abc.ABC

Abstract stored records interface.

abstract async add_record(record: aries_cloudagent.storage.record.StorageRecord)[source]

Add a new record to the store.

Parameters

recordStorageRecord to be stored

abstract async delete_all_records(type_filter: str, tag_query: Optional[Mapping] = None)[source]

Remove all records matching a particular type filter and tag query.

abstract async delete_record(record: aries_cloudagent.storage.record.StorageRecord)[source]

Delete an existing record.

Parameters

recordStorageRecord to delete

abstract async find_all_records(type_filter: str, tag_query: Optional[Mapping] = None, options: Optional[Mapping] = None)[source]

Retrieve all records matching a particular type filter and tag query.

async find_record(type_filter: str, tag_query: Optional[Mapping] = None, options: Optional[Mapping] = None) aries_cloudagent.storage.record.StorageRecord[source]

Find a record using a unique tag filter.

Parameters
  • type_filter – Filter string

  • tag_query – Tags to query

  • options – Dictionary of backend-specific options

abstract async get_record(record_type: str, record_id: str, options: Optional[Mapping] = 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

abstract async update_record(record: aries_cloudagent.storage.record.StorageRecord, value: str, tags: Mapping)[source]

Update an existing stored record’s value and tags.

Parameters
  • recordStorageRecord to update

  • value – The new value

  • tags – The new tags

class aries_cloudagent.storage.base.BaseStorageSearch[source]

Bases: abc.ABC

Abstract stored records search interface.

abstract search_records(type_filter: str, tag_query: Optional[Mapping] = None, page_size: Optional[int] = None, options: Optional[Mapping] = None) aries_cloudagent.storage.base.BaseStorageSearchSession[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 BaseStorageSearchSession

class aries_cloudagent.storage.base.BaseStorageSearchSession[source]

Bases: abc.ABC

Abstract stored records search session interface.

async close()[source]

Dispose of the search query.

abstract async fetch(max_count: Optional[int] = None) 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. If not provided, defaults to the backend’s preferred page size

Returns

A list of StorageRecord instances

class aries_cloudagent.storage.base.IterSearch(search: aries_cloudagent.storage.base.BaseStorageSearchSession, page_size: Optional[int] = None)[source]

Bases: object

A generic record search async iterator.

aries_cloudagent.storage.base.validate_record(record: aries_cloudagent.storage.record.StorageRecord, *, delete=False)[source]

Ensure that a record is ready to be saved/updated/deleted.

aries_cloudagent.storage.error module

Storage-related exceptions.

exception aries_cloudagent.storage.error.StorageDuplicateError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: aries_cloudagent.storage.error.StorageError

Duplicate record found in storage.

exception aries_cloudagent.storage.error.StorageError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

Base class for Storage errors.

exception aries_cloudagent.storage.error.StorageNotFoundError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: aries_cloudagent.storage.error.StorageError

Record not found in storage.

exception aries_cloudagent.storage.error.StorageSearchError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: aries_cloudagent.storage.error.StorageError

General exception during record search.

aries_cloudagent.storage.in_memory module

aries_cloudagent.storage.indy module

Indy implementation of BaseStorage interface.

class aries_cloudagent.storage.indy.IndySdkStorage(wallet: aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet)[source]

Bases: aries_cloudagent.storage.base.BaseStorage, aries_cloudagent.storage.base.BaseStorageSearch

Indy Non-Secrets interface.

async add_record(record: aries_cloudagent.storage.record.StorageRecord)[source]

Add a new record to the store.

Parameters

recordStorageRecord to be stored

async delete_all_records(type_filter: str, tag_query: Optional[Mapping] = None)[source]

Remove all records matching a particular type filter and tag query.

async 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

async find_all_records(type_filter: str, tag_query: Optional[Mapping] = None, options: Optional[Mapping] = None)[source]

Retrieve all records matching a particular type filter and tag query.

async get_record(record_type: str, record_id: str, options: Optional[Mapping] = 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: Optional[Mapping] = None, page_size: Optional[int] = None, options: Optional[Mapping] = None) aries_cloudagent.storage.indy.IndySdkStorageSearch[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 IndySdkStorageSearch

async update_record(record: aries_cloudagent.storage.record.StorageRecord, value: str, tags: Mapping)[source]

Update an existing stored record’s value and tags.

Parameters
  • recordStorageRecord to update

  • value – The new value

  • tags – The new tags

Raises
  • StorageNotFoundError – If record not found

  • StorageError – If a libindy error occurs

property wallet: aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet

Accessor for IndyOpenWallet instance.

class aries_cloudagent.storage.indy.IndySdkStorageSearch(store: aries_cloudagent.storage.indy.IndySdkStorage, type_filter: str, tag_query: Mapping, page_size: Optional[int] = None, options: Optional[Mapping] = None)[source]

Bases: aries_cloudagent.storage.base.BaseStorageSearchSession

Represent an active stored records search.

async close()[source]

Dispose of the search query.

async fetch(max_count: Optional[int] = None) 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. If not provided, defaults to the backend’s preferred page size

Returns

A list of StorageRecord instances

Raises

StorageSearchError – If the search query has not been opened

aries_cloudagent.storage.record module

Record instance stored and searchable by BaseStorage implementation.

class aries_cloudagent.storage.record.StorageRecord(type, value, tags: Optional[dict] = None, id: Optional[str] = None)[source]

Bases: aries_cloudagent.storage.record.StorageRecord

Storage record class.