|
|
|
@ -278,7 +278,7 @@ public class SyncedCollection<T : SyncedStorable>: SomeSyncedCollection, Collect |
|
|
|
// MARK: - Asynchronous operations |
|
|
|
// MARK: - Asynchronous operations |
|
|
|
|
|
|
|
|
|
|
|
/// Adds or update an instance asynchronously and waits for network operations |
|
|
|
/// Adds or update an instance asynchronously and waits for network operations |
|
|
|
func addOrUpdateAsync(instance: T) async throws { |
|
|
|
public func addOrUpdateAsync(instance: T) async throws { |
|
|
|
let result = _addOrUpdateCore(instance: instance) |
|
|
|
let result = _addOrUpdateCore(instance: instance) |
|
|
|
if result.method == .insert { |
|
|
|
if result.method == .insert { |
|
|
|
try await self._executeBatchOnce(OperationBatch(insert: instance)) |
|
|
|
try await self._executeBatchOnce(OperationBatch(insert: instance)) |
|
|
|
@ -287,7 +287,7 @@ public class SyncedCollection<T : SyncedStorable>: SomeSyncedCollection, Collect |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func addOrUpdateAsync(contentOfs sequence: any Sequence<T>) async throws { |
|
|
|
public func addOrUpdateAsync(contentOfs sequence: any Sequence<T>) async throws { |
|
|
|
let batch = self._addOrUpdateCore(contentOfs: sequence) |
|
|
|
let batch = self._addOrUpdateCore(contentOfs: sequence) |
|
|
|
try await self._executeBatchOnce(batch) |
|
|
|
try await self._executeBatchOnce(batch) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -300,7 +300,7 @@ public class SyncedCollection<T : SyncedStorable>: SomeSyncedCollection, Collect |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Deletes an instance and writes |
|
|
|
/// Deletes an instance and writes |
|
|
|
func deleteAsync(instance: T) async throws { |
|
|
|
public func deleteAsync(instance: T) async throws { |
|
|
|
self.collection.delete(instance: instance, actionOption: .syncedCascade) |
|
|
|
self.collection.delete(instance: instance, actionOption: .syncedCascade) |
|
|
|
self.storeCenter.createDeleteLog(instance) |
|
|
|
self.storeCenter.createDeleteLog(instance) |
|
|
|
try await self._executeBatchOnce(OperationBatch(delete: instance)) |
|
|
|
try await self._executeBatchOnce(OperationBatch(delete: instance)) |
|
|
|
|