-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathInjectBehaviourAsyncOptions.cs
36 lines (32 loc) · 1.09 KB
/
InjectBehaviourAsyncOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Polly.Contrib.Simmy.Behavior.Options
{
/// <summary>
/// Options used to configure an <see cref="AsyncInjectBehaviourPolicy"/>
/// </summary>
public class InjectBehaviourAsyncOptions
{
/// <summary>
/// Behaviour Delegate to be executed
/// </summary>
public Func<Context, CancellationToken, Task> Behaviour { get; set; }
/// <summary>
/// Lambda to get injection rate between [0, 1]
/// </summary>
public Func<Context, CancellationToken, Task<Double>> InjectionRate { get; set; }
/// <summary>
/// Lambda to check if this policy is enabled in current context
/// </summary>
public Func<Context, CancellationToken, Task<bool>> Enabled { get; set; }
}
/// <inheritdoc/>
public class InjectBehaviourAsyncBasicOptions : DefaultOptions
{
/// <summary>
/// Behaviour Delegate to be executed without context
/// </summary>
public Func<Task> Behaviour { get; set; }
}
}