Skip to main content

coven_replication/sync/store/commit_publication/
mod.rs

1use super::*;
2use crate::sync::store::authorization::history::AuthorizedStoreHistory;
3use crate::sync::store::pull;
4use std::sync::Arc;
5pub(crate) mod operation;
6mod signing;
7
8pub(crate) use signing::LocalStoreWriter;
9pub(crate) use signing::LocalWriterKeyrings;
10use signing::StoreOperationSigningContext;
11
12pub use operation::StoreWriterAuthorizationError;
13
14#[derive(Clone, Copy)]
15pub(crate) struct SnapshotHistoryConstruction;
16
17pub struct AuthorizedWriterOperation<'storage> {
18    database: StoreDatabase,
19    history: AuthorizedStoreHistory<'storage>,
20    storage: &'storage Arc<dyn CloudSyncObjectStorage>,
21    store_dir: &'storage StoreDir,
22    membership: coven_protocol::membership::MembershipChain,
23    writer: Arc<LocalStoreWriter>,
24    keyrings: LocalWriterKeyrings<'storage>,
25}
26
27impl<'storage> AuthorizedWriterOperation<'storage> {
28    /// The provider-operation counter of the storage this operation publishes
29    /// through, so a run over it can report each stage's count beside its time.
30    pub(crate) fn provider_requests(
31        &self,
32    ) -> Option<Arc<dyn coven_foundation::stage_timing::ProviderRequests>> {
33        self.storage.provider_requests()
34    }
35
36    pub(super) fn from_parts(
37        database: StoreDatabase,
38        history: AuthorizedStoreHistory<'storage>,
39        storage: &'storage Arc<dyn CloudSyncObjectStorage>,
40        store_dir: &'storage StoreDir,
41        membership: coven_protocol::membership::MembershipChain,
42        writer: Arc<LocalStoreWriter>,
43        keyrings: LocalWriterKeyrings<'storage>,
44    ) -> Self {
45        Self {
46            database,
47            history,
48            storage,
49            store_dir,
50            membership,
51            writer,
52            keyrings,
53        }
54    }
55}