From 152154a66c744516b9fbfd3e9421965be2f0ad8e Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Thu, 27 May 2021 11:08:43 -0700 Subject: [PATCH 1/4] out of preview --- .../src/ChangeFeed/ChangeFeedMode.cs | 14 +++---- .../src/ChangeFeed/ChangeFeedStartFrom.cs | 7 +--- .../src/FeedRange/FeedRange.cs | 7 +--- .../ChangeFeedRequestOptions.cs | 7 +--- .../src/Resource/Container/Container.cs | 38 +++++++++---------- .../Resource/Container/ContainerInternal.cs | 16 -------- 6 files changed, 29 insertions(+), 60 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs index 6539931c5f..d64a9942d5 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs @@ -10,12 +10,7 @@ namespace Microsoft.Azure.Cosmos /// Base class for the change feed mode . /// /// Use one of the static constructors to generate a ChangeFeedMode option. -#if PREVIEW - public -#else - internal -#endif - abstract class ChangeFeedMode + public abstract class ChangeFeedMode { /// /// Initializes an instance of the class. @@ -49,6 +44,11 @@ internal ChangeFeedMode() /// but no events for deletes or intermediary updates would be included. /// /// A to receive notifications for insertions, updates, and delete operations. - public static ChangeFeedMode FullFidelity => ChangeFeedModeFullFidelity.Instance; +#if PREVIEW + public +#else + internal +#endif + static ChangeFeedMode FullFidelity => ChangeFeedModeFullFidelity.Instance; } } diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs index 5fff3f31ab..c20cd8ebc0 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedStartFrom.cs @@ -13,12 +13,7 @@ namespace Microsoft.Azure.Cosmos /// Base class for where to start a ChangeFeed operation in . /// /// Use one of the static constructors to generate a StartFrom option. -#if PREVIEW - public -#else - internal -#endif - abstract class ChangeFeedStartFrom + public abstract class ChangeFeedStartFrom { /// /// Initializes an instance of the class. diff --git a/Microsoft.Azure.Cosmos/src/FeedRange/FeedRange.cs b/Microsoft.Azure.Cosmos/src/FeedRange/FeedRange.cs index 1829059e14..896215f488 100644 --- a/Microsoft.Azure.Cosmos/src/FeedRange/FeedRange.cs +++ b/Microsoft.Azure.Cosmos/src/FeedRange/FeedRange.cs @@ -10,12 +10,7 @@ namespace Microsoft.Azure.Cosmos /// Represents a unit of feed consumption that can be used as unit of parallelism. /// [Serializable] -#if PREVIEW || INTERNAL - public -#else - internal -#endif - abstract class FeedRange + public abstract class FeedRange { /// /// Gets a string representation of the current range. diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs index 8b0335eded..9b5490667f 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs @@ -13,12 +13,7 @@ namespace Microsoft.Azure.Cosmos /// /// The Cosmos Change Feed request options /// -#if PREVIEW - public -#else - internal -#endif - sealed class ChangeFeedRequestOptions : RequestOptions + public sealed class ChangeFeedRequestOptions : RequestOptions { private int? pageSizeHint; diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs index b65582d104..97dcf0ea26 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs @@ -1234,25 +1234,6 @@ public abstract ChangeFeedEstimator GetChangeFeedEstimator( /// A new instance of . public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); -#if INTERNAL - /// - /// Deletes all items in the Container with the specified value. - /// Starts an asynchronous Cosmos DB background operation which deletes all items in the Container with the specified value. - /// The asynchronous Cosmos DB background operation runs using a percentage of user RUs. - /// - /// The of the items to be deleted. - /// (Optional) The options for the Partition Key Delete request. - /// (Optional) representing request cancellation. - /// - /// A containing a . - /// - public abstract Task DeleteAllItemsByPartitionKeyStreamAsync( - Cosmos.PartitionKey partitionKey, - RequestOptions requestOptions = null, - CancellationToken cancellationToken = default(CancellationToken)); -#endif - -#if PREVIEW /// /// Obtains a list of that can be used to parallelize Feed operations. /// @@ -1363,6 +1344,25 @@ public abstract Task> GetPartitionKeyRangesAsync( FeedRange feedRange, CancellationToken cancellationToken = default); +#if INTERNAL + /// + /// Deletes all items in the Container with the specified value. + /// Starts an asynchronous Cosmos DB background operation which deletes all items in the Container with the specified value. + /// The asynchronous Cosmos DB background operation runs using a percentage of user RUs. + /// + /// The of the items to be deleted. + /// (Optional) The options for the Partition Key Delete request. + /// (Optional) representing request cancellation. + /// + /// A containing a . + /// + public abstract Task DeleteAllItemsByPartitionKeyStreamAsync( + Cosmos.PartitionKey partitionKey, + RequestOptions requestOptions = null, + CancellationToken cancellationToken = default(CancellationToken)); +#endif + +#if PREVIEW /// /// This method creates a query for items under a container in an Azure Cosmos database using a SQL statement with parameterized values. It returns a FeedIterator. /// For more information on preparing SQL statements with parameterized values, please see . diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs index e5ba3a2bd9..ec4103fc82 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs @@ -147,22 +147,6 @@ public abstract Task> PatchItemAsync( PatchItemRequestOptions requestOptions = null, CancellationToken cancellationToken = default); - public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken = default); - - public abstract FeedIterator GetChangeFeedStreamIterator( - ChangeFeedStartFrom changeFeedStartFrom, - ChangeFeedMode changeFeedMode, - ChangeFeedRequestOptions changeFeedRequestOptions = null); - - public abstract FeedIterator GetChangeFeedIterator( - ChangeFeedStartFrom changeFeedStartFrom, - ChangeFeedMode changeFeedMode, - ChangeFeedRequestOptions changeFeedRequestOptions = null); - - public abstract Task> GetPartitionKeyRangesAsync( - FeedRange feedRange, - CancellationToken cancellationToken = default); - public abstract FeedIterator GetItemQueryStreamIterator( FeedRange feedRange, QueryDefinition queryDefinition, From cb2116129d861075d75097595c542b447d07ec18 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Thu, 27 May 2021 11:20:12 -0700 Subject: [PATCH 2/4] contract update --- Microsoft.Azure.Cosmos/src/CosmosClient.cs | 2 +- .../Contracts/DotNetPreviewSDKAPI.json | 254 ----------------- .../Contracts/DotNetSDKAPI.json | 260 ++++++++++++++++++ 3 files changed, 261 insertions(+), 255 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClient.cs b/Microsoft.Azure.Cosmos/src/CosmosClient.cs index bfb2afa720..abf81faf48 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClient.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClient.cs @@ -515,7 +515,7 @@ public virtual Task ReadAccountAsync() /// /// /// /// diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json index 4ac607fb79..716c37ea12 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json @@ -12,16 +12,6 @@ "Type": "Method", "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_FullFidelity();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedMode Incremental": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode Incremental;CanRead:True;CanWrite:False;Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -100,128 +90,6 @@ }, "NestedTypes": {} }, - "Microsoft.Azure.Cosmos.ChangeFeedRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Boolean EmitOldContinuationToken": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Boolean EmitOldContinuationToken;CanRead:True;CanWrite:True;Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Boolean get_EmitOldContinuationToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Nullable`1[System.Int32] get_PageSizeHint()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Nullable`1[System.Int32] PageSizeHint": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "System.Nullable`1[System.Int32] PageSizeHint;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_IfMatchEtag()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_IfNoneMatchEtag()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String IfMatchEtag[System.ObsoleteAttribute(\"IfMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { - "Type": "Property", - "Attributes": [ - "EditorBrowsableAttribute", - "ObsoleteAttribute" - ], - "MethodInfo": "System.String IfMatchEtag;CanRead:True;CanWrite:True;System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String IfNoneMatchEtag[System.ObsoleteAttribute(\"IfNoneMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { - "Type": "Property", - "Attributes": [ - "EditorBrowsableAttribute", - "ObsoleteAttribute" - ], - "MethodInfo": "System.String IfNoneMatchEtag;CanRead:True;CanWrite:True;System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor()": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(), Void .ctor()]" - }, - "Void set_EmitOldContinuationToken(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_IfMatchEtag(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_IfNoneMatchEtag(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_PageSizeHint(System.Nullable`1[System.Int32])": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning(Microsoft.Azure.Cosmos.FeedRange)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning(Microsoft.Azure.Cosmos.FeedRange);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom ContinuationToken(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom ContinuationToken(System.String);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now(Microsoft.Azure.Cosmos.FeedRange)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now(Microsoft.Azure.Cosmos.FeedRange);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime, Microsoft.Azure.Cosmos.FeedRange)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime, Microsoft.Azure.Cosmos.FeedRange);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, "Microsoft.Azure.Cosmos.ClientEncryptionIncludedPath;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -666,21 +534,11 @@ "Attributes": [], "MethodInfo": null }, - "Microsoft.Azure.Cosmos.FeedIterator GetChangeFeedStreamIterator(Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator GetChangeFeedStreamIterator(Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Microsoft.Azure.Cosmos.FeedIterator GetItemQueryStreamIterator(Microsoft.Azure.Cosmos.FeedRange, Microsoft.Azure.Cosmos.QueryDefinition, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions)": { "Type": "Method", "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator GetItemQueryStreamIterator(Microsoft.Azure.Cosmos.FeedRange, Microsoft.Azure.Cosmos.QueryDefinition, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetChangeFeedIterator[T](Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetChangeFeedIterator[T](Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" - }, "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetItemQueryIterator[T](Microsoft.Azure.Cosmos.FeedRange, Microsoft.Azure.Cosmos.QueryDefinition, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions)": { "Type": "Method", "Attributes": [], @@ -695,16 +553,6 @@ "Type": "Method", "Attributes": [], "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] PatchItemStreamAsync(System.String, Microsoft.Azure.Cosmos.PartitionKey, System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.PatchOperation], Microsoft.Azure.Cosmos.PatchItemRequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Threading.Tasks.Task`1[System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.FeedRange]] GetFeedRangesAsync(System.Threading.CancellationToken)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Threading.Tasks.Task`1[System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.FeedRange]] GetFeedRangesAsync(System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": { @@ -1141,27 +989,6 @@ }, "NestedTypes": {} }, - "Microsoft.Azure.Cosmos.FeedRange;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:True": { - "Subclasses": {}, - "Members": { - "Microsoft.Azure.Cosmos.FeedRange FromJsonString(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.FeedRange FromJsonString(System.String);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.FeedRange FromPartitionKey(Microsoft.Azure.Cosmos.PartitionKey)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.FeedRange FromPartitionKey(Microsoft.Azure.Cosmos.PartitionKey);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String ToJsonString()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.String ToJsonString();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, "Microsoft.Azure.Cosmos.Fluent.ChangeFeedPolicyDefinition;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -1483,87 +1310,6 @@ }, "Microsoft.Azure.Cosmos.RequestOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": { - "Microsoft.Azure.Cosmos.ChangeFeedRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { - "Subclasses": {}, - "Members": { - "Boolean EmitOldContinuationToken": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Boolean EmitOldContinuationToken;CanRead:True;CanWrite:True;Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Boolean get_EmitOldContinuationToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Nullable`1[System.Int32] get_PageSizeHint()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.Nullable`1[System.Int32] PageSizeHint": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "System.Nullable`1[System.Int32] PageSizeHint;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_IfMatchEtag()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String get_IfNoneMatchEtag()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String IfMatchEtag[System.ObsoleteAttribute(\"IfMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { - "Type": "Property", - "Attributes": [ - "EditorBrowsableAttribute", - "ObsoleteAttribute" - ], - "MethodInfo": "System.String IfMatchEtag;CanRead:True;CanWrite:True;System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "System.String IfNoneMatchEtag[System.ObsoleteAttribute(\"IfNoneMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { - "Type": "Property", - "Attributes": [ - "EditorBrowsableAttribute", - "ObsoleteAttribute" - ], - "MethodInfo": "System.String IfNoneMatchEtag;CanRead:True;CanWrite:True;System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void .ctor()": { - "Type": "Constructor", - "Attributes": [], - "MethodInfo": "[Void .ctor(), Void .ctor()]" - }, - "Void set_EmitOldContinuationToken(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_IfMatchEtag(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_IfNoneMatchEtag(System.String)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Void set_PageSizeHint(System.Nullable`1[System.Int32])": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - } - }, - "NestedTypes": {} - }, "Microsoft.Azure.Cosmos.ItemRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": { "Microsoft.Azure.Cosmos.PatchItemRequestOptions;Microsoft.Azure.Cosmos.ItemRequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index 793e64e107..3553844552 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -301,6 +301,22 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.ChangeFeedMode;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedMode Incremental": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode Incremental;CanRead:True;CanWrite:False;Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.ChangeFeedProcessor;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -405,6 +421,128 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.ChangeFeedRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Boolean EmitOldContinuationToken": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "Boolean EmitOldContinuationToken;CanRead:True;CanWrite:True;Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Boolean get_EmitOldContinuationToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] get_PageSizeHint()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] PageSizeHint": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Int32] PageSizeHint;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_IfMatchEtag()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_IfNoneMatchEtag()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String IfMatchEtag[System.ObsoleteAttribute(\"IfMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { + "Type": "Property", + "Attributes": [ + "EditorBrowsableAttribute", + "ObsoleteAttribute" + ], + "MethodInfo": "System.String IfMatchEtag;CanRead:True;CanWrite:True;System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String IfNoneMatchEtag[System.ObsoleteAttribute(\"IfNoneMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { + "Type": "Property", + "Attributes": [ + "EditorBrowsableAttribute", + "ObsoleteAttribute" + ], + "MethodInfo": "System.String IfNoneMatchEtag;CanRead:True;CanWrite:True;System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_EmitOldContinuationToken(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_IfMatchEtag(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_IfNoneMatchEtag(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_PageSizeHint(System.Nullable`1[System.Int32])": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning(Microsoft.Azure.Cosmos.FeedRange)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Beginning(Microsoft.Azure.Cosmos.FeedRange);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom ContinuationToken(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom ContinuationToken(System.String);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now(Microsoft.Azure.Cosmos.FeedRange)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Now(Microsoft.Azure.Cosmos.FeedRange);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime, Microsoft.Azure.Cosmos.FeedRange)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedStartFrom Time(System.DateTime, Microsoft.Azure.Cosmos.FeedRange);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.CompositePath;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -780,6 +918,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.Database get_Database();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.FeedIterator GetChangeFeedStreamIterator(Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator GetChangeFeedStreamIterator(Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.FeedIterator GetItemQueryStreamIterator(Microsoft.Azure.Cosmos.QueryDefinition, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions)": { "Type": "Method", "Attributes": [], @@ -790,6 +933,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator GetItemQueryStreamIterator(System.String, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetChangeFeedIterator[T](Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetChangeFeedIterator[T](Microsoft.Azure.Cosmos.ChangeFeedStartFrom, Microsoft.Azure.Cosmos.ChangeFeedMode, Microsoft.Azure.Cosmos.ChangeFeedRequestOptions);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:True;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.FeedIterator`1[T] GetItemQueryIterator[T](Microsoft.Azure.Cosmos.QueryDefinition, System.String, Microsoft.Azure.Cosmos.QueryRequestOptions)": { "Type": "Method", "Attributes": [], @@ -935,6 +1083,16 @@ "Attributes": [], "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ThroughputResponse] ReplaceThroughputAsync(Microsoft.Azure.Cosmos.ThroughputProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.FeedRange]] GetFeedRangesAsync(System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.FeedRange]] GetFeedRangesAsync(System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Threading.Tasks.Task`1[System.Nullable`1[System.Int32]] ReadThroughputAsync(System.Threading.CancellationToken)": { "Type": "Method", "Attributes": [], @@ -2803,6 +2961,27 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.FeedRange;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:True": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.FeedRange FromJsonString(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.FeedRange FromJsonString(System.String);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.FeedRange FromPartitionKey(Microsoft.Azure.Cosmos.PartitionKey)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.FeedRange FromPartitionKey(Microsoft.Azure.Cosmos.PartitionKey);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String ToJsonString()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String ToJsonString();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.FeedResponse`1;;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -5196,6 +5375,87 @@ }, "Microsoft.Azure.Cosmos.RequestOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": { + "Microsoft.Azure.Cosmos.ChangeFeedRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Boolean EmitOldContinuationToken": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "Boolean EmitOldContinuationToken;CanRead:True;CanWrite:True;Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Boolean get_EmitOldContinuationToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] get_PageSizeHint()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[System.Int32] PageSizeHint": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Int32] PageSizeHint;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_PageSizeHint();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_IfMatchEtag()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_IfNoneMatchEtag()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String IfMatchEtag[System.ObsoleteAttribute(\"IfMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { + "Type": "Property", + "Attributes": [ + "EditorBrowsableAttribute", + "ObsoleteAttribute" + ], + "MethodInfo": "System.String IfMatchEtag;CanRead:True;CanWrite:True;System.String get_IfMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String IfNoneMatchEtag[System.ObsoleteAttribute(\"IfNoneMatchEtag is inherited from the base class but not used.\")]-[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)1)]": { + "Type": "Property", + "Attributes": [ + "EditorBrowsableAttribute", + "ObsoleteAttribute" + ], + "MethodInfo": "System.String IfNoneMatchEtag;CanRead:True;CanWrite:True;System.String get_IfNoneMatchEtag();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_EmitOldContinuationToken(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_IfMatchEtag(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_IfMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_IfNoneMatchEtag(System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_IfNoneMatchEtag(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_PageSizeHint(System.Nullable`1[System.Int32])": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_PageSizeHint(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.ContainerRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { From 57e09adbe10d91ee20fd8202ee479b4fcd48e272 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Fri, 28 May 2021 06:59:48 -0700 Subject: [PATCH 3/4] Addressing comments --- .../src/ChangeFeed/ChangeFeedIteratorCore.cs | 40 ++----------- .../ChangeFeedRequestOptions.cs | 14 ----- .../src/Resource/Container/Container.cs | 60 ++++++++++--------- .../Resource/Container/ContainerInternal.cs | 4 ++ .../Contracts/DotNetPreviewSDKAPI.json | 5 ++ .../Contracts/DotNetSDKAPI.json | 43 ------------- 6 files changed, 48 insertions(+), 118 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs index 7e65fb7a55..8387cb43f2 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs @@ -302,40 +302,12 @@ private async Task ReadNextInternalAsync(ITrace trace, Cancella } CrossFeedRangeState crossFeedRangeState = crossFeedRangePage.State; - string continuationToken; - if (this.changeFeedRequestOptions.EmitOldContinuationToken) - { - List compositeContinuationTokens = new List(); - for (int i = 0; i < crossFeedRangeState.Value.Length; i++) - { - FeedRangeState changeFeedFeedRangeState = crossFeedRangeState.Value.Span[i]; - string token = changeFeedFeedRangeState.State is ChangeFeedStateContinuation changeFeedStateContinuation ? ((CosmosString)changeFeedStateContinuation.ContinuationToken).Value : null; - Documents.Routing.Range range = ((FeedRangeEpk)changeFeedFeedRangeState.FeedRange).Range; - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken() - { - Range = range, - Token = token, - }; - - compositeContinuationTokens.Add(compositeContinuationToken); - } - - FeedRangeCompositeContinuation feedRangeCompositeContinuationToken = new FeedRangeCompositeContinuation( - await this.documentContainer.GetResourceIdentifierAsync(trace, cancellationToken), - FeedRangeEpk.FullRange, - compositeContinuationTokens); - - continuationToken = feedRangeCompositeContinuationToken.ToString(); - } - else - { - ChangeFeedCrossFeedRangeState changeFeedCrossFeedRangeState = new ChangeFeedCrossFeedRangeState(crossFeedRangeState.Value); - continuationToken = VersionedAndRidCheckedCompositeToken.ToCosmosElement( - new VersionedAndRidCheckedCompositeToken( - VersionedAndRidCheckedCompositeToken.Version.V2, - changeFeedCrossFeedRangeState.ToCosmosElement(), - await this.documentContainer.GetResourceIdentifierAsync(trace, cancellationToken))).ToString(); - } + ChangeFeedCrossFeedRangeState changeFeedCrossFeedRangeState = new ChangeFeedCrossFeedRangeState(crossFeedRangeState.Value); + string continuationToken = VersionedAndRidCheckedCompositeToken.ToCosmosElement( + new VersionedAndRidCheckedCompositeToken( + VersionedAndRidCheckedCompositeToken.Version.V2, + changeFeedCrossFeedRangeState.ToCosmosElement(), + await this.documentContainer.GetResourceIdentifierAsync(trace, cancellationToken))).ToString(); responseMessage.Headers.ContinuationToken = continuationToken; responseMessage.Headers.RequestCharge = changeFeedPage.RequestCharge; diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs index 9b5490667f..d7faef853f 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs @@ -38,20 +38,6 @@ public int? PageSizeHint } } - /// - /// Gets or sets whether or not to emit the old continuation token. - /// - /// - /// This is useful for when you want to upgrade your SDK, but can not upgrade all nodes atomically. - /// In that scenario perform a "two phase deployment". - /// In the first phase deploy with EmitOldContinuationToken = true; this will ensure that none of the old SDKs encounter a new continuation token. - /// Once the first phase is complete and all nodes are able to read the new continuation token, then - /// in the second phase redeploy with EmitOldContinuationToken = false. - /// This will succesfully migrate all nodes to emit the new continuation token format. - /// Eventually all your tokens from the previous version will be migrated. - /// - public bool EmitOldContinuationToken { get; set; } - /// /// Fill the CosmosRequestMessage headers with the set properties /// diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs index 97dcf0ea26..828bfc68f3 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs @@ -1253,24 +1253,26 @@ public abstract ChangeFeedEstimator GetChangeFeedEstimator( /// /// /// feedRanges = await this.Container.GetFeedRangesAsync(); - /// // Distribute feedRanges across multiple compute units and pass each one to a different iterator - /// /// ChangeFeedRequestOptions options = new ChangeFeedRequestOptions() /// { /// PageSizeHint = 10, /// } /// /// FeedIterator feedIterator = this.Container.GetChangeFeedStreamIterator( - /// ChangeFeedStartFrom.Beginning(feedRanges[0]), + /// ChangeFeedStartFrom.Beginning(), /// ChangeFeedMode.Incremental, /// options); /// /// while (feedIterator.HasMoreResults) /// { - /// while (feedIterator.HasMoreResults) + /// using (ResponseMessage response = await feedIterator.ReadNextAsync()) /// { - /// using (ResponseMessage response = await feedIterator.ReadNextAsync()) + /// if (response.StatusCode == NotModified) + /// { + /// // No new changes + /// // Capture response.ContinuationToken and break or sleep for some time + /// } + /// else /// { /// using (StreamReader sr = new StreamReader(response.Content)) /// using (JsonTextReader jtr = new JsonTextReader(sr)) @@ -1300,29 +1302,33 @@ public abstract FeedIterator GetChangeFeedStreamIterator( /// /// /// feedRanges = await this.Container.GetFeedRangessAsync(); - /// // Distribute feedRangess across multiple compute units and pass each one to a different iterator - /// /// ChangeFeedRequestOptions options = new ChangeFeedRequestOptions() /// { /// PageSizeHint = 10, /// } /// /// FeedIterator feedIterator = this.Container.GetChangeFeedIterator( - /// ChangeFeedStartFrom.Beginning(feedRanges[0]), + /// ChangeFeedStartFrom.Beginning(), /// ChangeFeedMode.Incremental, /// options); - /// while (feedIterator.HasMoreResults) - /// { + /// /// while (feedIterator.HasMoreResults) /// { /// FeedResponse response = await feedIterator.ReadNextAsync(); - /// foreach (var item in response) + /// + /// if (response.StatusCode == NotModified) + /// { + /// // No new changes + /// // Capture response.ContinuationToken and break or sleep for some time + /// } + /// else /// { - /// Console.WriteLine(item); + /// foreach (var item in response) + /// { + /// Console.WriteLine(item); + /// } /// } /// } - /// } /// ]]> /// /// @@ -1332,18 +1338,6 @@ public abstract FeedIterator GetChangeFeedIterator( ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions = null); - /// - /// Gets the list of Partition Key Range identifiers for a . - /// - /// A - /// (Optional) representing request cancellation. - /// The list of Partition Key Range identifiers affected by a particular FeedRange. - /// - /// https://aka.ms/cosmosdb-dot-net-exceptions#typed-api - public abstract Task> GetPartitionKeyRangesAsync( - FeedRange feedRange, - CancellationToken cancellationToken = default); - #if INTERNAL /// /// Deletes all items in the Container with the specified value. @@ -1363,6 +1357,18 @@ public abstract Task DeleteAllItemsByPartitionKeyStreamAsync( #endif #if PREVIEW + /// + /// Gets the list of Partition Key Range identifiers for a . + /// + /// A + /// (Optional) representing request cancellation. + /// The list of Partition Key Range identifiers affected by a particular FeedRange. + /// + /// https://aka.ms/cosmosdb-dot-net-exceptions#typed-api + public abstract Task> GetPartitionKeyRangesAsync( + FeedRange feedRange, + CancellationToken cancellationToken = default); + /// /// This method creates a query for items under a container in an Azure Cosmos database using a SQL statement with parameterized values. It returns a FeedIterator. /// For more information on preparing SQL statements with parameterized values, please see . diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs index ec4103fc82..f0d3442907 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInternal.cs @@ -133,6 +133,10 @@ public abstract Task DeleteAllItemsByPartitionKeyStreamAsync( #endif #if !PREVIEW + public abstract Task> GetPartitionKeyRangesAsync( + FeedRange feedRange, + CancellationToken cancellationToken = default); + public abstract Task PatchItemStreamAsync( string id, PartitionKey partitionKey, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json index 716c37ea12..98d3908099 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json @@ -553,6 +553,11 @@ "Type": "Method", "Attributes": [], "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ResponseMessage] PatchItemStreamAsync(System.String, Microsoft.Azure.Cosmos.PartitionKey, System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.PatchOperation], Microsoft.Azure.Cosmos.PatchItemRequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index 3553844552..8f3c4a15e7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -424,18 +424,6 @@ "Microsoft.Azure.Cosmos.ChangeFeedRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "Boolean EmitOldContinuationToken": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Boolean EmitOldContinuationToken;CanRead:True;CanWrite:True;Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Boolean get_EmitOldContinuationToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "System.Nullable`1[System.Int32] get_PageSizeHint()": { "Type": "Method", "Attributes": [], @@ -477,13 +465,6 @@ "Attributes": [], "MethodInfo": "[Void .ctor(), Void .ctor()]" }, - "Void set_EmitOldContinuationToken(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Void set_IfMatchEtag(System.String)": { "Type": "Method", "Attributes": [], @@ -1083,11 +1064,6 @@ "Attributes": [], "MethodInfo": "System.Threading.Tasks.Task`1[Microsoft.Azure.Cosmos.ThroughputResponse] ReplaceThroughputAsync(Microsoft.Azure.Cosmos.ThroughputProperties, Microsoft.Azure.Cosmos.RequestOptions, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken)": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`1[System.String]] GetPartitionKeyRangesAsync(Microsoft.Azure.Cosmos.FeedRange, System.Threading.CancellationToken);IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "System.Threading.Tasks.Task`1[System.Collections.Generic.IReadOnlyList`1[Microsoft.Azure.Cosmos.FeedRange]] GetFeedRangesAsync(System.Threading.CancellationToken)": { "Type": "Method", "Attributes": [], @@ -5378,18 +5354,6 @@ "Microsoft.Azure.Cosmos.ChangeFeedRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "Boolean EmitOldContinuationToken": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Boolean EmitOldContinuationToken;CanRead:True;CanWrite:True;Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Boolean get_EmitOldContinuationToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Boolean get_EmitOldContinuationToken();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "System.Nullable`1[System.Int32] get_PageSizeHint()": { "Type": "Method", "Attributes": [], @@ -5431,13 +5395,6 @@ "Attributes": [], "MethodInfo": "[Void .ctor(), Void .ctor()]" }, - "Void set_EmitOldContinuationToken(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_EmitOldContinuationToken(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Void set_IfMatchEtag(System.String)": { "Type": "Method", "Attributes": [], From 3ff371f4a70a916365d4293c033fe870071f5c8f Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Tue, 1 Jun 2021 07:21:26 -0700 Subject: [PATCH 4/4] Supporting None --- .../FeedRange/FeedRangeInternalConverter.cs | 19 ++++++++++++-- .../FeedRange/FeedRangeTests.cs | 26 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Serializer/FeedRange/FeedRangeInternalConverter.cs b/Microsoft.Azure.Cosmos/src/Serializer/FeedRange/FeedRangeInternalConverter.cs index 00ab5ce8d0..60aea97f6e 100644 --- a/Microsoft.Azure.Cosmos/src/Serializer/FeedRange/FeedRangeInternalConverter.cs +++ b/Microsoft.Azure.Cosmos/src/Serializer/FeedRange/FeedRangeInternalConverter.cs @@ -11,6 +11,7 @@ namespace Microsoft.Azure.Cosmos internal sealed class FeedRangeInternalConverter : JsonConverter { + private const string PartitionKeyNoneValue = "None"; private const string RangePropertyName = "Range"; private const string PartitionKeyPropertyName = "PK"; private const string PartitionKeyRangeIdPropertyName = "PKRangeId"; @@ -73,7 +74,13 @@ public static FeedRangeInternal ReadJObject( if (jObject.TryGetValue(FeedRangeInternalConverter.PartitionKeyPropertyName, out JToken pkJToken)) { - if (!PartitionKey.TryParseJsonString(pkJToken.Value(), out PartitionKey partitionKey)) + string value = pkJToken.Value(); + if (FeedRangeInternalConverter.PartitionKeyNoneValue.Equals(value, StringComparison.OrdinalIgnoreCase)) + { + return new FeedRangePartitionKey(PartitionKey.None); + } + + if (!PartitionKey.TryParseJsonString(value, out PartitionKey partitionKey)) { throw new JsonReaderException(); } @@ -104,7 +111,15 @@ public static void WriteJObject( if (value is FeedRangePartitionKey feedRangePartitionKey) { writer.WritePropertyName(FeedRangeInternalConverter.PartitionKeyPropertyName); - writer.WriteValue(feedRangePartitionKey.PartitionKey.ToJsonString()); + if (feedRangePartitionKey.PartitionKey.IsNone) + { + writer.WriteValue(FeedRangeInternalConverter.PartitionKeyNoneValue); + } + else + { + writer.WriteValue(feedRangePartitionKey.PartitionKey.ToJsonString()); + } + return; } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/FeedRange/FeedRangeTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/FeedRange/FeedRangeTests.cs index a17f43ee15..8a6b905ac6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/FeedRange/FeedRangeTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/FeedRange/FeedRangeTests.cs @@ -184,6 +184,32 @@ public void FeedRangePK_ToJsonFromJson() Assert.AreEqual(feedRangePartitionKey.PartitionKey.ToJsonString(), feedRangePartitionKeyDeserialized.PartitionKey.ToJsonString()); } + [TestMethod] + public void FeedRangePK_None_ToJsonFromJson() + { + FeedRangePartitionKey feedRange = new FeedRangePartitionKey(PartitionKey.None); + string range = feedRange.ToJsonString(); + FeedRangePartitionKey other = Cosmos.FeedRange.FromJsonString(range) as FeedRangePartitionKey; + Assert.AreEqual(feedRange.PartitionKey, other.PartitionKey); + + PartitionKey partitionKeyStringNone = new PartitionKey("None"); + FeedRangePartitionKey withNoneAsValue = new FeedRangePartitionKey(partitionKeyStringNone); + string withNoneAsValueAsString = withNoneAsValue.ToJsonString(); + Assert.AreNotEqual(range, withNoneAsValueAsString); + FeedRangePartitionKey withNoneAsValueAsStringDeserialized = Cosmos.FeedRange.FromJsonString(withNoneAsValueAsString) as FeedRangePartitionKey; + Assert.AreNotEqual(feedRange.PartitionKey, withNoneAsValueAsStringDeserialized.PartitionKey); + Assert.AreEqual(partitionKeyStringNone, withNoneAsValueAsStringDeserialized.PartitionKey); + } + + [TestMethod] + public void FeedRangePK_Null_ToJsonFromJson() + { + FeedRangePartitionKey feedRange = new FeedRangePartitionKey(PartitionKey.Null); + string range = feedRange.ToJsonString(); + FeedRangePartitionKey other = Cosmos.FeedRange.FromJsonString(range) as FeedRangePartitionKey; + Assert.AreEqual(feedRange.PartitionKey, other.PartitionKey); + } + [TestMethod] public void FeedRangePKRangeId_ToJsonFromJson() {