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

Hedging: Adds Read hedging PREVIEW contracts #4598

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d26111e
Update contracts
NaluTripician Jul 22, 2024
3028607
removed unneeded changes
NaluTripician Jul 22, 2024
e444eb2
made other contracts public
NaluTripician Jul 23, 2024
a0c6bc7
update enable method
NaluTripician Jul 23, 2024
ddfc265
comments
NaluTripician Jul 24, 2024
b3d3cc7
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Jul 24, 2024
2bab5b6
contract update
NaluTripician Jul 24, 2024
49d6150
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Jul 30, 2024
bd0a406
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 2, 2024
f40e734
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 9, 2024
02cc8bb
changed eneabled to internal
NaluTripician Aug 12, 2024
f7da9f0
fixed internal method
NaluTripician Aug 12, 2024
da73fa6
Revert "fixed internal method"
NaluTripician Aug 12, 2024
e9b3d93
revert + change methods to internal
NaluTripician Aug 12, 2024
28addfc
fixed internal
NaluTripician Aug 12, 2024
9340015
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 12, 2024
97509fc
changed to factory creation
NaluTripician Aug 13, 2024
1665cdb
disabledstrat fix
NaluTripician Aug 13, 2024
bd4f0f4
fixed test + contracts
NaluTripician Aug 13, 2024
43713ee
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 13, 2024
343b3eb
xml changes
NaluTripician Aug 13, 2024
c2f352b
Merge branch 'users/nalutripician/hedgingPreviewAPIs' of https://gith…
NaluTripician Aug 13, 2024
391c20f
updated comments
NaluTripician Aug 13, 2024
98bc27b
Fixed Tests
NaluTripician Aug 13, 2024
02b94d2
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 14, 2024
2010458
requested changes
NaluTripician Aug 14, 2024
2ceae54
added client options check and one region check
NaluTripician Aug 14, 2024
8fde5bf
fix get
NaluTripician Aug 15, 2024
a779ab8
fixed test
NaluTripician Aug 15, 2024
c9e5023
fixed set
NaluTripician Aug 15, 2024
c046248
fix client options
NaluTripician Aug 15, 2024
6f04933
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 15, 2024
dfb0a54
updatecontracts
NaluTripician Aug 15, 2024
6bb9e31
requested changes
NaluTripician Aug 16, 2024
0e9c7a8
fixed validate method
NaluTripician Aug 16, 2024
0bf56c5
Delete MultiRegionSetupHelpers.cs
NaluTripician Aug 16, 2024
1a24ebc
update contracts
NaluTripician Aug 16, 2024
499fa56
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 21, 2024
5d3fdce
Merge branch 'master' into users/nalutripician/hedgingPreviewAPIs
NaluTripician Aug 23, 2024
0f9ee95
fixed merge
NaluTripician Aug 23, 2024
8ae8813
fixed check
NaluTripician Aug 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,12 @@ public Func<HttpClient> HttpClientFactory
/// <summary>
/// Availability Strategy to be used for periods of high latency
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
internal AvailabilityStrategy AvailabilityStrategy { get; set; }
#if PREVIEW
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
public
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
#else
internal
#endif
AvailabilityStrategy AvailabilityStrategy { get; set; }

/// <summary>
/// Enable partition key level failover
Expand Down
7 changes: 6 additions & 1 deletion Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,12 @@ internal CosmosClientBuilder WithApiType(ApiType apiType)
/// </summary>
/// <param name="strategy"></param>
/// <returns>The CosmosClientBuilder</returns>
internal CosmosClientBuilder WithAvailibilityStrategy(AvailabilityStrategy strategy)
#if PREVIEW
public
#else
internal
#endif
CosmosClientBuilder WithAvailibilityStrategy(AvailabilityStrategy strategy)
{
this.clientOptions.AvailabilityStrategy = strategy;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ public class RequestOptions
/// reduce latency and increase availability. Currently there is one type of availability strategy, parallel request hedging.
/// If there is a globally enabled availability strategy, setting one in the request options will override the global one.
/// </summary>
internal AvailabilityStrategy AvailabilityStrategy { get; set; }
#if PREVIEW
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
public
#else
internal
#endif
AvailabilityStrategy AvailabilityStrategy { get; set; }

/// <summary>
/// Gets or sets the boolean to use effective partition key routing in the cosmos db request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ namespace Microsoft.Azure.Cosmos
/// <summary>
/// Types of availability strategies supported
/// </summary>
internal abstract class AvailabilityStrategy
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
#if PREVIEW
public
#else
internal
#endif
abstract class AvailabilityStrategy
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
{
/// <summary>
/// Execute the availability strategy
Expand All @@ -27,6 +32,10 @@ public abstract Task<ResponseMessage> ExecuteAvailabilityStrategyAsync(
RequestMessage requestMessage,
CancellationToken cancellationToken);

internal abstract bool Enabled();
/// <summary>
/// Checks to see if the strategy is enabled
/// </summary>
/// <returns>a bool representing if the strategy is enabled</returns>
public abstract bool Enabled();
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
}
}
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ namespace Microsoft.Azure.Cosmos
/// if the first parallel request or the original has not returned after the step time,
/// additional parallel requests will be sent out there is a response or all regions are exausted.
/// </summary>
internal class CrossRegionParallelHedgingAvailabilityStrategy : AvailabilityStrategy
#if PREVIEW
public
#else
internal
#endif
class CrossRegionParallelHedgingAvailabilityStrategy : AvailabilityStrategy
{
private const string HedgeContext = "Hedge Context";
private const string ResponseRegion = "Response Region";
Expand Down Expand Up @@ -59,7 +64,11 @@ public CrossRegionParallelHedgingAvailabilityStrategy(
this.ThresholdStep = thresholdStep ?? TimeSpan.FromMilliseconds(-1);
}

internal override bool Enabled()
/// <summary>
/// Checks to see if the strategy is enabled
/// </summary>
/// <returns>a bool representing if the strategy is enabled</returns>
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
public override bool Enabled()
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ namespace Microsoft.Azure.Cosmos
/// <summary>
/// A Disabled availability strategy that does not do anything. Used for overriding the default global availability strategy.
/// </summary>
internal class DisabledAvailabilityStrategy : AvailabilityStrategy
#if PREVIEW
public
#else
internal
#endif
class DisabledAvailabilityStrategy : AvailabilityStrategy
{
internal override bool Enabled()
/// <summary>
/// Checks to see if the strategy is enabled
/// </summary>
/// <returns>a bool representing if the strategy is enabled, will always be false</returns>
public override bool Enabled()
NaluTripician marked this conversation as resolved.
Show resolved Hide resolved
{
return false;
}
Expand Down
Loading
Loading