| 112 | } |
| 113 | |
| 114 | error_code service_node::start() |
| 115 | { |
| 116 | error_code err = ERR_OK; |
| 117 | |
| 118 | // init data dir |
| 119 | if (!dsn::utils::filesystem::path_exists(spec().data_dir)) |
| 120 | dsn::utils::filesystem::create_directory(spec().data_dir); |
| 121 | |
| 122 | // init task engine |
| 123 | _computation = std::make_unique<task_engine>(this); |
| 124 | _computation->create(_app_spec.pools); |
| 125 | CHECK(!_computation->is_started(), "task engine must not be started at this point"); |
| 126 | |
| 127 | // init rpc |
| 128 | err = init_rpc_engine(); |
| 129 | if (err != ERR_OK) |
| 130 | return err; |
| 131 | |
| 132 | // start task engine |
| 133 | _computation->start(); |
| 134 | CHECK(_computation->is_started(), "task engine must be started at this point"); |
| 135 | |
| 136 | // create service_app |
| 137 | { |
| 138 | ::dsn::tools::node_scoper scoper(this); |
| 139 | init_service_app(); |
| 140 | } |
| 141 | |
| 142 | // start rpc serving |
| 143 | _rpc->start_serving(); |
| 144 | |
| 145 | return err; |
| 146 | } |
| 147 | |
| 148 | void service_node::get_runtime_info(const std::string &indent, |
| 149 | const std::vector<std::string> &args, |
no test coverage detected