text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>/// The exponential backoff type with the power of 2. /// </summary> /// <example> /// 200ms, 400ms, 800ms. /// </example> Exponential, } <|fim_prefix|>namespace Polly; /// <summary> /// The backoff type used by the strategies. /// </summary> public enum DelayBackoffType { /// <su...
fim
App-vNext/Polly
csharp
<|fim_prefix|>#if !NETCOREAPP using System.Runtime.Serialization; #endif using Polly.Telemetry; namespace Polly; /// <summary> /// Exception t<|fim_suffix|>cutionRejectedException"/> class. /// </summary> /// <param name="message">The message that describes the error.</param> protected ExecutionRejectedE...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Fallback; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Arguments used by <see cref="FallbackStrategyOptions{TResult}.FallbackAction"/>. /// </summary> /// <typeparam name="TResult">The type of result.</typeparam> /// <remarks> //...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Fallback; internal static class FallbackConstants { public const string DefaultName = "Fallback"; p<|fim_suffix|> string OnFallback = "OnFallback"; } <|fim_middle|>ublic const<|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_suffix|><T>>> ActionGenerator); <|fim_prefix|>namespace Polly.Fallback; intern<|fim_middle|>al sealed record class FallbackHandler<T>( Func<FallbackPredicateArguments<T>, ValueTask<bool>> ShouldHandle, Func<FallbackActionArguments<T>, ValueTask<Outcome<|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Fallback; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represents arguments used in fallback handling scenarios. /// </summary> /// <typeparam name="TResult">The type of result.</typeparam> /// <remarks> /// Always use the constru...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using Polly.Fallback; nam<|fim_suffix|>uard.NotNull(builder); Guard.NotNull(options); return builder.AddStrategy(context => CreateFallback(context, options), options); } private static Resilience...
fim
App-vNext/Polly
csharp
<|fim_suffix|>if (_onFallback is not null) { await _onFallback(onFallbackArgs).ConfigureAwait(context.ContinueOnCapturedContext); } try { return await _handler.ActionGenerator(new FallbackActionArguments<T>(context, outcome)).ConfigureAwait(context.ContinueOnCapt...
fim
App-vNext/Polly
csharp
<|fim_suffix|>t>, ValueTask<bool>> ShouldHandle { get; set; } = DefaultPredicates<FallbackPredicateArguments<TResult>, TResult>.HandleOutcome; /// <summary> /// Gets or sets the fallback action to be executed when the <see cref="ShouldHandle"/> predicate evaluates as true. /// </summary> /// <value> ...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ts{TResult}"/> struct. /// </summary> /// <param name="context">The outcome of the resilience operation or event.</param> /// <param name="outcome">The context in which the resilience operation or event occurred.</param> public OnFallbackArguments(ResilienceContext context, Outcome<TResult...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Hedging.Utils; internal enum HedgedTaskType<|fim_suffix|> } <|fim_middle|> { Primary, Secondary<|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_suffix|>ed.Increment(ref _rentedContexts); return new HedgingExecutionContext<T>(_executionPool, provider, maxAttempts, onReset); }, _ => { Interlocked.Decrement(ref _rentedContexts); // Stryker disable once Boolean : no means to...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using Polly.Hedging.Controller; namespace Polly.Hedging.Utils; /// <summary> /// The context associated with an execution of hedging resilience strategy. /// It holds the resources for all executed hedged tasks (primary + secondary) and is responsible for resource disposal. /// </summary> internal seale...
fim
App-vNext/Polly
csharp
<|fim_suffix|>sk<Outcome<T>>>?> ActionGenerator, Func<OnHedgingArguments<T>, ValueTask>? OnHedging) { public readonly bool IsDefaultActionGenerator = ActionGenerator == HedgingStrategyOptions<T>.DefaultActionGenerator; } <|fim_prefix|>namespace Polly.Hedging.Utils; internal sealed record class HedgingHandler<T...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using Polly.Hedging.Utils; using Polly.Telemetry; namespace Polly.Hedging.Controller; #pragma warning disable CA1031 // Do not catch general exception types /// <summary> /// Represents a single hedging attempt execution alongside all the necessary resources. These are: /// /// <list type="bullet"> ///...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Hedging; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represents arguments used in the hedging resilience strategy. /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <remarks> /// The <see cref="...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ultMaxHedgedAttempts = 1; public const int MinimumHedgedAttempts = 1; public const int MaximumHedgedAttempts = 10; public static readonly TimeSpan DefaultHedgingDelay = TimeSpan.FromSeconds(2); } <|fim_prefix|>namespace Polly.Hedging; internal static<|fim_middle|> class HedgingConstants { ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Hedging; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Arguments used by hedging delay generator. /// </summary> /// <remarks> /// Always use the constructor when creating this struct, otherwise we do not guarantee binary compatibi...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Hedging; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represents arguments used in hedging handling scenarios. /// </summary> /// <typeparam name="TResult">The type of result.</typeparam> /// <remarks> /// Always use the construct...
fim
App-vNext/Polly
csharp
<|fim_suffix|><param name="options">The options to configure the hedging.</param> /// <returns>The builder instance with the hedging added.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="builder"/> or <paramref name="options"/> is <see langword="null"/>.</exception> /// <e...
fim
App-vNext/Polly
csharp
<|fim_suffix|> it stays the same while hedging is executing. // If we do not do this the inner strategy can replace the cancellation token and with the concurrent // nature of hedging this can cause issues. var cancellationToken = context.CancellationToken; var continueOn...
fim
App-vNext/Polly
csharp
<|fim_suffix|>rguments<TResult>, ValueTask<bool>> ShouldHandle { get; set; } = DefaultPredicates<HedgingPredicateArguments<TResult>, TResult>.HandleOutcome; /// <summary> /// Gets or sets a generator that creates hedged actions. /// </summary> /// <value> /// The default generator executes the orig...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Hedging; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represents arguments used by the on-hedging event. /// </summary> /// <typeparam name="TResult">The type of result.</typeparam> /// <remarks> /// The <see cref="PrimaryContext"...
fim
App-vNext/Polly
csharp
<|fim_suffix|>bject?> properties, out IDictionary<string, object?> oldProperties) { Guard.NotNull(resilienceProperties); Guard.NotNull(properties); oldProperties = resilienceProperties.Options; resilienceProperties.Options = properties; } } <|fim_prefix|>using System.Com...
fim
App-vNext/Polly
csharp
<|fim_suffix|> an exception; otherwise, the string representation of the result. /// </returns> public override string ToString() => ExceptionDispatchInfo is not null ? Exception!.Message : Result?.ToString() ?? string.Empty; internal TResult GetResultOrRethrow() { ExceptionDisp...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; /// <summary> /// Produces instances of <see cref="Outcome{TResult}"/>. /// </summary> public static class Outcome { /// <summary> /// Returns a <see cref="Outcome{TResult}"/> with the given <paramref name="value"/>. /// </summary> /// <typeparam name="TResult">The type ...
fim
App-vNext/Polly
csharp
<|fim_suffix|>>>(PredicateBuilder<TResult> builder) { Guard.NotNull(builder); return builder.Build<CircuitBreakerPredicateArguments<TResult>>(); } } <|fim_prefix|>using System.ComponentModel; using Polly.CircuitBreaker; using Polly.Fallback; using Polly.Hedging; using Polly.Retry; namespace Po...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; /// <summary> /// Defines a builder for creating predicates for <typeparamref name="TResult"/> and <see cref="Exception"/> combinations. /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> public partial class PredicateBuilder<TResult> { private readonly ...
fim
App-vNext/Polly
csharp
<|fim_suffix|>} <|fim_prefix|>namespace Polly; /// <summary> /// Defines a builder for creating exception predicates. /// </summary> public sealed class Pr<|fim_middle|>edicateBuilder : PredicateBuilder<object> { <|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_prefix|>names<|fim_suffix|>// <summary> /// Class that represents the results that can be used in predicates. /// </summary> public static class PredicateResult { /// <summary> /// Returns a finished <see cref="ValueTask{TResult}"/> that returns <see langword="true"/> value. /// </summary> /// <re...
fim
App-vNext/Polly
csharp
namespace Polly.Registry; /// <summary> /// The context used by <see cref="ResiliencePipelineRegistry{TKey}"/>. /// </summary> /// <typeparam name="TKey">The type of the key.</typeparam> public class ConfigureBuilderContext<TKey> where TKey : notnull { internal ConfigureBuilderContext(TKey strategyKey, string ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using Polly.Telemetry; using Polly.Utils.Pipeline; namespace Polly.Registry; /// <summary> /// Builds a <see cref="PipelineComponent"/> used by the registry. /// </summary> internal sealed class RegistryPipelineComponentBuilder<TBuilder, TKey>( Func<TBuilder> activator, TKey key, string bui...
fim
App-vNext/Polly
csharp
<|fim_suffix|>e.</param> /// <param name="pipeline">The output resilience pipeline if found, <see langword="null"/> otherwise.</param> /// <returns><see langword="true"/> if the pipeline was found, <see langword="false"/> otherwise.</returns> public abstract bool TryGetPipeline(TKey key, [NotNullWhen(true)]...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.Diagnostics.CodeAnalysis; namespace Polly.Registry; public sealed partial class ResiliencePipelineRegistry<TKey> : ResiliencePipelineProvider<TKey> where TKey : notnull { private sealed class GenericRegistry<TResult> : IAsyncDisposable { private readonly Func<ResilienceP...
fim
App-vNext/Polly
csharp
<|fim_suffix|>/// After the disposal, all resilience pipelines still used outside of the builder are disposed /// and cannot be used anymore. /// </remarks> public async ValueTask DisposeAsync() { if (_disposed) { return; } _disposed = true; foreach ...
fim
App-vNext/Polly
csharp
<|fim_suffix|> PipelineComparer { get; set; } = EqualityComparer<TKey>.Default; /// <summary> /// Gets or sets the comparer that is used by the registry to retrieve the resilience pipeline builders. /// </summary> /// <value> /// The default value is <see cref="EqualityComparer{T}.Default"/>. /...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.Diagnostics.CodeAnalysis; namespace Polly; /// <summary> /// A context assigned to a single execution of <see cref="ResiliencePipeline"/>. It is created manually or automatically /// when the user calls the various extensions on top of <see cref="ResiliencePipeline"/>. After every execution...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Ar<|fim_suffix|>nArguments(string? operationKey, bool? continueOnCapturedContext, CancellationToken cancellationToken) { OperationKey = operationKey; ContinueOnCap...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; public abstract partial class Resilienc<|fim_suffix|> _pool = new(static () => new ResilienceContext(), static c => c.Reset()); public override ResilienceContext Get(ResilienceContextCreationArguments arguments) { var context = _pool.Get(); cont...
fim
App-vNext/Polly
csharp
<|fim_suffix|> </summary> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>An instance of <see cref="ResilienceContext"/>.</returns> /// <remarks> /// After the execution is finished you should return the <see cref="ResilienceContext"/> back to the pool /// by calling...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; #pragma warning disable CA1031 // Do not catch general exception types #pragma warning disable RS0027 // API with optional parameter(s) should have the most parameters amongst its public overloads public partial class ResiliencePipeline { /// <summary> /// Executes the specified...
fim
App-vNext/Polly
csharp
<|fim_suffix|>uard.NotNull(callback); Guard.NotNull(context); InitializeAsyncContext<TResult>(context); var outcome = await Component.ExecuteCore( [DebuggerDisableUserUnhandledExceptions] static async (context, state) => { try { ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; #pragma warning disable CA1031 // Do not catch general exception types #pragma warning disable RS0027 // API with optional parameter(s) should have the most parameters amongst its public overloads public partial class ResiliencePipeline { /// <summary> /// Executes the specified...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ntext.Initialize<TResult>(isSynchronous: true); } } <|fim_prefix|>namespace Polly; #pragma warning disable CA1031 // Do not catch general exception types #pragma warning disable RS0027 // API with optional parameter(s) should have the most parameters amongst its public overloads public partial class...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using Polly.Utils.Pipeline; namespace Polly; /// <summary> /// Resilience pipeline is used to execute the user-provided callbacks. /// </summary> /// <remarks> /// Resilience pipeline supports various types of callbacks and provides a unified way to execute them. /// This includes overloads for synchron...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel.DataAnnotations; namespace Polly; /// <summary> /// A builder that is used to create an instance of <see cref="ResiliencePipeline{TResult}"/>. /// </summary> /// <typeparam name="TResult">The type of result to handle.</typeparam> /// <remarks> /// The builder supports combini...
fim
App-vNext/Polly
csharp
<|fim_suffix|>"ResiliencePipeline"/>. /// </summary> /// <remarks> /// The builder supports combining multiple strategies into a pipeline of resilience strategies. /// The resulting instance of <see cref="ResiliencePipeline"/> created by the <see cref="Build"/> call executes the strategies in the same order they were a...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ntry.Options.Name); var telemetry = new ResilienceStrategyTelemetry(source, TelemetryListener); var context = new StrategyBuilderContext(telemetry, TimeProviderInternal); var strategy = entry.Factory(context); strategy.Options = entry.Options; return strategy; ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using Polly.Utils.Pipeline; namespace Polly; /// <summary> /// Extensions for <see cref="ResiliencePipelineBuilderBase"/>. /// </summary> public static class ResiliencePipelineBuilderExtensions { /// <summary> //...
fim
App-vNext/Polly
csharp
namespace Polly; #pragma warning disable RS0027 // API with optional parameter(s) should have the most parameters amongst its public overloads public partial class ResiliencePipeline<T> { /// <summary> /// Executes the specified callback. /// </summary> /// <typeparam name="TResult">The type of the re...
fim
App-vNext/Polly
csharp
<|fim_suffix|>peparam> /// <param name="callback">The user-provided callback.</param> /// <param name="state">The state associated with the callback.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> associated with the callback.</param> /// <returns>An instance of <see cre...
fim
App-vNext/Polly
csharp
<|fim_suffix|>per { get; } private ResiliencePipeline Pipeline { get; } } <|fim_prefix|>using Polly.Utils.Pipeline; namespace Polly; /// <summary> /// Resilience pipeline is used to execute the user-provided callbacks. /// </summary> /// <typeparam name="T">The type of result this pipeline supports.</typeparam> ...
fim
App-vNext/Polly
csharp
<|fim_suffix|>/// Sets the value of a given property. /// </summary> /// <param name="key">Strongly typed key to get the value of the property.</param> /// <param name="value">Returns the value of the property.</param> /// <typeparam name="TValue">The type of property value as defined by <paramref name=...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represen<|fim_suffix|>e key. /// </summary> public string Key { get; } /// <inheritdoc/> public override string ToString() => Key; } <|fim_middle|>ts a key used by <s...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly; /// <summary> /// This base strategy class is used to simplify the implementation of generic (reactive) /// strategies by limiting the number of generic types the execute method receives. /// </summary> /// <typeparam name="TResult">The type of result this strategy handles.</typeparam> ...
fim
App-vNext/Polly
csharp
<|fim_suffix|> TState, ValueTask<Outcome<TResult>>> callback, ResilienceContext context, TState state); } <|fim_prefix|>namespace Polly; /// <summary> /// Base class for all proactive resilience strategies. /// </summary> public abstract class ResilienceStrategy { /// <summary> /// An implemen...
fim
App-vNext/Polly
csharp
<|fim_suffix|></value> public string? Name { get; set; } } <|fim_prefix|>namespace Polly; /// <summary> /// The options associated with the individual resilience strategy. /// </summary> public abstract class ResilienceStrategyOptions { <|fim_middle|> /// <summary> /// Gets or sets the name of the strategy....
fim
App-vNext/Polly
csharp
<|fim_suffix|>/ <param name="instance">The instance being validated.</param> /// <param name="primaryMessage">The primary validation message.</param> public ResilienceValidationContext(object instance, string primaryMessage) { Instance = Guard.NotNull(instance); PrimaryMessage = Guard.NotNul...
fim
App-vNext/Polly
csharp
namespace Polly.Retry; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represents the arguments used by <see cref="RetryStrategyOptions{TResult}.OnRetry"/> for handling the retry event. /// </summary> /// <typeparam name="TResult">The type of result.</typeparam> ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Retry; internal static class RetryConstants { public const string DefaultName = "Retry"; public const string OnRetryEvent = "OnRetry"; public const DelayBackoffType Def<|fim_suffix|>nt DefaultRetryCount = 3; public const int MaxRetryCount = int.MaxValue; public sta...
fim
App-vNext/Polly
csharp
namespace Polly.Retry; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Represents the arguments used by <see cref="RetryStrategyOptions{TResult}.DelayGenerator"/> for generating the next retry delay. /// </summary> /// <typeparam name="TResult">The type of result...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Retry; internal static class RetryHelper { private const double JitterFactor = 0.5; private const double ExponentialFactor = 2.0; // Upper-bound to prevent overflow beyond TimeSpan.MaxValue. Potential truncation during conversion from double to long // (as described at h...
fim
App-vNext/Polly
csharp
<|fim_suffix|>Result> { /// <summary> /// Initializes a new instance of the <see cref="RetryPredicateArguments{TResult}"/> struct. /// </summary> /// <param name="outcome">The context in which the resilience operation or event occurred.</param> /// <param name="context">The outcome of the resilience...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using Polly.Retry; namespace Polly; /// <summary> /// Extensions for adding retries to <see cref="ResiliencePipelineBuilder"/>. /// </summary> public static class RetryResiliencePipelineBuilderExtensions { /// <summa...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ttempts = true; return attempt >= RetryCount; } } <|fim_prefix|>using Polly.Telemetry; namespace Polly.Retry; internal sealed class RetryResilienceStrategy<T> : ResilienceStrategy<T> { private readonly TimeProvider _timeProvider; private readonly ResilienceStrategyTelemetry _telemetr...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; namespace Polly.Retry; /// <summary> /// Represents the options used to configure a retry strategy. /// </summary> /// <typeparam name="TResult">The type of result the retry strategy handles....
fim
App-vNext/Polly
csharp
<|fim_suffix|> /// <inheritdoc/> public class RetryStrategyOptions : RetryStrategyOptions<object> { } <|fim_prefix|>namespace Polly.Retry<|fim_middle|>; <|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Behavior; #pragma warning disable CA1815 // Override equals and operator equals on<|fim_suffix|> Arguments used by the behavior chaos strategy to execute a user's delegate custom action. /// </summary> public readonly struct BehaviorGeneratorArguments { /// <summary> /// In...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Behavior; internal static class ChaosBehaviorCon<|fim_suffix|>tring OnBehaviorInjectedEvent = "Chaos.OnBehavior"; } <|fim_middle|>stants { public const string DefaultName = "Chaos.Behavior"; public const s<|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.C<|fim_suffix|>26:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "All options members preserved.")] public static TBuilder AddChaosBehavior<TBuilder>(this TBuilde...
fim
App-vNext/Polly
csharp
<|fim_suffix|> context, TState state) { try { if (await ShouldInjectAsync(context).ConfigureAwait(context.ContinueOnCapturedContext)) { await Behavior(new(context)).ConfigureAwait(context.ContinueOnCapturedContext); var args = new OnBe...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel.DataAnnotations; namespace Polly.Simmy.Behavior; /// <summary> /// Represents the options for the behavior chaos strategy. /// </summary> public class ChaosBehaviorStrategyOptions : ChaosStrategyOptions { /// <summary> /// Initializes a new instance of the <see cref=...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespac<|fim_suffix|><summary> /// Gets the resilience context instance. /// </summary> public ResilienceContext Context { get; } } <|fim_middle|>e Polly.Simmy.Behavior; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Arguments used by...
fim
App-vNext/Polly
csharp
<|fim_suffix|>jecting any chaos strategy to evaluate whether a given chaos strategy needs to be injected during the execution.</remarks> protected async ValueTask<bool> ShouldInjectAsync(ResilienceContext context) => await ChaosStrategyHelper .ShouldInjectAsync(context, InjectionRateGenerator, E...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using Polly.Simmy.Utils; namespace Polly.Simmy; /// <summary> /// Base class for chaos strategies. /// </summary> public abstract class ChaosStrategy : ResilienceStrategy { private readonly Func<double> _randomizer; /// <summary> /// Initializes a new instance of the <see cref="ChaosStrate...
fim
App-vNext/Polly
csharp
namespace Polly.Simmy; internal static class ChaosStrategyConstants { public const double MinInjectionThreshold = 0; public const double MaxInjectionThreshold = 1; public const double DefaultInjectionRate = 0.001; public const bool DefaultEnabled = true; } <|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel.DataAnnotations; namespace Polly.Simmy; /// <summary> /// The options associated with the <see cref="ChaosStrategy"/>. /// </summary> public abstract class ChaosStrategyOptions : ResilienceStrategyOptions { /// <summary> /// Gets or sets the injection rate for a give...
fim
App-vNext/Polly
csharp
<|fim_suffix|><see cref="EnabledGeneratorArguments"/> struct. /// </summary> /// <param name="context">The resilience context instance.</param> public EnabledGeneratorArguments(ResilienceContext context) => Context = context; /// <summary> /// Gets the ResilienceContext instance. /// </summary>...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace<|fim_suffix|>ring DefaultName = "Chaos.Fault"; public const string OnFaultInjectedEvent = "Chaos.OnFault"; } <|fim_middle|> Polly.Simmy.Fault; internal static class ChaosFaultConstants { public const st<|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_suffix|>y when trimming application code", Justification = "All options members preserved.")] public static TBuilder AddChaosFault<TBuilder>(this TBuilder builder, ChaosFaultStrategyOptions options) where TBuilder : ResiliencePipelineBuilderBase { Guard.NotNull(builder); Gu...
fim
App-vNext/Polly
csharp
<|fim_suffix|> { try { if (await ShouldInjectAsync(context).ConfigureAwait(context.ContinueOnCapturedContext)) { var fault = await FaultGenerator(new(context)).ConfigureAwait(context.ContinueOnCapturedContext); if (fault is not null) ...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ed. /// </summary> /// <value> /// Defaults to <see langword="null"/>. /// </value> public Func<OnFaultInjectedArguments, ValueTask>? OnFaultInjected { get; set; } = default!; /// <summary> /// Gets or sets the fault generator to be used for fault injection. /// </summary>...
fim
App-vNext/Polly
csharp
<|fim_suffix|>generatorDelegate(args.Context)!.Value.Exception); } } <|fim_prefix|>using System.ComponentModel; using Polly.Simmy.Utils; namespace Polly.Simmy.Fault; #pragma warning disable CA2225 // Operator overloads have named alternates #pragma warning disable RS0026 // Do not add multiple public overloads w...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Fault; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Arguments used by the fault chaos strategy to ge the fault that is going to be injected. /// </summary> public readonly struct FaultGeneratorArguments { /// <summary> ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Fault; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Arguments used by the fault chaos strategy to notify that an fault was injected. /// </summary> public readonly struct OnFaultInjectedArguments { /// <summary> ///...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Defines the arguments for the <see cref="ChaosStrategyOptions.InjectionRateGenerator"/>. /// </summary> public readonly struct InjectionRateGeneratorArguments { /// <summary...
fim
App-vNext/Polly
csharp
namespace Polly.Simmy.Latency; internal static class ChaosLatencyConstants { public const string DefaultName = "Chaos.Latency"; public const string OnLatencyInjectedEvent = "Chaos.OnLatency"; public static readonly TimeSpan DefaultLatency = TimeSpan.FromSeconds(30); } <|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_suffix|> Latency = latency }); } /// <summary> /// Adds a latency chaos strategy to the builder. /// </summary> /// <typeparam name="TBuilder">The builder type.</typeparam> /// <param name="builder">The builder instance.</param> /// <param name="options">The latency opti...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using Polly.Telemetry; namespace Polly.Simmy.Latency; internal sealed class ChaosLatencyStrategy : ChaosStrategy { private readonly TimeProvider _timeProvider; private readonly ResilienceStrategyTelemetry _telemetry; public ChaosLatencyStrategy( <|fim_suffix|>turedContext); ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Latency; #pragma warning disable CS8618 // Required members are not initialized in constructor since this is a DTO, default value is null /// <summary> /// Represents the options for the latency chaos strategy. /// </summary> public class ChaosLate<|fim_suffix|>f="Latency"/> is us...
fim
App-vNext/Polly
csharp
<|fim_suffix|>eneratorArguments"/> struct. /// </summary> /// <param name="context">The resilience context instance.</param> public LatencyGeneratorArguments(ResilienceContext context) => Context = context; /// <summary> /// Gets the resilience context instance. /// </summary> public Resili...
fim
App-vNext/Polly
csharp
<|fim_suffix|>ance.</param> /// <param name="latency">The latency that was injected.</param> public OnLatencyInjectedArguments(ResilienceContext context, TimeSpan latency) { Context = context; Latency = latency; } /// <summary> /// Gets the resilience context instance. /// <...
fim
App-vNext/Polly
csharp
<|fim_prefix|>n<|fim_suffix|>ng OnOutcomeInjectedEvent = "Chaos.OnOutcome"; } <|fim_middle|>amespace Polly.Simmy.Outcomes; internal static class ChaosOutcomeConstants { public const string DefaultName = "Chaos.Outcome"; public const stri<|endoftext|>
fim
App-vNext/Polly
csharp
<|fim_suffix|>Builder<TResult> AddChaosOutcome<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TResult>( this ResiliencePipelineBuilder<TResult> builder, ChaosOutcomeStrategyOptions<TResult> options) { Guard.NotNull(builder); Guard.NotNull(options); builder....
fim
App-vNext/Polly
csharp
<|fim_suffix|>njected is not null) { await _onOutcomeInjected(args).ConfigureAwait(context.ContinueOnCapturedContext); } return outcome; } context.CancellationToken.ThrowIfCancellationRequested(); return await call...
fim
App-vNext/Polly
csharp
<|fim_suffix|>faultName; /// <summary> /// Gets or sets the delegate that's invoked when the outcome is injected. /// </summary> /// <value> /// Defaults to <see langword="null"/>. /// </value> public Func<OnOutcomeInjectedArguments<TResult>, ValueTask>? OnOutcomeInjected { get; set; } ...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Outcomes; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> ///<|fim_suffix|>ypeparam> public readonly struct OnOutcomeInjectedArguments<TResult> { /// <summary> /// Initializes a new instance of the <see cref="OnOutcomeInje...
fim
App-vNext/Polly
csharp
<|fim_prefix|>using System.ComponentModel; using Polly.Simmy.Utils; namespace Polly.Simmy.Outcomes; #pragma warning disable CA2225 // Operator overloads have named alternates #pragma warning disable RS0026 // Do not add multiple public overloads with optional parameters /// <summary> /// Generator that produces out...
fim
App-vNext/Polly
csharp
<|fim_prefix|>namespace Polly.Simmy.Outcomes; #pragma warning disable CA1815 // Override equals and operator equals on value types /// <summary> /// Arguments used by <see cref="ChaosOutcomeStrategyOptions{TResult}.OutcomeGenerator"/>. /// </summary> public readonly struct <|fim_suffix|>ext = context; /// <summ...
fim
App-vNext/Polly
csharp
<|fim_suffix|> } // stryker disable once equality : no means to test this if (injectionThreshold > ChaosStrategyConstants.MaxInjectionThreshold) { return ChaosStrategyConstants.MaxInjectionThreshold; } return injectionThreshold; } } <|fim_prefix|>namespac...
fim
App-vNext/Polly
csharp