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

DataStore.save() with condition for remote storage #362

Conversation

lawmicha
Copy link
Contributor

@lawmicha lawmicha commented Mar 17, 2020

Description of changes

  • Add Codable conformance to QueryPredicate to allow encodinig/decoding to JSON, stored in MutationEvent. This is accomplished with AnyQueryPredicate for encoding array of predicates, and custom Codable for QueryOperator.
  • Storing queryPredicateJson in MutationEvent to allow decoding to QueryPredicate for 1. sending API requests with condition input on create/update mutations, and 2. handle conditional mutations in the AWSMutationDatabaseAdapter: MutationEventIngester.
  • AWSMutationDatabaseAdapter resolves conflicts for incoming candidate mutation events with conditions by saving the candidate. (does not drop/replace local with candidate, etc)

DRAFT

  • This is written on top of existing PR for DataStore.save() with conditiion for local store DataStore.save() with condition #355 . we will merge this into 355 as single PR.

  • Need to check for successful response from API, and that the response contains graphQL Errors like "Conditional save failed", then retrieve from remote, and update local storage

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lawmicha lawmicha force-pushed the feature/datastore-conditional-update branch 2 times, most recently from 723ae70 to d631c28 Compare March 23, 2020 16:26
@lawmicha lawmicha force-pushed the feature/datastore-conditional-update-cloud branch from f51c05a to 72381d1 Compare March 23, 2020 16:38
@lawmicha lawmicha changed the title DataStore.save - add predicate to mutation event DataStore.save() with condition for remote storage Mar 23, 2020
@lawmicha lawmicha merged commit 91f45de into feature/datastore-conditional-update Mar 24, 2020
@lawmicha lawmicha deleted the feature/datastore-conditional-update-cloud branch April 6, 2020 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant