-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathcheckpoint_synchronizer.rs
More file actions
36 lines (30 loc) · 1.04 KB
/
checkpoint_synchronizer.rs
File metadata and controls
36 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::sync::{Arc, LazyLock};
use feldera_types::{
checkpoint::{CheckpointMetadata, CheckpointSyncMetrics},
config::SyncConfig,
};
use crate::StorageBackend;
pub trait CheckpointSynchronizer: Sync {
fn push(
&self,
checkpoint: uuid::Uuid,
storage: Arc<dyn StorageBackend>,
remote_config: SyncConfig,
) -> anyhow::Result<Option<CheckpointSyncMetrics>>;
fn pull(
&self,
storage: Arc<dyn StorageBackend>,
remote_config: SyncConfig,
) -> anyhow::Result<(CheckpointMetadata, Option<CheckpointSyncMetrics>)>;
}
inventory::collect!(&'static dyn CheckpointSynchronizer);
/// Lazily resolves the checkpoint synchronizer.
///
/// This panic is safe as all enterprise builds must include the checkpoint-sync
/// crate.
pub static SYNCHRONIZER: LazyLock<&'static dyn CheckpointSynchronizer> = LazyLock::new(|| {
*inventory::iter::<&dyn CheckpointSynchronizer>
.into_iter()
.next()
.expect("no checkpoint synchronizer found; are enterprise features enabled?")
});