Repositories

Repositories store things. Not to be confused with Services, which do things.

A repository implements simple CRUD operations for Entities, abstracting storage technology.

Repositories are defined as Protocols; the DI container provides implementations.

CEAP Repository Protocols

The CEAP use case depends on these repository protocols:

MinIO Implementations

Production implementations using S3-compatible object storage:

Memory Implementations

In-memory implementations for testing:

These are volatile and unsuitable for production, but useful as testing doubles in unit tests that run fast and in parallel without external dependencies.

Implementing Repositories

Repository protocols can define any interface suitable for the domain. For the common case of simple CRUD operations, BaseRepository provides a generic starting point:

class DocumentRepository(BaseRepository[Document], Protocol):
    pass

Implementation mixins handle technology-specific boilerplate:

The DI container wires protocols to implementations at runtime.