blob: b6fde9151db93b9107061fa3c0a2970284d3f8c3 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <memory>
#include <vector>
namespace proton::initializer {
/*
* Class representign an initializer task, used to load a data
* structure from disk during proton startup.
*/
class InitializerTask {
public:
using SP = std::shared_ptr<InitializerTask>;
using List = std::vector<SP>;
enum class State {
BLOCKED,
RUNNING,
DONE
};
private:
State _state;
List _dependencies;
public:
InitializerTask();
virtual ~InitializerTask();
State getState() const { return _state; }
const List &getDependencies() const { return _dependencies; }
void setRunning() { _state = State::RUNNING; }
void setDone() { _state = State::DONE; }
void addDependency(SP dependency);
virtual void run() = 0;
virtual size_t get_transient_memory_usage() const;
};
}
|