steid

@jamesgill /

steid/src/domain/repository/push_event_repo.rs
Rust940 BCode·Blame·History·Raw
1use super::RepositoryResult;
2use crate::domain::{PushEvent, PushEventId, RepoId};
3
4/// Persistence for [`PushEvent`].
5///
6/// **No delete.** A push event is a record that something happened, and a history that
7/// can be rewritten is not one. Rows go when the repository does, through the foreign
8/// key.
9pub trait PushEventRepository: Send + Sync {
10 fn find(
11 &self,
12 id: &PushEventId,
13 ) -> impl Future<Output = RepositoryResult<Option<PushEvent>>> + Send;
14
15 /// The most recent events for a repository, newest first.
16 ///
17 /// Capped by the caller rather than returning everything: this table only grows,
18 /// and nothing has a use for the whole of it.
19 fn list_by_repo(
20 &self,
21 repo_id: &RepoId,
22 limit: usize,
23 ) -> impl Future<Output = RepositoryResult<Vec<PushEvent>>> + Send;
24
25 fn save(&self, event: &PushEvent) -> impl Future<Output = RepositoryResult<()>> + Send;
26}