forked from mtusi2026/mtusi2026lab6
Bring the application, own tests, Dockerfile, toolchain, compose stack, HAProxy, k6, RustFS and RabbitMQ configuration, migrations, hooks, scenario scripts and the CI job from the lab 5 solution commit 64d5c67, keep the lab 5 Makefile targets on top of the unchanged skeleton targets, and append the lab 5 solution variables to the skeleton .env.example. The package and the application follow the contract version 1.6.0, and the image, the throwaway test containers and the broker vhost description are tagged lab6 so they do not collide with a lab 5 stand on the same host. This is the starting point of the lab 6 cycle: lint, own tests and the offline skeleton check pass before any lab 6 change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
from collections.abc import Sequence
|
|
from contextlib import AbstractAsyncContextManager
|
|
from datetime import datetime
|
|
from typing import Any, Protocol, runtime_checkable
|
|
from uuid import UUID
|
|
|
|
from messenger.shared.domain.events import DomainEvent
|
|
|
|
|
|
@runtime_checkable
|
|
class Clock(Protocol):
|
|
def now(self) -> datetime: ...
|
|
|
|
|
|
@runtime_checkable
|
|
class IdGenerator(Protocol):
|
|
def new_id(self) -> UUID: ...
|
|
|
|
|
|
@runtime_checkable
|
|
class Logger(Protocol):
|
|
def info(self, event: str, /, **fields: Any) -> None: ...
|
|
|
|
def warning(self, event: str, /, **fields: Any) -> None: ...
|
|
|
|
def error(self, event: str, /, **fields: Any) -> None: ...
|
|
|
|
|
|
@runtime_checkable
|
|
class UnitOfWork(Protocol):
|
|
def transaction(self) -> AbstractAsyncContextManager[None]: ...
|
|
|
|
async def commit(self) -> None: ...
|
|
|
|
def record(self, event: DomainEvent) -> None: ...
|
|
|
|
def collect_new_events(self) -> list[DomainEvent]: ...
|
|
|
|
|
|
@runtime_checkable
|
|
class EventPublisher(Protocol):
|
|
async def publish(self, events: Sequence[DomainEvent]) -> None: ...
|