Skip to main content

made_core/ports/
deliberation_repository.rs

1//! [`DeliberationRepositoryPort`] — persistence for deliberations
2//! across process restarts / replicas.
3
4use async_trait::async_trait;
5
6use crate::entities::Deliberation;
7use crate::error::DomainError;
8use crate::value_objects::TaskId;
9
10#[async_trait]
11pub trait DeliberationRepositoryPort: Send + Sync {
12    /// Persist (or update) a deliberation keyed by its task id.
13    async fn save(&self, deliberation: &Deliberation) -> Result<(), DomainError>;
14
15    /// Fetch a deliberation by task id. Returns
16    /// [`DomainError::NotFound`] when absent.
17    async fn get(&self, task_id: &TaskId) -> Result<Deliberation, DomainError>;
18
19    /// Cheap existence check.
20    async fn exists(&self, task_id: &TaskId) -> Result<bool, DomainError>;
21}