acapy_agent.storage package
Subpackages
- acapy_agent.storage.vc_holder package
- Submodules
- acapy_agent.storage.vc_holder.askar module
- acapy_agent.storage.vc_holder.base module
- acapy_agent.storage.vc_holder.kanon module
- acapy_agent.storage.vc_holder.vc_record module
- acapy_agent.storage.vc_holder.xform module
Submodules
acapy_agent.storage.askar module
acapy_agent.storage.base module
Abstract base classes for non-secrets storage.
- class acapy_agent.storage.base.BaseStorage[source]
Bases:
ABCAbstract stored records interface.
- abstractmethod async add_record(record: StorageRecord)[source]
Add a new record to the store.
- Parameters:
record – StorageRecord to be stored
- abstractmethod async delete_all_records(type_filter: str, tag_query: Mapping | None = None) None[source]
Remove all records matching a particular type filter and tag query.
- Parameters:
type_filter – The type of records to filter by.
tag_query – An optional dictionary of tag filter clauses.
- abstractmethod async delete_record(record: StorageRecord)[source]
Delete an existing record.
- Parameters:
record – StorageRecord to delete
- abstractmethod async find_all_records(type_filter: str, tag_query: Mapping | None = None, order_by: str | None = None, descending: bool = False, options: Mapping | None = None) Sequence[StorageRecord][source]
Retrieve all records matching a particular type filter and tag query.
- Parameters:
type_filter – The type of records to filter by.
tag_query – An optional dictionary of tag filter clauses.
order_by – An optional field by which to order the records.
descending – Whether to order the records in descending order.
options – Additional options for the query.
- abstractmethod async find_paginated_records(type_filter: str, tag_query: Mapping | None = None, limit: int = 100, offset: int = 0, order_by: str | None = None, descending: bool = False) Sequence[StorageRecord][source]
Retrieve a page of records matching a particular type filter and tag query.
- Parameters:
type_filter – The type of records to filter by
tag_query – An optional dictionary of tag filter clauses
limit – The maximum number of records to retrieve
offset – The offset to start retrieving records from
order_by – An optional field by which to order the records.
descending – Whether to order the records in descending order.
- Returns:
A sequence of StorageRecord matching the filter and query parameters.
- async find_record(type_filter: str, tag_query: Mapping | None = None, options: Mapping | None = None) 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
- abstractmethod async get_record(record_type: str, record_id: str, options: Mapping | None = None) 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
- abstractmethod async update_record(record: StorageRecord, value: str, tags: Mapping)[source]
Update an existing stored record’s value and tags.
- Parameters:
record – StorageRecord to update
value – The new value
tags – The new tags
- class acapy_agent.storage.base.BaseStorageSearch[source]
Bases:
ABCAbstract stored records search interface.
- abstractmethod search_records(type_filter: str, tag_query: Mapping | None = None, page_size: int | None = None, options: Mapping | None = None) 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 acapy_agent.storage.base.BaseStorageSearchSession[source]
Bases:
ABCAbstract stored records search session interface.
- abstractmethod async fetch(max_count: int | None = None) Sequence[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 acapy_agent.storage.base.IterSearch(search: BaseStorageSearchSession, page_size: int | None = None)[source]
Bases:
objectA generic record search async iterator.
- acapy_agent.storage.base.validate_record(record: StorageRecord, *, delete=False)[source]
Ensure that a record is ready to be saved/updated/deleted.
acapy_agent.storage.error module
Storage-related exceptions.
- exception acapy_agent.storage.error.StorageDuplicateError(*args, error_code: str | None = None, **kwargs)[source]
Bases:
StorageErrorDuplicate record found in storage.
- exception acapy_agent.storage.error.StorageError(*args, error_code: str | None = None, **kwargs)[source]
Bases:
BaseErrorBase class for Storage errors.
- exception acapy_agent.storage.error.StorageNotFoundError(*args, error_code: str | None = None, **kwargs)[source]
Bases:
StorageErrorRecord not found in storage.
- exception acapy_agent.storage.error.StorageSearchError(*args, error_code: str | None = None, **kwargs)[source]
Bases:
StorageErrorGeneral exception during record search.
acapy_agent.storage.kanon_storage module
Kanon storage implementation for non-secrets storage.
- class acapy_agent.storage.kanon_storage.KanonStorage(session: Profile)[source]
Bases:
BaseStorageKanon Non-Secrets interface.
- async add_record(record: StorageRecord, session: DBStoreSession | None = None)[source]
Add a new record to storage.
- async delete_all_records(type_filter: str, tag_query: Mapping | None = None, session: DBStoreSession | None = None)[source]
Delete all records matching the type and tag query.
- async delete_record(record: StorageRecord, session: DBStoreSession | None = None)[source]
Delete a record from storage.
- async find_all_records(type_filter: str, tag_query: Mapping | None = None, order_by: str | None = None, descending: bool = False, options: Mapping | None = None, session: DBStoreSession | None = None) Sequence[StorageRecord][source]
Retrieve all records matching the type and tag query.
- async find_paginated_records(type_filter: str, tag_query: Mapping | None = None, limit: int = 100, offset: int = 0, order_by: str | None = None, descending: bool = False) Sequence[StorageRecord][source]
Retrieve paginated records using DBStore.scan.
- async find_paginated_records_keyset(type_filter: str, tag_query: Mapping | None = None, last_id: int = None, limit: int = 100, order_by: str | None = None, descending: bool = False) Sequence[StorageRecord][source]
Retrieve paginated records using DBStore.scan_keyset.
- async find_record(type_filter: str, tag_query: Mapping, options: Mapping | None = None, session: DBStoreSession | None = None) StorageRecord[source]
Find a single record matching the type and tag query.
- async get_record(record_type: str, record_id: str, options: Mapping | None = None, session: DBStoreSession | None = None) StorageRecord[source]
Retrieve a single record by type and ID.
- property session: DBStoreSession
Get the database session.
- async update_record(record: StorageRecord, value: str, tags: Mapping, session: DBStoreSession | None = None)[source]
Update an existing record’s value and tags.
- class acapy_agent.storage.kanon_storage.KanonStorageSearch(profile: Profile)[source]
Bases:
BaseStorageSearchKanon storage search interface.
- search_records(type_filter: str, tag_query: Mapping | None = None, page_size: int | None = None, options: Mapping | None = None) KanonStorageSearchSession[source]
Search for records.
- class acapy_agent.storage.kanon_storage.KanonStorageSearchSession(profile, type_filter: str, tag_query: Mapping, page_size: int | None = None, options: Mapping | None = None)[source]
Bases:
BaseStorageSearchSessionKanon storage search session.
- async fetch(max_count: int | None = None, offset: int | None = None) Sequence[StorageRecord][source]
Fetch records.
- property handle
Get search handle.
- property opened: bool
Check if search is opened.
acapy_agent.storage.record module
Record instance stored and searchable by BaseStorage implementation.
- class acapy_agent.storage.record.StorageRecord(type, value, tags: dict | None = None, id: str | None = None)[source]
Bases:
StorageRecordStorage record class.
acapy_agent.storage.type module
Library version information.