-
Notifications
You must be signed in to change notification settings - Fork 51
/
BatchingSettings.cs
47 lines (42 loc) · 1.97 KB
/
BatchingSettings.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
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright 2017 Google Inc. All Rights Reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://developers.google.com/open-source/licenses/bsd
*/
using System;
namespace Google.Api.Gax
{
/// <summary>
/// Batching settings used to specify the conditions under which a batch of data
/// will be further processed.
/// </summary>
public sealed class BatchingSettings
{
/// <summary>
/// Creates a new instance with the specified settings.
/// </summary>
/// <param name="elementCountThreshold">The element count above which further processing of a batch will occur.</param>
/// <param name="byteCountThreshold">The byte count above which further processing of a batch will occur.</param>
/// <param name="delayThreshold">The batch lifetime above which further processing of a batch will occur.</param>
public BatchingSettings(long? elementCountThreshold, long? byteCountThreshold, TimeSpan? delayThreshold)
{
ElementCountThreshold = GaxPreconditions.CheckNonNegative(elementCountThreshold, nameof(elementCountThreshold));
ByteCountThreshold = GaxPreconditions.CheckNonNegative(byteCountThreshold, nameof(byteCountThreshold));
GaxPreconditions.CheckNonNegative(delayThreshold?.TotalSeconds, nameof(delayThreshold));
DelayThreshold = delayThreshold;
}
/// <summary>
/// The element count above which further processing of a batch will occur.
/// </summary>
public long? ElementCountThreshold { get; }
/// <summary>
/// The byte count above which further processing of a batch will occur.
/// </summary>
public long? ByteCountThreshold { get; }
/// <summary>
/// The batch lifetime above which further processing of a batch will occur.
/// </summary>
public TimeSpan? DelayThreshold { get; }
}
}