-
Notifications
You must be signed in to change notification settings - Fork 527
Expand file tree
/
Copy pathChangeFeedLeaseOptions.cs
More file actions
53 lines (45 loc) · 2.4 KB
/
ChangeFeedLeaseOptions.cs
File metadata and controls
53 lines (45 loc) · 2.4 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace Microsoft.Azure.Cosmos.ChangeFeed.Configuration
{
using System;
/// <summary>
/// Options to control various aspects of partition distribution happening within <see cref="ChangeFeedProcessorCore"/> instance.
/// </summary>
internal class ChangeFeedLeaseOptions
{
internal static readonly TimeSpan DefaultRenewInterval = TimeSpan.FromSeconds(17);
internal static readonly TimeSpan DefaultAcquireInterval = TimeSpan.FromSeconds(13);
internal static readonly TimeSpan DefaultExpirationInterval = TimeSpan.FromSeconds(60);
/// <summary>Initializes a new instance of the <see cref="ChangeFeedLeaseOptions" /> class.</summary>
public ChangeFeedLeaseOptions()
{
this.LeaseRenewInterval = DefaultRenewInterval;
this.LeaseAcquireInterval = DefaultAcquireInterval;
this.LeaseExpirationInterval = DefaultExpirationInterval;
}
/// <summary>
/// Gets or sets renew interval for all leases currently held by <see cref="ChangeFeedProcessorCore"/> instance.
/// </summary>
public TimeSpan LeaseRenewInterval { get; set; }
/// <summary>
/// Gets or sets the interval to kick off a task to compute if leases are distributed evenly among known host instances.
/// </summary>
public TimeSpan LeaseAcquireInterval { get; set; }
/// <summary>
/// Gets or sets the interval for which the lease is taken. If the lease is not renewed within this
/// interval, it will cause it to expire and ownership of the lease will move to another <see cref="ChangeFeedProcessorCore"/> instance.
/// </summary>
public TimeSpan LeaseExpirationInterval { get; set; }
/// <summary>
/// Gets or sets a prefix to be used as part of the lease id. This can be used to support multiple instances of <see cref="ChangeFeedProcessorCore"/>
/// instances pointing at the same feed while using the same auxiliary collection.
/// </summary>
public string LeasePrefix { get; set; }
/// <summary>
/// Gets or sets the <see cref="ChangeFeedMode"/>.
/// </summary>
public ChangeFeedMode Mode { get; set; }
}
}