Skip to content

Add Guide for parallel processing in DataStore on iOS - #3236

Merged
medelman17 merged 2 commits into
aws-amplify:mainfrom
Kilo-Loco:feature/batch-operations-ios
May 26, 2021
Merged

Add Guide for parallel processing in DataStore on iOS#3236
medelman17 merged 2 commits into
aws-amplify:mainfrom
Kilo-Loco:feature/batch-operations-ios

Conversation

@Kilo-Loco

Copy link
Copy Markdown
Contributor

Issue #, if available:
N/A

Description of changes:
Added a Guide that shows user how to perform batch CRUD operations using Combine for iOS. New section named "DataStore" was also added to the Guides.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Kilo-Loco
Kilo-Loco requested a review from a team as a code owner May 18, 2021 00:20
@undefobj

Copy link
Copy Markdown
Contributor

One suggestion - maybe we use a different phrase other than "batch" for this guide? Batch terminology is something very specific with DynamoDB and I fear customers will get confused.

@drochetti

Copy link
Copy Markdown
Contributor

One suggestion - maybe we use a different phrase other than "batch" for this guide? Batch terminology is something very specific with DynamoDB and I fear customers will get confused.

I second this. Even outside of the DynamoDB scenarios, batching has deeper implications, It think what it's happening in this PR is more about parallel processing than batching.

@Kilo-Loco Kilo-Loco changed the title Add Guide for batch operations in DataStore on iOS Add Guide for parallel processing in DataStore on iOS May 19, 2021
@aspittel

Copy link
Copy Markdown
Contributor

I like the "in parallel" phrasing change and think this looks valuable, I'd love to hear more from some iOS focused folks on the team too.

@palpatim palpatim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool guide, and I also learned more about Combine. :) Minor notes below, but LGTM

Todo(name: "Profit")
]

let sink = Publishers.Sequence<[Todo], Never>(sequence: todos)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below: can simplify this to todos.publisher

}
```

`Publishers.Sequence` creates a `Publisher` where each model is passed to `.flatMap()` individually, allowing for each object to be saved to DataStore. `.collect()` emits a single array of all the elements collected, returning the saved models in `receiveValue`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"todos.publisher creates a ..."

@medelman17
medelman17 merged commit ad3a29c into aws-amplify:main May 26, 2021
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.

6 participants