MemoryRepository module (ska_db_oda.infrastructure.memory.repository)
This module contains implementation of the AbstractRepository class, using memory. Useful for development and tests as it doee not require a heavyweight database implementation.
- class ska_db_oda.infrastructure.memory.repository.MemoryBridge(entity_dict: Dict[U, Dict[int, T]])[source]
Implementation of the Repository bridge which persists entities in memory.
Entities will be stored in a nested dict: {<entity_id>: {<version>: <entity>}}
- create(entity: T) T [source]
Implementation of the RepositoryBridge method.
See
create()
docstring for details
- query(qry_params: QueryParams) List[U] [source]
Queries the latest version of the entity based on QueryParams class from the ODA and returns the corresponding entity ID
Returns an empty list if no entities in the repository match the parameters.
- Raises:
ValueError – if the qry_params are not supported
OSError – if an error occurs while querying the entity