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
DependsOn Ids for Multipart/Mixed Batch #1020
Merged
biaol-odata
merged 5 commits into
OData:master
from
biaol-odata:master_dependsOnIdsForMultipartBatch
Jan 12, 2018
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2ce1695
dependsOn Ids for Multipart/Mixed Batch
biaol-odata 243bc90
CR comments.
biaol-odata 69b81cf
Addressing CR comment: using null dependsOnIds of MultipartMixed batc…
biaol-odata a745e95
Addressed addtional CR comments, primarily:
biaol-odata c7f10a4
Restricting BatchOperationRequestMessage.dependsOnIds from List<strin…
biaol-odata File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/Microsoft.OData.Core/MultipartMixed/DependsOnIdsTracker.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
//--------------------------------------------------------------------- | ||
// <copyright file="DependsOnIdsTracker.cs" company="Microsoft"> | ||
// Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. | ||
// </copyright> | ||
//--------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
|
||
namespace Microsoft.OData.MultipartMixed | ||
{ | ||
/// <summary> | ||
/// This class is to keep track of dependsOn ids and associated change set state, | ||
/// and to return dependsOn ids pertaining to current state of the batch processing. | ||
/// </summary> | ||
internal sealed class DependsOnIdsTracker | ||
{ | ||
/// <summary> | ||
/// List of top-level dependsOn ids seen so far. | ||
/// </summary> | ||
private readonly IList<string> topLevelDependsOnIds; | ||
|
||
/// <summary> | ||
/// List of depeondsOn ids seen so far in current change set. | ||
/// It should be empty if current processing is not within a change set. | ||
/// </summary> | ||
private readonly IList<string> changeSetDependsOnIds; | ||
|
||
/// <summary> | ||
/// Indicates whether current processing is inside a change set. | ||
/// </summary> | ||
private bool isInChangeSet; | ||
|
||
/// <summary> | ||
/// Constructor. | ||
/// Initial state is batch start, and within change set. | ||
/// </summary> | ||
internal DependsOnIdsTracker() | ||
{ | ||
this.topLevelDependsOnIds = new List<string>(); | ||
this.changeSetDependsOnIds = new List<string>(); | ||
this.isInChangeSet = false; | ||
} | ||
|
||
/// <summary> | ||
/// Sets up the internal states corresponding to starting of change set. | ||
/// </summary> | ||
internal void ChangeSetStarted() | ||
{ | ||
Debug.Assert(!isInChangeSet, "!isInChangeSet"); | ||
Debug.Assert(this.changeSetDependsOnIds.Count == 0); | ||
this.isInChangeSet = true; | ||
} | ||
|
||
/// <summary> | ||
/// Sets up the internal states corresponding to ending of change set. | ||
/// </summary> | ||
internal void ChangeSetEnded() | ||
{ | ||
Debug.Assert(isInChangeSet, "isInChangeSet"); | ||
this.isInChangeSet = false; | ||
this.changeSetDependsOnIds.Clear(); | ||
} | ||
|
||
/// <summary> | ||
/// Adds the id into the tracker. | ||
/// </summary> | ||
/// <param name="id">The operation request id to add.</param> | ||
internal void AddDependsOnId(string id) | ||
{ | ||
if (isInChangeSet) | ||
{ | ||
this.changeSetDependsOnIds.Add(id); | ||
} | ||
else | ||
{ | ||
this.topLevelDependsOnIds.Add(id); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Get the list of dependsOn ids for the current state. | ||
/// </summary> | ||
/// <returns>The read-only list of dependsOn ids for the current batch operation request.</returns> | ||
internal IEnumerable<string> GetDependsOnIds() | ||
{ | ||
return isInChangeSet ? this.changeSetDependsOnIds : this.topLevelDependsOnIds; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we start passing null, rather than ODataMultipartMixedBatchWriterUtils.GetChangeSetIdFromBoundary(this.changeSetBoundary)? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
groupId is introduced with JSON Batch. For MultipartMixed batch, we have changeset boundary instead and we originally considered groupId value is always null. And then we decided to use the value extracted from changeset boundary as group Id, likely from one of your comments.
In reply to: 160844104 [](ancestors = 160844104)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry; I was reacting to an apparent change to pass null here, but that was an old iteration. Now we pass GetChangeSetIdFromBoundary, which is what I would expect.
In reply to: 160846771 [](ancestors = 160846771,160844104)