-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs and cleanup some chaos API (#1914)
- Loading branch information
Showing
13 changed files
with
145 additions
and
97 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,53 @@ | ||
namespace Polly.Simmy; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
#pragma warning disable CS8618 // Required members are not initialized in constructor since this is a DTO, default value is null | ||
namespace Polly.Simmy; | ||
|
||
/// <summary> | ||
/// The options associated with the <see cref="ChaosStrategy"/>. | ||
/// </summary> | ||
public abstract class ChaosStrategyOptions : ChaosStrategyOptions<object> | ||
public abstract class ChaosStrategyOptions : ResilienceStrategyOptions | ||
{ | ||
} | ||
/// <summary> | ||
/// Gets or sets the injection rate for a given execution, which the value should be between [0, 1] (inclusive). | ||
/// </summary> | ||
/// <remarks> | ||
/// Defaults to 0.001, meaning one in a thousand executions/0.1%. Either <see cref="InjectionRateGenerator"/> or this property is required. | ||
/// </remarks> | ||
[Range(ChaosStrategyConstants.MinInjectionThreshold, ChaosStrategyConstants.MaxInjectionThreshold)] | ||
public double InjectionRate { get; set; } = ChaosStrategyConstants.DefaultInjectionRate; | ||
|
||
/// <summary> | ||
/// Gets or sets the injection rate generator for a given execution, which the value should be between [0, 1] (inclusive). | ||
/// </summary> | ||
/// <remarks> | ||
/// Defaults to <see langword="null"/>. Either <see cref="InjectionRate"/> or this property is required. | ||
/// When this property is <see langword="null"/> the <see cref="InjectionRate"/> is used. | ||
/// </remarks> | ||
public Func<InjectionRateGeneratorArguments, ValueTask<double>>? InjectionRateGenerator { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the enable generator that indicates whether or not the chaos strategy is enabled for a given execution. | ||
/// </summary> | ||
/// <remarks> | ||
/// Defaults to <see langword="null"/>. Either <see cref="Enabled"/> or this property is required. | ||
/// When this property is <see langword="null"/> the <see cref="Enabled"/> is used. | ||
/// </remarks> | ||
public Func<EnabledGeneratorArguments, ValueTask<bool>>? EnabledGenerator { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether or not the chaos strategy is enabled for a given execution. | ||
/// </summary> | ||
/// <remarks> | ||
/// Defaults to <see langword="false"/>. Either <see cref="EnabledGenerator"/> or this property is required. | ||
/// </remarks> | ||
public bool Enabled { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the Randomizer generator instance that is used to evaluate the injection rate. | ||
/// </summary> | ||
/// <remarks> | ||
/// The default randomizer is thread safe and returns values between 0.0 and 1.0. | ||
/// </remarks> | ||
[Required] | ||
public Func<double> Randomizer { get; set; } = RandomUtil.Instance.NextDouble; | ||
} |
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.