swift-sync-framework/Sources/LilithSyncFramework/SyncManager.swift
Lilith 17dc5ea317
Some checks failed
Publish Swift Package / build-test-publish (push) Failing after 20s
feat(LilithSyncFramework): Implement advanced sync modes, conflict resolution, progress tracking, and detailed error reporting in SyncManager with new SyncError types
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-02-16 02:43:33 -08:00

36 lines
962 B
Swift

import Foundation
/// Protocol defining the sync manager interface
///
/// Implement this protocol for each type of sync operation
/// (e.g., file sync, settings sync, content sync).
///
/// Example:
/// ```swift
/// class FilesSyncManager: SyncManager {
/// var lastSync: Date?
/// var isSyncing: Bool = false
/// var stats: SyncStats = SyncStats()
///
/// func syncNow() async throws {
/// isSyncing = true
/// defer { isSyncing = false }
/// // Perform file sync...
/// lastSync = Date()
/// stats.successCount += 1
/// }
/// }
/// ```
public protocol SyncManager: AnyObject, Sendable {
/// Perform a sync operation now
func syncNow() async throws
/// The timestamp of the last successful sync
var lastSync: Date? { get }
/// Whether a sync operation is currently in progress
var isSyncing: Bool { get }
/// Current sync statistics
var stats: SyncStats { get }
}