Skip to main content

appcore_sync/
sync.rs

1// =============================================================================
2//        #######
3//     ###       ###     F: sync.rs
4//    ##   ## ##   ##    P: AppCore-Runtime
5//         ## ##
6//                       C: 2026/05/31 13:38:42 by dnettoRaw
7//    ##   ## ##   ##    U: 2026/07/24 16:07:49 by dnettoRaw
8//      ###########      S: 1.0.1-rc.8
9// =============================================================================
10
11//! Minimal sync contracts and local implementations.
12mod checkpoint;
13mod chunk;
14mod client;
15mod codec;
16mod conflict;
17mod discovery;
18mod error;
19mod log;
20mod log_file;
21mod log_file_format;
22mod message_json;
23mod outbox;
24mod outbox_format;
25mod outbox_journal;
26mod outbox_journal_state;
27mod outbox_journal_view;
28mod outbox_size;
29mod outbox_stream;
30mod persistence;
31mod receiver;
32mod retry;
33mod snapshot;
34mod transport;
35mod types;
36mod wire;
37
38pub use checkpoint::{
39    FileSyncCheckpointStore, InMemorySyncCheckpointStore, SyncCheckpointStore,
40    MAX_CHECKPOINT_FILE_BYTES, MAX_CHECKPOINT_PEER_ID_BYTES, MAX_CHECKPOINT_RECORDS,
41    SYNC_CHECKPOINT_FORMAT_V1,
42};
43pub use chunk::{
44    split_sync_payload, SyncChunkAssembler, SyncChunkInsert, SyncChunkProgress, SyncChunkRange,
45    SyncPayloadChunk, MAX_SYNC_CHUNKS, MAX_SYNC_CHUNK_BYTES, MAX_SYNC_CHUNK_TOTAL_BYTES,
46    MAX_SYNC_TRANSFER_ID_BYTES,
47};
48pub use client::FollowerSyncClient;
49pub use conflict::{
50    InMemorySyncConflictStore, SyncConflict, SyncConflictKind, SyncConflictResolution,
51    SyncConflictResolutionReceipt, SyncConflictResolutionRequest, SyncConflictStore,
52    MAX_CONFLICT_ID_BYTES, MAX_CONFLICT_REASON_BYTES, MAX_SYNC_CONFLICTS,
53};
54pub use discovery::{discover_dns_sync_peers, SyncPeerAddress, SyncPeerScheme};
55pub use error::{SyncError, SyncResult};
56pub use log::{
57    FileReplicationLog, InMemoryReplicationLog, ReplicationLog, MAX_REPLICATION_PAGE_BYTES,
58    MAX_REPLICATION_PAGE_RECORDS, MAX_SYNC_BATCH_PAYLOAD_BYTES, REPLICATION_LOG_FORMAT_V1,
59};
60pub use message_json::write_sync_message_json;
61pub use outbox::{
62    FileSyncOutbox, InMemorySyncOutbox, SyncOutbox, SyncOutboxReceipt, SyncOutboxStats,
63    MAX_OUTBOX_PAGE_BYTES, MAX_OUTBOX_PAGE_MESSAGES, SYNC_OUTBOX_FORMAT_V2,
64};
65pub use outbox_size::encoded_sync_message_bytes;
66pub use receiver::{SyncReceiveAck, SyncReceiverState};
67pub use retry::{SyncPushMetrics, SyncRetryPolicy};
68pub use snapshot::{ReplicationSnapshot, ReplicationSnapshotRecord, SYNC_SNAPSHOT_FORMAT_V1};
69pub use transport::{
70    decode_sync_message, HttpSyncTransport, SyncTransport, MAX_SYNC_REQUEST_BODY_BYTES,
71};
72pub use types::{
73    compute_events_hash, HeartbeatMessage, LeaderElection, NodeRole, PeerInfo, SyncMessage,
74    SyncStatus,
75};
76pub use wire::{
77    decode_sync_envelope, encode_sync_envelope_v1, SyncEnvelopeV1, SYNC_WIRE_SCHEMA_V1,
78};
79
80#[cfg(test)]
81pub(crate) use transport::read_http_request_body;
82
83#[cfg(test)]
84mod sync_tests;