This repository was archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (46 loc) · 2.06 KB
/
main.cpp
File metadata and controls
50 lines (46 loc) · 2.06 KB
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
#include "server/main.hpp"
#include <thread>
#include <capnp/ez-rpc.h>
#include "server/server.hpp"
#include "util/daemon.hpp"
#include "util/flags.hpp"
#include "util/log_manager.hpp"
#include "util/misc.hpp"
#include "util/version.hpp"
namespace server {
kj::MainBuilder::Validity Main::Run() {
if (Flags::daemon) {
util::daemonize("server", Flags::pidfile);
}
util::LogManager log_manager(&context);
capnp::EzRpcServer server(kj::heap<server::Server>(), Flags::listen_address,
Flags::port);
kj::NEVER_DONE.wait(server.getWaitScope());
}
kj::MainFunc Main::getMain() {
return kj::MainBuilder(context, "Task-Maker Server (" + util::version + ")",
"Receives evaluations and dispatches them to workers")
.addOptionWithArg({'L', "logfile"}, util::setString(&Flags::log_file),
"<LOGFILE>", "Path where the log file should be stored")
.addOption({'d', "daemon"}, util::setBool(&Flags::daemon),
"Become a daemon")
.addOptionWithArg({'P', "pidfile"}, util::setString(&Flags::pidfile),
"<PIDFILE>", "Path where the pidfile should be stored")
.addOptionWithArg({'S', "store-dir"},
util::setString(&Flags::store_directory), "<DIR>",
"Path where the files should be stored")
.addOptionWithArg({'T', "temp-dir"},
util::setString(&Flags::temp_directory), "<DIR>",
"Path where the sandboxes should be crated")
.addOptionWithArg({'l', "address"},
util::setString(&Flags::listen_address), "<ADDRESS>",
"Address to listen on")
.addOptionWithArg({'p', "port"}, util::setInt(&Flags::port), "<PORT>",
"Port to listen on")
.addOptionWithArg(
{'c', "cache-size"}, util::setUint(&Flags::cache_size), "<SZ>",
"Maximum size of the cache, in MiB. 0 means unlimited")
.callAfterParsing(KJ_BIND_METHOD(*this, Run))
.build();
}
} // namespace server