minor changes

sync3
Laurent 6 months ago
parent ec1f6825c0
commit 7e9de23986
  1. 2
      LeStorage/StoreCenter.swift
  2. 6
      LeStorage/SyncedCollection.swift

@ -627,7 +627,7 @@ public class StoreCenter {
} }
func testSynchronizeOnceAsync() async throws -> Data { @discardableResult func testSynchronizeOnceAsync() async throws -> Data {
guard self.isAuthenticated else { guard self.isAuthenticated else {
throw StoreError.missingToken throw StoreError.missingToken
} }

@ -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))

Loading…
Cancel
Save