minos.aggregate.snapshots.repositories.abc

Classes

SnapshotRepository

class SnapshotRepository[source]

Bases: SnapshotRepository, InjectableMixin

async get(name, uuid, transaction=None, **kwargs)[source]

Get a RootEntity instance 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 RootEntity instance.

Return type

RootEntity

async get_entry(name, uuid, **kwargs)[source]

Get a SnapshotEntry from its identifier.

Parameters
  • name (str) – Class name of the RootEntity.

  • uuid (UUID) – Identifier of the RootEntity.

  • kwargs – Additional named arguments.

Returns

The SnapshotEntry instance.

Return type

SnapshotEntry

get_all(name, ordering=None, limit=None, streaming_mode=False, transaction=None, **kwargs)[source]

Get all RootEntity instances.

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 True return 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 RootEntity instances.

Return type

AsyncIterator[RootEntity]

async find(name, condition, ordering=None, limit=None, streaming_mode=False, transaction=None, **kwargs)[source]

Find a collection of RootEntity instances based on a Condition.

Parameters
  • name (Union[str, type[RootEntity]]) – Class name of the RootEntity.

  • condition (_Condition) – The condition that must be satisfied by the RootEntity instances.

  • 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 True return 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 RootEntity instances.

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 SnapshotEntry instances based on a Condition.

Parameters
  • name (str) – Class name of the RootEntity.

  • condition (_Condition) – The condition that must be satisfied by the RootEntity instances.

  • 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 True return 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, deleted RootEntity entries are included, otherwise deleted RootEntity entries are filtered.

  • synchronize (bool) – If True a 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 RootEntity instances.

Return type

AsyncIterator[SnapshotEntry]

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]

__init__(*args, already_setup=False, **kwargs)
Parameters

already_setup (bool) –

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

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

classmethod get_injectable_name()

Get the injectable name.

Returns

A str value.

Return type

str

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None