Skip to content

Commit

Permalink
add doc for reconcile
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed Nov 28, 2023
1 parent 776b32e commit e786c99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Amplify/Categories/DataStore/Subscribe/MutationEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public struct MutationEvent: Model {
public var json: String
public var mutationType: String
public var createdAt: Temporal.DateTime

@available(*, deprecated, message: "version field is deprecated")
public var version: Int?
public var inProcess: Bool
public var graphQLFilterJSON: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ class ReconcileAndLocalSaveOperation: AsynchronousOperation {

// MARK: - Responder methods

/// The reconcile function incorporates incoming mutation events into the local database through the following steps:
/// 1. Retrieve the local metadata of the models.
/// 2. Generate dispositions based on incoming mutation events and local metadata.
/// 3. Categorize dispositions into:
/// 3.1 Apply metadata only for those with existing pending mutations.
/// 3.1.1 Notify the count of these incoming mutation events as dropped items.
/// 3.2 Apply incoming mutation and metadata for those without existing pending mutations.
/// 4. Notify the final result.
func reconcile(remoteModels: [RemoteModel]) {
guard !isCancelled else {
log.info("\(#function) - cancelled, aborting")
Expand Down

0 comments on commit e786c99

Please sign in to comment.