blob: d84763cf2848bf67b890fca8553926aa6d132806 (
plain) (
blame)
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
|
#pragma once
#include <library/cpp/yt/cpu_clock/clock.h>
#include <library/cpp/yt/misc/enum.h>
#include <util/system/types.h>
#include <util/generic/size_literals.h>
#include <util/datetime/base.h>
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
DEFINE_ENUM(EStockpileStrategy,
((FixedBreaks) (0))
((FlooredLoad) (1))
((ProgressiveBackoff) (2))
);
////////////////////////////////////////////////////////////////////////////////
struct TStockpileOptions
{
static constexpr i64 DefaultBufferSize = 4_GBs;
i64 BufferSize = DefaultBufferSize;
static constexpr int DefaultThreadCount = 4;
int ThreadCount = DefaultThreadCount;
static constexpr EStockpileStrategy DefaultStrategy = EStockpileStrategy::FixedBreaks;
EStockpileStrategy Strategy = DefaultStrategy;
static constexpr TDuration DefaultPeriod = TDuration::MilliSeconds(10);
TDuration Period = DefaultPeriod;
};
////////////////////////////////////////////////////////////////////////////////
void RunStockpileThread(TStockpileOptions options, std::atomic<bool>* shouldProceed);
void RunDetachedStockpileThreads(TStockpileOptions options);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|