//! Type definitions for anti-entropy synchronization.

/// Result of a sync operation.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SyncResult {
    /// Trees are already in sync.
    InSync,
    /// Synced some assertions.
    Synced {
        /// Number of assertions fetched and merged.
        count: usize,
    },
    /// Sync failed.
    Failed {
        /// Error message.
        error: String,
    },
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_sync_result_variants() {
        let in_sync = SyncResult::InSync;
        let synced = SyncResult::Synced { count: 5 };
        let failed = SyncResult::Failed { error: "test".into() };

        assert_eq!(in_sync, SyncResult::InSync);
        assert_eq!(synced, SyncResult::Synced { count: 5 });
        assert_eq!(failed, SyncResult::Failed { error: "test".into() });
    }
}
