blob: 9bddc5b46eb397c18c0b1a9f1024d3850d6426db (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <mutex>
#include <memory>
#include <vector>
namespace proton {
class IReprocessingTask;
/**
* Class for running reprocessing task.
*/
class ReprocessingRunner
{
public:
using ReprocessingTasks = std::vector<std::shared_ptr<IReprocessingTask>>;
private:
mutable std::mutex _lock;
ReprocessingTasks _tasks; // Protected by _lock
enum State
{
NOT_STARTED,
RUNNING,
DONE
};
State _state;
public:
ReprocessingRunner();
void addTasks(const ReprocessingTasks &tasks);
void run();
void reset();
bool empty() const;
double getProgress() const;
};
} // namespace proton
|