heroforge_core/sync/mod.rs
1//! Heroforge repository synchronization.
2//!
3//! This module implements the Heroforge sync protocol for pushing and pulling
4//! artifacts between repositories over QUIC.
5//!
6//! # Protocol Overview
7//!
8//! Heroforge sync uses a simple line-oriented protocol:
9//!
10//! 1. Client sends login credentials and push/pull cards
11//! 2. Client sends igot cards for artifacts it has
12//! 3. Client sends gimme cards for artifacts it wants
13//! 4. Server responds with file cards containing requested artifacts
14//! 5. Server sends igot cards for artifacts client doesn't have
15//!
16//! # Example (Builder API)
17//!
18//! ```no_run
19//! use heroforge_core::Repository;
20//!
21//! let repo = Repository::open("local.forge")?;
22//!
23//! // Sync over QUIC
24//! repo.sync()
25//! .to("quic://example.com:4443/repo")
26//! .push()?;
27//! # Ok::<(), heroforge_core::FossilError>(())
28//! ```
29
30mod builder;
31mod client;
32mod protocol;
33
34#[cfg(feature = "sync-quic")]
35pub mod quic;
36
37pub use builder::{SyncBuilder, SyncProtocol, SyncResult};
38pub use client::SyncClient;
39pub use protocol::{Card, Message};
40
41#[cfg(feature = "sync-quic")]
42pub use quic::{QuicClient, QuicServer, SyncStats as QuicSyncStats};