steid

@jamesgill /

steid/src/domain/repository/instance_settings_repo.rs
Rust821 BCode·Blame·History·Raw
1use super::RepositoryResult;
2use crate::domain::InstanceSettings;
3
4/// Persistence for [`InstanceSettings`] — the one row an instance has about itself.
5///
6/// No `find`, because there is nothing to find by: the row always exists. An adapter
7/// that cannot see one answers the default rather than `None`, so a caller never has
8/// to decide what an instance with no settings row means.
9pub trait InstanceSettingsRepository: Send + Sync {
10 /// The instance's settings. The defaults on an instance nobody has configured.
11 fn load(&self) -> impl Future<Output = RepositoryResult<InstanceSettings>> + Send;
12
13 /// Replaces them wholesale. There is one row, so there is nothing to merge.
14 fn save(
15 &self,
16 settings: &InstanceSettings,
17 ) -> impl Future<Output = RepositoryResult<()>> + Send;
18}