-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'users/ezrahaleva/ParserSupportForFIRSTLAST' of https://…
…github.com/Azure/azure-cosmos-dotnet-v3 into users/ezrahaleva/ParserSupportForFIRSTLAST
- Loading branch information
Showing
163 changed files
with
7,730 additions
and
2,900 deletions.
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
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
49 changes: 49 additions & 0 deletions
49
Microsoft.Azure.Cosmos.Samples/Tools/CTL/ReservoirProvider.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,49 @@ | ||
//------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
//------------------------------------------------------------ | ||
|
||
namespace CosmosCTL | ||
{ | ||
using System; | ||
using App.Metrics.ReservoirSampling; | ||
|
||
/// <summary> | ||
/// Returns the <see cref="IReservoir"/> based on the CTL configuration. | ||
/// </summary> | ||
public class ReservoirProvider | ||
{ | ||
/// <summary> | ||
/// Create and returns a new instance of the <see cref="IReservoir"/> based on the CTL configuration. | ||
/// </summary> | ||
/// <param name="ctlConfig">An instance of <see cref="CTLConfig"/> containing the CTL config params.</param> | ||
/// <returns>An implementation of <see cref="IReservoir"/>.</returns> | ||
public static IReservoir GetReservoir(CTLConfig ctlConfig) | ||
{ | ||
return ctlConfig.ReservoirType switch | ||
{ | ||
ReservoirTypes.Uniform => new App.Metrics.ReservoirSampling.Uniform.DefaultAlgorithmRReservoir( | ||
sampleSize: ctlConfig.ReservoirSampleSize), | ||
|
||
ReservoirTypes.SlidingWindow => new App.Metrics.ReservoirSampling.SlidingWindow.DefaultSlidingWindowReservoir( | ||
sampleSize: ctlConfig.ReservoirSampleSize), | ||
|
||
ReservoirTypes.ExponentialDecay => new App.Metrics.ReservoirSampling.ExponentialDecay.DefaultForwardDecayingReservoir( | ||
sampleSize: ctlConfig.ReservoirSampleSize, | ||
alpha: 0.015), | ||
|
||
_ => throw new ArgumentException( | ||
message: "Invalid ReservoirType Specified."), | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// An enum containing different reservoir types. | ||
/// </summary> | ||
public enum ReservoirTypes | ||
{ | ||
Uniform, | ||
SlidingWindow, | ||
ExponentialDecay | ||
} | ||
} | ||
} |
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.