Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(datastore): Dispatch outboxStatus, subscriptionsEstablished, syncQueriesStarted events #721

Merged
merged 24 commits into from
Sep 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
19ade20
networkStatus not implemented
ruiguoamz Aug 25, 2020
ee22220
Network Status isn't implemented yet and need to check payload of mod…
ruiguoamz Aug 17, 2020
5c578a9
revert some changes
ruiguoamz Aug 25, 2020
e59be63
push one unsaved change
ruiguoamz Aug 25, 2020
e6db87a
removed one commented out block
ruiguoamz Aug 25, 2020
beaf801
removed one commented out block
ruiguoamz Aug 25, 2020
2fc86e6
addressed some comments
ruiguoamz Aug 28, 2020
c12e462
Merge branch 'datastore/hub' of https://github.com/aws-amplify/amplif…
ruiguoamz Aug 28, 2020
6d27bad
removed 3 hub events implementation, 4 to be implemented
ruiguoamz Sep 2, 2020
0a03b27
did some clean up
ruiguoamz Sep 2, 2020
d222390
switching branch
ruiguoamz Sep 2, 2020
f2263af
removed outboxMutation*Event, now only three implemented 3,4,5
ruiguoamz Sep 3, 2020
e4315f7
did some clean up
ruiguoamz Sep 3, 2020
9de6be5
fixed some comments
ruiguoamz Sep 3, 2020
9c5f606
switching position of dispatchSyncQueriesStarted
ruiguoamz Sep 3, 2020
d962a58
fixed comments for subscriptionEstablished
ruiguoamz Sep 3, 2020
2a91473
fixed some comments for outboxStatus and subscriptionsEstablished
ruiguoamz Sep 3, 2020
de6e778
fixed PR comments and added integration tests
ruiguoamz Sep 3, 2020
effabe9
improved hub events integration test and outgoingMutaitonQueue.swift …
ruiguoamz Sep 3, 2020
fe6fb22
spelling and format correction
ruiguoamz Sep 3, 2020
720cbd9
updated some unit tests to cover syncQueriesStarted, outboxStatus, bu…
ruiguoamz Sep 3, 2020
f534255
fix a bug that causes unit test to fail
ruiguoamz Sep 3, 2020
7645ba2
updated a test to cover subscriptionsEstablished
ruiguoamz Sep 3, 2020
9c88647
addressed tim's re-review's comments
ruiguoamz Sep 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed some comments
ruiguoamz committed Sep 3, 2020
commit 9de6be509d82576d23f66c6b42cdf94c339718a3
Original file line number Diff line number Diff line change
@@ -121,12 +121,12 @@ final class AWSInitialSyncOrchestrator: InitialSyncOrchestrator {
}

private func dispatchSyncQueriesStarted(_ syncableModels: [Model.Type]) {
lawmicha marked this conversation as resolved.
Show resolved Hide resolved
let modelTask = syncableModels.map { $0.modelName }
let modelNames = syncableModels.map { $0.modelName }

let syncQueriesStartedEvent = SyncQueriesStartedEvent(models: modelTask)
let syncQueriesStartedpayload = HubPayload(eventName: HubPayload.EventName.DataStore.syncQueriesStarted,
let syncQueriesStartedEvent = SyncQueriesStartedEvent(models: modelNames)
let syncQueriesStartedEventPayload = HubPayload(eventName: HubPayload.EventName.DataStore.syncQueriesStarted,
data: syncQueriesStartedEvent)
lawmicha marked this conversation as resolved.
Show resolved Hide resolved
Amplify.Hub.dispatch(to: .dataStore, payload: syncQueriesStartedpayload)
Amplify.Hub.dispatch(to: .dataStore, payload: syncQueriesStartedEventPayload)
}

}
Original file line number Diff line number Diff line change
@@ -80,9 +80,9 @@ final class OutgoingMutationQueue: OutgoingMutationQueueBehavior {
mutationEventPublisher: MutationEventPublisher) {
log.verbose(#function)
let outboxStatusEvent = OutboxStatusEvent(isEmpty: operationQueue.operationCount == 0 ? true : false)
let outboxStatusPayload = HubPayload(eventName: HubPayload.EventName.DataStore.outboxStatus,
let outboxStatusEventPayload = HubPayload(eventName: HubPayload.EventName.DataStore.outboxStatus,
data: outboxStatusEvent)
Amplify.Hub.dispatch(to: .dataStore, payload: outboxStatusPayload)
Amplify.Hub.dispatch(to: .dataStore, payload: outboxStatusEventPayload)
stateMachine.notify(action: .receivedStart(api, mutationEventPublisher))
lawmicha marked this conversation as resolved.
Show resolved Hide resolved
}

@@ -194,9 +194,9 @@ final class OutgoingMutationQueue: OutgoingMutationQueueBehavior {
operationQueue.addOperation(syncMutationToCloudOperation)

let outboxStatusEvent = OutboxStatusEvent(isEmpty: operationQueue.operationCount == 0 ? true : false)
let outboxStatusPayload = HubPayload(eventName: HubPayload.EventName.DataStore.outboxStatus,
let outboxStatusEventPayload = HubPayload(eventName: HubPayload.EventName.DataStore.outboxStatus,
data: outboxStatusEvent)
Amplify.Hub.dispatch(to: .dataStore, payload: outboxStatusPayload)
Amplify.Hub.dispatch(to: .dataStore, payload: outboxStatusEventPayload)

stateMachine.notify(action: .enqueuedEvent)
}
@@ -252,9 +252,9 @@ final class OutgoingMutationQueue: OutgoingMutationQueueBehavior {
}

let outboxStatusEvent = OutboxStatusEvent(isEmpty: self.operationQueue.operationCount == 0 ? true : false)
let outboxStatusPayload = HubPayload(eventName: HubPayload.EventName.DataStore.outboxStatus,
let outboxStatusEventPayload = HubPayload(eventName: HubPayload.EventName.DataStore.outboxStatus,
data: outboxStatusEvent)
Amplify.Hub.dispatch(to: .dataStore, payload: outboxStatusPayload)
Amplify.Hub.dispatch(to: .dataStore, payload: outboxStatusEventPayload)

self.stateMachine.notify(action: .processedEvent)
}