Some checks failed
Publish Swift Package / build-test-publish (push) Failing after 20s
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
36 lines
962 B
Swift
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 }
|
|
}
|