Skip to main content

fast_cache/replication/
mod.rs

1//! Native fast-cache replication.
2//!
3//! Replication is intentionally separate from WAL/AOF/PSYNC. WAL remains the
4//! local crash-recovery path; this module emits compact storage-level mutation
5//! batches for async read replicas and service subscribers.
6
7mod backlog;
8mod batcher;
9mod embedded;
10mod metrics;
11mod protocol;
12mod transport;
13
14/// Immutable FCRP wire frame shared by backlog, subscribers, and transports.
15///
16/// Keeping the encoded frame in the same byte owner used by `bytes-handoff`
17/// lets broadcast/retry paths pass it through without copying the payload.
18pub(super) type ReplicationFrameBytes = bytes::Bytes;
19
20pub use backlog::{BacklogCatchUp, ReplicationBacklog};
21pub(crate) use batcher::ReplicationBatchBuilder;
22pub use batcher::ReplicationPrimary;
23pub use embedded::{ReplicatedEmbeddedStore, ReplicationReplica};
24pub use metrics::{ReplicationMetrics, ReplicationMetricsSnapshot};
25pub use protocol::{
26    BorrowedReplicationMutation, FCRP_MAGIC, FCRP_VERSION, FrameKind, HelloRole,
27    ReplicationCompressionMode, ReplicationFrame, ReplicationFramePayload, ReplicationHello,
28    ReplicationMutation, ReplicationSnapshot, ReplicationSnapshotChunk, ShardWatermarks,
29    decode_ack, decode_error, decode_frame, decode_frame_payload, decode_hello,
30    decode_mutation_batch, decode_snapshot_chunk, encode_ack, encode_error, encode_frame,
31    encode_hello, encode_mutation_batch, encode_snapshot_chunk, visit_mutation_batch_payload,
32};
33pub use transport::{ReplicationPrimaryServer, ReplicationReplicaClient, SnapshotProvider};