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
37
38
39
40
41
42
43
44
45
46
//! [`SyncEngine`] trait — CDC-to-OLAP replication.
//!
//! The production implementation (`CdcSyncEngine` in `rhei-sync`) polls a
//! [`crate::CdcConsumer`], converts events to DML via the sync converter, and
//! applies them to an [`crate::OlapEngine`].
use crate;
/// Applies CDC events from the OLTP engine to the OLAP engine.
///
/// The sync loop (in `rhei-sync`) calls [`SyncEngine::sync_once`] repeatedly
/// on a configurable interval. A [`crate::SyncMode`] controls whether the OLAP
/// table is kept as a mirror (`Destructive`) or an append-only temporal store
/// (`Temporal` / SCD Type 2).
///
/// # Contract for implementors
///
/// - [`sync_once`](SyncEngine::sync_once) must be idempotent with respect to
/// network/storage failures: a partially-applied cycle must be recoverable by
/// re-running with the same watermark.
/// - [`status`](SyncEngine::status) must be cheap and non-blocking.