minos.aggregate.snapshots.repositories.abc
Classes
- class SnapshotRepository[source]
Bases:
SnapshotRepository,InjectableMixin- async get(name, uuid, transaction=None, **kwargs)[source]
Get a
RootEntityinstance from its identifier.- Parameters
name (Union[str, type[RootEntity]]) – Class name of the
RootEntity.uuid (UUID) – Identifier of the
RootEntity.transaction (Optional[TransactionEntry]) – The transaction within the operation is performed. If not any value is provided, then the transaction is extracted from the context var. If not any transaction is being scoped then the query is performed to the global snapshot.
kwargs – Additional named arguments.
- Returns
The
RootEntityinstance.- Return type
- async get_entry(name, uuid, **kwargs)[source]
Get a
SnapshotEntryfrom its identifier.- Parameters
- Returns
The
SnapshotEntryinstance.- Return type
- get_all(name, ordering=None, limit=None, streaming_mode=False, transaction=None, **kwargs)[source]
Get all
RootEntityinstances.- Parameters
name (str) – Class name of the
RootEntity.ordering (Optional[_Ordering]) – Optional argument to return the instance with specific ordering strategy. The default behaviour is to retrieve them without any order pattern.
limit (Optional[int]) – Optional argument to return only a subset of instances. The default behaviour is to return all the instances that meet the given condition.
streaming_mode (bool) – If
Truereturn the values in streaming directly from the database (keep an open database connection), otherwise preloads the full set of values on memory and then retrieves them.transaction (Optional[TransactionEntry]) – The transaction within the operation is performed. If not any value is provided, then the transaction is extracted from the context var. If not any transaction is being scoped then the query is performed to the global snapshot.
kwargs – Additional named arguments.
- Returns
An asynchronous iterator that containing the
RootEntityinstances.- Return type
AsyncIterator[RootEntity]
- async find(name, condition, ordering=None, limit=None, streaming_mode=False, transaction=None, **kwargs)[source]
Find a collection of
RootEntityinstances based on aCondition.- Parameters
name (Union[str, type[RootEntity]]) – Class name of the
RootEntity.condition (_Condition) – The condition that must be satisfied by the
RootEntityinstances.ordering (Optional[_Ordering]) – Optional argument to return the instance with specific ordering strategy. The default behaviour is to retrieve them without any order pattern.
limit (Optional[int]) – Optional argument to return only a subset of instances. The default behaviour is to return all the instances that meet the given condition.
streaming_mode (bool) – If
Truereturn the values in streaming directly from the database (keep an open database connection), otherwise preloads the full set of values on memory and then retrieves them.transaction (Optional[TransactionEntry]) – The transaction within the operation is performed. If not any value is provided, then the transaction is extracted from the context var. If not any transaction is being scoped then the query is performed to the global snapshot.
kwargs – Additional named arguments.
- Returns
An asynchronous iterator that containing the
RootEntityinstances.- Return type
AsyncIterator[RootEntity]
- async find_entries(name, condition, ordering=None, limit=None, streaming_mode=False, transaction=None, exclude_deleted=True, synchronize=True, **kwargs)[source]
Find a collection of
SnapshotEntryinstances based on aCondition.- Parameters
name (str) – Class name of the
RootEntity.condition (_Condition) – The condition that must be satisfied by the
RootEntityinstances.ordering (Optional[_Ordering]) – Optional argument to return the instance with specific ordering strategy. The default behaviour is to retrieve them without any order pattern.
limit (Optional[int]) – Optional argument to return only a subset of instances. The default behaviour is to return all the instances that meet the given condition.
streaming_mode (bool) – If
Truereturn the values in streaming directly from the database (keep an open database connection), otherwise preloads the full set of values on memory and then retrieves them.transaction (Optional[TransactionEntry]) – The transaction within the operation is performed. If not any value is provided, then the transaction is extracted from the context var. If not any transaction is being scoped then the query is performed to the global snapshot.
exclude_deleted (bool) – If
True, deletedRootEntityentries are included, otherwise deletedRootEntityentries are filtered.synchronize (bool) – If
Truea synchronization is performed before processing the query, otherwise the query is performed without any synchronization step.kwargs – Additional named arguments.
- Returns
An asynchronous iterator that containing the
RootEntityinstances.- Return type
- synchronize(**kwargs)[source]
Synchronize the snapshot to the latest available version.
- Parameters
kwargs – Additional named arguments.
- Returns
This method does not return anything.
- Return type
Awaitable[None]
- async destroy()
Destroy miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None
- classmethod from_config(config=None, **kwargs)
Build a new instance from config.
- Parameters
config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.
kwargs – Additional named arguments.
- Returns
A instance of the called class.
- Return type
S
- async setup()
Setup miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None