julee.repositories.memory.knowledge_service_query

Memory implementation of KnowledgeServiceQueryRepository.

This module provides an in-memory implementation of the KnowledgeServiceQueryRepository protocol that follows the Clean Architecture patterns defined in the Fun-Police Framework. It handles knowledge service query storage in memory dictionaries, ensuring idempotency and proper error handling.

The implementation uses Python dictionaries to store knowledge service query data, making it ideal for testing scenarios where external dependencies should be avoided.

Attributes

Classes

MemoryKnowledgeServiceQueryRepository

Memory implementation of KnowledgeServiceQueryRepository using Python

Module Contents

class julee.repositories.memory.knowledge_service_query.MemoryKnowledgeServiceQueryRepository[source]

Bases: julee.domain.repositories.knowledge_service_query.KnowledgeServiceQueryRepository, julee.repositories.memory.base.MemoryRepositoryMixin[julee.domain.models.assembly_specification.KnowledgeServiceQuery]

Memory implementation of KnowledgeServiceQueryRepository using Python dictionaries.

This implementation stores knowledge service queries in memory:

  • Queries: Dictionary keyed by query_id containing KnowledgeServiceQuery objects

This provides a lightweight, dependency-free option for testing while maintaining the same interface as other implementations.

async generate_id()[source]

Generate a unique query identifier.

Returns:

Unique string identifier for a new query

Return type:

str

async get(query_id)[source]

Retrieve a knowledge service query by ID.

Parameters:

query_id (str) – Unique query identifier

Returns:

KnowledgeServiceQuery object if found, None otherwise

Return type:

julee.domain.models.assembly_specification.KnowledgeServiceQuery | None

async get_many(query_ids)[source]

Retrieve multiple knowledge service queries by ID.

Parameters:

query_ids (list[str]) – List of unique query identifiers

Returns:

Dict mapping query_id to KnowledgeServiceQuery (or None if not found)

Return type:

dict[str, julee.domain.models.assembly_specification.KnowledgeServiceQuery | None]

async list_all()[source]

List all knowledge service queries.

Returns:

List of all knowledge service queries, sorted by query_id

Return type:

list[julee.domain.models.assembly_specification.KnowledgeServiceQuery]

async save(query)[source]

Store or update a knowledge service query.

Parameters:

query (julee.domain.models.assembly_specification.KnowledgeServiceQuery) – KnowledgeServiceQuery object to store

entity_name = 'KnowledgeServiceQuery'[source]
logger[source]
storage_dict: dict[str, julee.domain.models.assembly_specification.KnowledgeServiceQuery][source]
julee.repositories.memory.knowledge_service_query.logger[source]