/*
 * Fills status section of one backend
 */
static void fill_backend_status(rapidjson::Value &stat_value,
                                rapidjson::Document::AllocatorType &allocator,
                                struct dnet_node *node,
                                dnet_backend_status &status,
                                const dnet_backend_info *config_backend) {
	backend_fill_status_nolock(node, &status, config_backend);

	rapidjson::Value status_value(rapidjson::kObjectType);
	status_value.AddMember("state", status.state, allocator);
	status_value.AddMember("string_state", dnet_backend_state_string(status.state), allocator);
	status_value.AddMember("defrag_state", status.defrag_state, allocator);
	status_value.AddMember("string_defrag_state", dnet_backend_defrag_state_string(status.defrag_state), allocator);

	rapidjson::Value last_start(rapidjson::kObjectType);
	last_start.AddMember("tv_sec", status.last_start.tsec, allocator);
	last_start.AddMember("tv_usec", status.last_start.tnsec / 1000, allocator);
	status_value.AddMember("last_start", last_start, allocator);

	status_value.AddMember("string_last_time", dnet_print_time(&status.last_start), allocator);
	status_value.AddMember("last_start_err", status.last_start_err, allocator);
	status_value.AddMember("read_only", status.read_only == 1, allocator);
	status_value.AddMember("delay", status.delay, allocator);

	stat_value.AddMember("status", status_value, allocator);
}
示例#2
0
std::string elliptics_time::to_repr() const {
	std::string ret = "elliptics.Time(";
	ret += dnet_print_time(&m_time);
	ret += ")";
	return ret;
}
示例#3
0
std::string elliptics_time::to_str() const {
	std::string ret;
	ret += dnet_print_time(&m_time);
	return ret;
}