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

[Preview] FeedRange: Add Json serialization support #1410

Merged
merged 6 commits into from
Apr 22, 2020

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented Apr 21, 2020

Description

This PR adds FeedRange.ToJsonString and FeedRange.FromJsonString to accommodate scenarios where a user might want to persist a FeedRange in a storage and have worker instances picking them up and assigning them.

IReadOnlyList<FeedRange> feedRanges = await container.GetFeedRangesAsync();
foreach (FeedRange feedRange in feedRanges)
{
     // Store feedRange.ToJsonString()
}

// Another process in another machine

string feedRangeSerialization = Store.ReadStoredFeedRange();
FeedRange feedRange = FeedRange.FromJsonString(feedRangeSerialization);
// use FeedRange, for example
FeedIterator iterator = container.GetChangeFeedStreamIterator(feedRange);

As part of the PR, the JsonConverters involved were unified (from 3 to 1), and overall serialization simplified (there were TryParse implementations before around the FeedRange implementations).

Type of change

  • New feature (non-breaking change which adds functionality)

@ealsur ealsur added the feature-request New feature or request label Apr 21, 2020
@ealsur ealsur self-assigned this Apr 21, 2020
@ealsur ealsur added this to In progress in Cosmos DB SDK team via automation Apr 21, 2020
Cosmos DB SDK team automation moved this from In progress to Reviewer approved Apr 21, 2020
@kirankumarkolli kirankumarkolli merged commit d96080f into master Apr 22, 2020
Cosmos DB SDK team automation moved this from Reviewer approved to Done Apr 22, 2020
@kirankumarkolli kirankumarkolli deleted the users/ealsur/feedrangestring branch April 22, 2020 20:50
ealsur added a commit that referenced this pull request Apr 22, 2020
* tojson fromjson

* emulator tests

* Simplifying serialization

* new tests

* message text

* else
j82w pushed a commit that referenced this pull request Apr 23, 2020
…1419)

* [Preview] FeedRange: Add Json serialization support (#1410)

* tojson fromjson

* emulator tests

* Simplifying serialization

* new tests

* message text

* else

* contract

* API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants