julee.repositories.memory.document ================================== .. py:module:: julee.repositories.memory.document .. autoapi-nested-parse:: Memory implementation of DocumentRepository. This module provides an in-memory implementation of the DocumentRepository protocol that follows the Clean Architecture patterns defined in the Fun-Police Framework. It handles document storage with content and metadata in memory dictionaries, ensuring idempotency and proper error handling. The implementation uses Python dictionaries to store document data, making it ideal for testing scenarios where external dependencies should be avoided. All operations are still async to maintain interface compatibility. Attributes ---------- .. autoapisummary:: julee.repositories.memory.document.logger Classes ------- .. autoapisummary:: julee.repositories.memory.document.MemoryDocumentRepository Module Contents --------------- .. py:class:: MemoryDocumentRepository Bases: :py:obj:`julee.domain.repositories.document.DocumentRepository`, :py:obj:`julee.repositories.memory.base.MemoryRepositoryMixin`\ [\ :py:obj:`julee.domain.models.document.Document`\ ] Memory implementation of DocumentRepository using Python dictionaries. This implementation stores document metadata and content in memory: - Documents: Dictionary keyed by document_id containing Document objects This provides a lightweight, dependency-free option for testing while maintaining the same interface as other implementations. .. py:method:: generate_id() :async: Generate a unique document identifier. :returns: Unique document ID string .. py:method:: get(document_id) :async: Retrieve a document with metadata and content. :param document_id: Unique document identifier :returns: Document object if found, None otherwise .. py:method:: get_many(document_ids) :async: Retrieve multiple documents by ID. :param document_ids: List of unique document identifiers :returns: Dict mapping document_id to Document (or None if not found) .. py:method:: list_all() :async: List all documents. :returns: List of all Document entities in the repository .. py:method:: save(document) :async: Save a document with its content and metadata. If the document has content_string, it will be converted to a ContentStream and the content hash will be calculated automatically. :param document: Document object to save :raises ValueError: If document has no content or content_string .. py:attribute:: entity_name :value: 'Document' .. py:attribute:: logger .. py:attribute:: storage_dict :type: Dict[str, julee.domain.models.document.Document] .. py:data:: logger