Newer
Older
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <ftl/master.hpp>
using ftl::ctrl::Master;
using ftl::net::Universe;
using ftl::Configurable;
using std::string;
using ftl::config::json_t;
using std::vector;
using std::function;
using ftl::ctrl::LogEvent;
Master::Master(Configurable *root, Universe *net)
: root_(root), net_(net) {
net_->bind("log", [this](const std::string &pre, const std::string &msg) {
for (auto f : log_handlers_) {
f({pre,msg});
}
});
}
Master::~Master() {
}
void Master::restart() {
net_->broadcast("restart");
}
void Master::restart(const ftl::UUID &peer) {
net_->send(peer, "restart");
}
void Master::shutdown() {
net_->broadcast("shutdown");
}
void Master::shutdown(const ftl::UUID &peer) {
net_->send(peer, "shutdown");
}
void Master::set(const string &uri, json_t &value) {
net_->broadcast("update_cfg", uri, (string)value);
}
void Master::set(const ftl::UUID &peer, const string &uri, json_t &value) {
net_->send(peer, "update_cfg", uri, (string)value);
}
vector<string> Master::getConfigurables() {
}
vector<string> Master::getConfigurables(const ftl::UUID &peer) {
}
vector<json_t> Master::get(const string &uri) {
}
json_t Master::getOne(const string &uri) {
}
json_t Master::get(const ftl::UUID &peer, const string &uri) {
}
void Master::watch(const string &uri, function<void()> f) {
}
// Events
//void onError();
void Master::onLog(function<void(const LogEvent &)> h) {
log_handlers_.push_back(h);
}