From b0cf55e04ca13d11bddfd19650ec996168fde806 Mon Sep 17 00:00:00 2001 From: Martin Tomka Date: Fri, 8 Sep 2023 07:49:59 +0200 Subject: [PATCH] API Review for Simmy --- .../BehaviorActionArguments.cs | 11 ++++++++++ .../BehaviorStrategyOptions.cs | 16 +++++++++++++++ .../OnBehaviorInjectedArguments.cs | 11 ++++++++++ .../LatencyGeneratorArguments.cs | 11 ++++++++++ .../LatencyStrategyOptions.cs | 15 ++++++++++++++ .../Polly.Simmy.Latency/OnLatencyArguments.cs | 13 ++++++++++++ .../OnOutcomeInjectedArguments.cs | 12 +++++++++++ .../OutcomeGeneratorArguments.cs | 11 ++++++++++ .../OutcomeStrategyOptions.TResult.cs | 15 ++++++++++++++ .../OutcomeStrategyOptions.cs | 8 ++++++++ .../BehaviorChaosPipelineBuilderExtensions.cs | 14 +++++++++++++ .../Polly.Simmy/EnabledGeneratorArguments.cs | 11 ++++++++++ .../InjectionRateGeneratorArguments.cs | 11 ++++++++++ .../LatencyChaosPipelineBuilderExtensions.cs | 13 ++++++++++++ .../NoDocs/Polly.Simmy/MonkeyStrategy.T.cs | 14 +++++++++++++ .../NoDocs/Polly.Simmy/MonkeyStrategy.cs | 14 +++++++++++++ .../MonkeyStrategyOptions.TResult.cs | 20 +++++++++++++++++++ .../Polly.Simmy/MonkeyStrategyOptions.cs | 8 ++++++++ .../OutcomeChaosPipelineBuilderExtensions.cs | 20 +++++++++++++++++++ 19 files changed, 248 insertions(+) create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorActionArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorStrategyOptions.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/OnBehaviorInjectedArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyGeneratorArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyStrategyOptions.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/OnLatencyArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OnOutcomeInjectedArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeGeneratorArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.TResult.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/BehaviorChaosPipelineBuilderExtensions.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/EnabledGeneratorArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/InjectionRateGeneratorArguments.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/LatencyChaosPipelineBuilderExtensions.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.T.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.TResult.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.cs create mode 100644 ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/OutcomeChaosPipelineBuilderExtensions.cs diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorActionArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorActionArguments.cs new file mode 100644 index 00000000000..789bed7cc88 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorActionArguments.cs @@ -0,0 +1,11 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy.Behavior; + +public readonly struct BehaviorActionArguments +{ + public ResilienceContext Context { get; } + public BehaviorActionArguments(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorStrategyOptions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorStrategyOptions.cs new file mode 100644 index 00000000000..0f83f502b99 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/BehaviorStrategyOptions.cs @@ -0,0 +1,16 @@ +// Assembly 'Polly.Core' + +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Polly.Simmy.Behavior; + +public class BehaviorStrategyOptions : MonkeyStrategyOptions +{ + public Func? OnBehaviorInjected { get; set; } + [Required] + public Func? BehaviorAction { get; set; } + public BehaviorStrategyOptions(); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/OnBehaviorInjectedArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/OnBehaviorInjectedArguments.cs new file mode 100644 index 00000000000..78aca9d8811 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Behavior/OnBehaviorInjectedArguments.cs @@ -0,0 +1,11 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy.Behavior; + +public readonly struct OnBehaviorInjectedArguments +{ + public ResilienceContext Context { get; } + public OnBehaviorInjectedArguments(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyGeneratorArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyGeneratorArguments.cs new file mode 100644 index 00000000000..567d8a765c1 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyGeneratorArguments.cs @@ -0,0 +1,11 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy.Latency; + +public readonly struct LatencyGeneratorArguments +{ + public ResilienceContext Context { get; } + public LatencyGeneratorArguments(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyStrategyOptions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyStrategyOptions.cs new file mode 100644 index 00000000000..b746494f707 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/LatencyStrategyOptions.cs @@ -0,0 +1,15 @@ +// Assembly 'Polly.Core' + +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Polly.Simmy.Latency; + +public class LatencyStrategyOptions : MonkeyStrategyOptions +{ + public Func? OnLatency { get; set; } + public Func>? LatencyGenerator { get; set; } + public TimeSpan Latency { get; set; } + public LatencyStrategyOptions(); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/OnLatencyArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/OnLatencyArguments.cs new file mode 100644 index 00000000000..db040118ce7 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Latency/OnLatencyArguments.cs @@ -0,0 +1,13 @@ +// Assembly 'Polly.Core' + +using System; +using System.Runtime.CompilerServices; + +namespace Polly.Simmy.Latency; + +public readonly struct OnLatencyArguments +{ + public ResilienceContext Context { get; } + public TimeSpan Latency { get; } + public OnLatencyArguments(ResilienceContext context, TimeSpan latency); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OnOutcomeInjectedArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OnOutcomeInjectedArguments.cs new file mode 100644 index 00000000000..54d7aead6f1 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OnOutcomeInjectedArguments.cs @@ -0,0 +1,12 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy.Outcomes; + +public readonly struct OnOutcomeInjectedArguments +{ + public ResilienceContext Context { get; } + public Outcome Outcome { get; } + public OnOutcomeInjectedArguments(ResilienceContext context, Outcome outcome); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeGeneratorArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeGeneratorArguments.cs new file mode 100644 index 00000000000..b274b789282 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeGeneratorArguments.cs @@ -0,0 +1,11 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy.Outcomes; + +public readonly struct OutcomeGeneratorArguments +{ + public ResilienceContext Context { get; } + public OutcomeGeneratorArguments(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.TResult.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.TResult.cs new file mode 100644 index 00000000000..0b1bf8ba67e --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.TResult.cs @@ -0,0 +1,15 @@ +// Assembly 'Polly.Core' + +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Polly.Simmy.Outcomes; + +public class OutcomeStrategyOptions : MonkeyStrategyOptions +{ + public Func, ValueTask>? OnOutcomeInjected { get; set; } + public Func?>>? OutcomeGenerator { get; set; } + public Outcome? Outcome { get; set; } + public OutcomeStrategyOptions(); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.cs new file mode 100644 index 00000000000..3521477f3ea --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy.Outcomes/OutcomeStrategyOptions.cs @@ -0,0 +1,8 @@ +// Assembly 'Polly.Core' + +namespace Polly.Simmy.Outcomes; + +public class OutcomeStrategyOptions : OutcomeStrategyOptions +{ + public OutcomeStrategyOptions(); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/BehaviorChaosPipelineBuilderExtensions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/BehaviorChaosPipelineBuilderExtensions.cs new file mode 100644 index 00000000000..d1eb09340e4 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/BehaviorChaosPipelineBuilderExtensions.cs @@ -0,0 +1,14 @@ +// Assembly 'Polly.Core' + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Threading.Tasks; +using Polly.Simmy.Behavior; + +namespace Polly.Simmy; + +public static class BehaviorChaosPipelineBuilderExtensions +{ + public static TBuilder AddChaosBehavior(this TBuilder builder, bool enabled, double injectionRate, Func behavior) where TBuilder : ResiliencePipelineBuilderBase; + public static TBuilder AddChaosBehavior(this TBuilder builder, BehaviorStrategyOptions options) where TBuilder : ResiliencePipelineBuilderBase; +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/EnabledGeneratorArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/EnabledGeneratorArguments.cs new file mode 100644 index 00000000000..b86136ce155 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/EnabledGeneratorArguments.cs @@ -0,0 +1,11 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy; + +public readonly struct EnabledGeneratorArguments +{ + public ResilienceContext Context { get; } + public EnabledGeneratorArguments(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/InjectionRateGeneratorArguments.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/InjectionRateGeneratorArguments.cs new file mode 100644 index 00000000000..8eaa7d8fa79 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/InjectionRateGeneratorArguments.cs @@ -0,0 +1,11 @@ +// Assembly 'Polly.Core' + +using System.Runtime.CompilerServices; + +namespace Polly.Simmy; + +public readonly struct InjectionRateGeneratorArguments +{ + public ResilienceContext Context { get; } + public InjectionRateGeneratorArguments(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/LatencyChaosPipelineBuilderExtensions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/LatencyChaosPipelineBuilderExtensions.cs new file mode 100644 index 00000000000..b1a07a127a2 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/LatencyChaosPipelineBuilderExtensions.cs @@ -0,0 +1,13 @@ +// Assembly 'Polly.Core' + +using System; +using System.Diagnostics.CodeAnalysis; +using Polly.Simmy.Latency; + +namespace Polly.Simmy; + +public static class LatencyChaosPipelineBuilderExtensions +{ + public static TBuilder AddChaosLatency(this TBuilder builder, bool enabled, double injectionRate, TimeSpan latency) where TBuilder : ResiliencePipelineBuilderBase; + public static TBuilder AddChaosLatency(this TBuilder builder, LatencyStrategyOptions options) where TBuilder : ResiliencePipelineBuilderBase; +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.T.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.T.cs new file mode 100644 index 00000000000..339133ee8ba --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.T.cs @@ -0,0 +1,14 @@ +// Assembly 'Polly.Core' + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Polly.Simmy; + +public abstract class MonkeyStrategy : ResilienceStrategy +{ + protected MonkeyStrategy(MonkeyStrategyOptions options); + protected ValueTask ShouldInjectAsync(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.cs new file mode 100644 index 00000000000..823ad90a6dd --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategy.cs @@ -0,0 +1,14 @@ +// Assembly 'Polly.Core' + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Polly.Simmy; + +public abstract class MonkeyStrategy : ResilienceStrategy +{ + protected MonkeyStrategy(MonkeyStrategyOptions options); + protected ValueTask ShouldInjectAsync(ResilienceContext context); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.TResult.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.TResult.cs new file mode 100644 index 00000000000..d8428eb04d6 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.TResult.cs @@ -0,0 +1,20 @@ +// Assembly 'Polly.Core' + +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Polly.Simmy; + +public abstract class MonkeyStrategyOptions : ResilienceStrategyOptions +{ + [Range(0.0, 1.0)] + public double InjectionRate { get; set; } + public Func>? InjectionRateGenerator { get; set; } + public Func>? EnabledGenerator { get; set; } + public bool Enabled { get; set; } + [Required] + public Func Randomizer { get; set; } + protected MonkeyStrategyOptions(); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.cs new file mode 100644 index 00000000000..24abb1662c3 --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/MonkeyStrategyOptions.cs @@ -0,0 +1,8 @@ +// Assembly 'Polly.Core' + +namespace Polly.Simmy; + +public abstract class MonkeyStrategyOptions : MonkeyStrategyOptions +{ + protected MonkeyStrategyOptions(); +} diff --git a/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/OutcomeChaosPipelineBuilderExtensions.cs b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/OutcomeChaosPipelineBuilderExtensions.cs new file mode 100644 index 00000000000..6b3dc2aa9db --- /dev/null +++ b/ApiReview/API.Polly.Core/NoDocs/Polly.Simmy/OutcomeChaosPipelineBuilderExtensions.cs @@ -0,0 +1,20 @@ +// Assembly 'Polly.Core' + +using System; +using System.Diagnostics.CodeAnalysis; +using Polly.Simmy.Outcomes; + +namespace Polly.Simmy; + +public static class OutcomeChaosPipelineBuilderExtensions +{ + public static ResiliencePipelineBuilder AddChaosFault(this ResiliencePipelineBuilder builder, bool enabled, double injectionRate, Exception fault); + public static ResiliencePipelineBuilder AddChaosFault(this ResiliencePipelineBuilder builder, bool enabled, double injectionRate, Func faultGenerator); + public static ResiliencePipelineBuilder AddChaosFault(this ResiliencePipelineBuilder builder, OutcomeStrategyOptions options); + public static ResiliencePipelineBuilder AddChaosFault(this ResiliencePipelineBuilder builder, bool enabled, double injectionRate, Exception fault); + public static ResiliencePipelineBuilder AddChaosFault(this ResiliencePipelineBuilder builder, bool enabled, double injectionRate, Func faultGenerator); + public static ResiliencePipelineBuilder AddChaosFault(this ResiliencePipelineBuilder builder, OutcomeStrategyOptions options); + public static ResiliencePipelineBuilder AddChaosResult(this ResiliencePipelineBuilder builder, bool enabled, double injectionRate, TResult result); + public static ResiliencePipelineBuilder AddChaosResult(this ResiliencePipelineBuilder builder, bool enabled, double injectionRate, Func outcomeGenerator); + public static ResiliencePipelineBuilder AddChaosResult(this ResiliencePipelineBuilder builder, OutcomeStrategyOptions options); +}