Coverage for src / lexigram / contracts / data / outbox.py: 0%
10 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:57 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:57 +0800
1"""Transactional outbox protocol for reliable event delivery."""
3from __future__ import annotations
5from typing import Any, Protocol, runtime_checkable
7from lexigram.contracts.domain.events import DomainEvent
10@runtime_checkable
11class OutboxStoreProtocol(Protocol):
12 """Protocol for transactional outbox storage."""
14 async def append_batch(self, events: list[DomainEvent]) -> None:
15 """Write a batch of domain events to the outbox table atomically."""
16 ...
18 async def fetch_pending(self, limit: int = 100) -> list[dict[str, Any]]:
19 """Fetch undelivered outbox events."""
20 ...
22 async def mark_delivered(self, event_id: str) -> None:
23 """Mark an outbox event as successfully delivered."""
24 ...
26 async def mark_failed(self, event_id: str, error: str) -> None:
27 """Mark an outbox event as permanently failed."""
28 ...
31__all__ = [
32 "OutboxStoreProtocol",
33]