From 48bc50447ad705a22ad4fffd35a36bafcf4dc735 Mon Sep 17 00:00:00 2001
From: Achint-Agrawal <45819170+Achint-Agrawal@users.noreply.github.com>
Date: Tue, 14 Jan 2025 04:37:03 +0530
Subject: [PATCH] ThroughputBucketing: Fixes ThroughputBucket to always be
internal (#4960)
# Pull Request Template
## Description
Throughput bucketing is not currently released publicly. This PR makes
ThroughputBucket internal. Will expose it in preview SDK once throughput
bucketing is deployed in prod.
## Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
---
.../src/CosmosClientOptions.cs | 7 +--
.../src/Fluent/CosmosClientBuilder.cs | 7 +--
.../src/RequestOptions/RequestOptions.cs | 13 ++----
.../Contracts/DotNetPreviewSDKAPI.json | 43 -------------------
4 files changed, 6 insertions(+), 64 deletions(-)
diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs
index 89c8565f7e..d6cd9805de 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs
@@ -948,12 +948,7 @@ public IFaultInjector FaultInjector
/// If is set to true in CosmosClientOptions, throughput bucket can only be set at client level.
///
///
-#if PREVIEW
- public
-#else
- internal
-#endif
- int? ThroughputBucket { get; set; }
+ internal int? ThroughputBucket { get; set; }
internal IChaosInterceptorFactory ChaosInterceptorFactory { get; set; }
diff --git a/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs b/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs
index 4288c4f5e0..0f3e5821fe 100644
--- a/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs
+++ b/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs
@@ -813,12 +813,7 @@ public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptio
/// The desired throughput bucket for the client.
/// The current .
///
-#if PREVIEW
- public
-#else
- internal
-#endif
- CosmosClientBuilder WithThroughputBucket(int throughputBucket)
+ internal CosmosClientBuilder WithThroughputBucket(int throughputBucket)
{
this.clientOptions.ThroughputBucket = throughputBucket;
return this;
diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs
index 5e0abaf32d..2f58f9f355 100644
--- a/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs
+++ b/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs
@@ -115,8 +115,8 @@ public class RequestOptions
internal virtual ConsistencyLevel? BaseConsistencyLevel { get; set; }
internal bool DisablePointOperationDiagnostics { get; set; }
-
- ///
+
+ ///
/// Gets or sets the throughput bucket for a request.
///
///
@@ -124,12 +124,7 @@ public class RequestOptions
/// cannot be set in RequestOptions.
///
///
-#if PREVIEW
- public
-#else
- internal
-#endif
- int? ThroughputBucket { get; set; }
+ internal int? ThroughputBucket { get; set; }
///
/// Fill the CosmosRequestMessage headers with the set properties
@@ -159,7 +154,7 @@ internal virtual void PopulateRequestOptions(RequestMessage request)
{
request.Headers.Add(HttpConstants.HttpHeaders.PriorityLevel, this.PriorityLevel.ToString());
}
-
+
if (this.ThroughputBucket.HasValue)
{
request.Headers.Add(HttpConstants.HttpHeaders.ThroughputBucket, this.ThroughputBucket?.ToString(CultureInfo.InvariantCulture));
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 1685279390..54a159590b 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
@@ -403,31 +403,12 @@
],
"MethodInfo": "Microsoft.Azure.Cosmos.AvailabilityStrategy get_AvailabilityStrategy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
},
- "System.Nullable`1[System.Int32] get_ThroughputBucket()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
- "Type": "Method",
- "Attributes": [
- "CompilerGeneratedAttribute"
- ],
- "MethodInfo": "System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
- "System.Nullable`1[System.Int32] ThroughputBucket": {
- "Type": "Property",
- "Attributes": [],
- "MethodInfo": "System.Nullable`1[System.Int32] ThroughputBucket;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
"Void set_AvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "Void set_AvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
- "Void set_ThroughputBucket(System.Nullable`1[System.Int32])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
- "Type": "Method",
- "Attributes": [
- "CompilerGeneratedAttribute"
- ],
- "MethodInfo": "Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
}
},
"NestedTypes": {}
@@ -493,11 +474,6 @@
"Type": "Method",
"Attributes": [],
"MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithAvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
- "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithThroughputBucket(Int32)": {
- "Type": "Method",
- "Attributes": [],
- "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithThroughputBucket(Int32);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
}
},
"NestedTypes": {}
@@ -765,31 +741,12 @@
],
"MethodInfo": "Microsoft.Azure.Cosmos.AvailabilityStrategy get_AvailabilityStrategy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
},
- "System.Nullable`1[System.Int32] get_ThroughputBucket()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
- "Type": "Method",
- "Attributes": [
- "CompilerGeneratedAttribute"
- ],
- "MethodInfo": "System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
- "System.Nullable`1[System.Int32] ThroughputBucket": {
- "Type": "Property",
- "Attributes": [],
- "MethodInfo": "System.Nullable`1[System.Int32] ThroughputBucket;CanRead:True;CanWrite:True;System.Nullable`1[System.Int32] get_ThroughputBucket();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
"Void set_AvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "Void set_AvailabilityStrategy(Microsoft.Azure.Cosmos.AvailabilityStrategy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
- },
- "Void set_ThroughputBucket(System.Nullable`1[System.Int32])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
- "Type": "Method",
- "Attributes": [
- "CompilerGeneratedAttribute"
- ],
- "MethodInfo": "Void set_ThroughputBucket(System.Nullable`1[System.Int32]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
}
},
"NestedTypes": {}