HedgingStrategyOptions<TResult>
Hedging strategy options.
using Polly.Utils;
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Polly.Hedging
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class HedgingStrategyOptions<[System.Runtime.CompilerServices.Nullable(2)] TResult> : ResilienceStrategyOptions
{
public sealed override string StrategyType => "Hedging";
public TimeSpan HedgingDelay { get; set; } = HedgingConstants.DefaultHedgingDelay;
[Range(2, 10)]
public int MaxHedgedAttempts { get; set; } = 2;
[System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
0
})]
[Required]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
0
})]
public Func<OutcomeArguments<TResult, HedgingPredicateArguments>, ValueTask<bool>> ShouldHandle {
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
0
})]
get;
[param: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
0
})]
set;
} = DefaultPredicates<HedgingPredicateArguments, TResult>.HandleOutcome;
[System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
2,
0,
0,
1
})]
[Required]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
2,
0,
0,
1
})]
public Func<HedgingActionGeneratorArguments<TResult>, Func<ValueTask<Outcome<TResult>>>> HedgingActionGenerator {
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
2,
0,
0,
1
})]
get;
[param: System.Runtime.CompilerServices.Nullable(new byte[] {
1,
0,
1,
2,
0,
0,
1
})]
set;
}
[System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0
})]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0
})]
public Func<HedgingDelayArguments, ValueTask<TimeSpan>> HedgingDelayGenerator {
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0
})]
get;
[param: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0
})]
set;
}
[System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
[field: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
public Func<OutcomeArguments<TResult, OnHedgingArguments>, ValueTask> OnHedging {
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
get;
[param: System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1,
1
})]
set;
}
public HedgingStrategyOptions()
{
object <>4__this;
HedgingActionGenerator = ((HedgingActionGeneratorArguments<TResult> args) => delegate {
<>c__DisplayClass26_0.<<-ctor>b__1>d stateMachine = default(<>c__DisplayClass26_0.<<-ctor>b__1>d);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Outcome<TResult>>.Create();
stateMachine.<>4__this = (<>c__DisplayClass26_0)<>4__this;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
});
base..ctor();
}
}
}