当前位置: 首页>>代码示例>>C++>>正文


C++ session::enable_backend方法代码示例

本文整理汇总了C++中session::enable_backend方法的典型用法代码示例。如果您正苦于以下问题:C++ session::enable_backend方法的具体用法?C++ session::enable_backend怎么用?C++ session::enable_backend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在session的用法示例。


在下文中一共展示了session::enable_backend方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_set_backend_ids_for_disabled

static void test_set_backend_ids_for_disabled(session &sess)
{
	server_node &node = global_data->nodes.back();

	auto ids = generate_ids(16);

	ELLIPTICS_REQUIRE(async_set_result, sess.set_backend_ids(node.remote(), 4, ids));

	backend_status_result_entry result = async_set_result.get_one();
	BOOST_REQUIRE(result.is_valid());
	BOOST_REQUIRE_EQUAL(result.count(), 1);

	dnet_backend_status *status = result.backend(0);
	BOOST_REQUIRE_EQUAL(status->backend_id, 4);
	BOOST_REQUIRE_EQUAL(status->state, DNET_BACKEND_DISABLED);

	ELLIPTICS_REQUIRE(async_enable_result, sess.enable_backend(node.remote(), 4));

	// Wait 0.1 secs to ensure that route list was changed
	usleep(100 * 1000);

	auto route_ids = backend_ids(sess, node.remote(), 4);
	BOOST_REQUIRE_EQUAL(ids.size(), route_ids.size());
	BOOST_REQUIRE(compare_ids(ids, route_ids));
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:25,代码来源:backends_test.cpp

示例2: test_enable_backend_after_config_change

static void test_enable_backend_after_config_change(session &sess)
{
	server_node &node = get_setup()->nodes[0];

	server_config &config = node.config();
	config_data &hidden_backend = config.backends.back();
	uint32_t backend_id = std::stoi(hidden_backend.string_value("backend_id"));

	ELLIPTICS_REQUIRE_ERROR(enable_result, sess.enable_backend(node.remote(), backend_id), -ENOENT);

	hidden_backend.set_serializable(true);
	config.write(node.config_path());

	test_enable_backend(sess, backend_id);
}
开发者ID:interiorem,项目名称:elliptics,代码行数:15,代码来源:backends_test.cpp

示例3: test_change_group

static void test_change_group(session &sess)
{
	server_node &node = global_data->nodes.back();
	const uint32_t backend_id = 4;
	const int old_group_id = 2;
	const int new_group_id = 10;

	std::string host = node.remote().to_string();
	auto old_tuple = std::make_tuple(host, old_group_id, backend_id);
	auto new_tuple = std::make_tuple(host, new_group_id, backend_id);

	auto unique_hosts = get_unique_hosts(sess);

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(old_tuple) != unique_hosts.end(),
		"Host must not exist: " + host + ", group: 2, backend: 1");

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(new_tuple) == unique_hosts.end(),
		"Host must not exist: " + host + ", group: 10, backend: 1");

	server_config server = node.config();
	config_data &backend = server.backends[backend_id];
	backend("group", new_group_id);

	server.write(node.config_path());

	ELLIPTICS_REQUIRE(stop_result, sess.disable_backend(node.remote(), backend_id));
	ELLIPTICS_REQUIRE(start_result, sess.enable_backend(node.remote(), backend_id));

	// Wait 0.1 secs to ensure that route list was changed
	usleep(100 * 1000);

	unique_hosts = get_unique_hosts(sess);

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(old_tuple) == unique_hosts.end(),
		"Host must not exist: " + host + ", group: 2, backend: 1");

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(new_tuple) != unique_hosts.end(),
		"Host must not exist: " + host + ", group: 10, backend: 1");
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:39,代码来源:backends_test.cpp

示例4: test_enable_backend_at_empty_node

static void test_enable_backend_at_empty_node(session &sess)
{
	server_node &node = global_data->nodes.back();

	std::string host = node.remote().to_string();
	auto tuple = std::make_tuple(host, groups_count, 1);

	auto unique_hosts = get_unique_hosts(sess);

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(tuple) == unique_hosts.end(),
		"Host must not exist: " + host + ", group: 2, backend: 1");

	ELLIPTICS_REQUIRE(enable_result, sess.enable_backend(node.remote(), 1));

	// Wait 0.1 secs to ensure that route list was changed
	usleep(100 * 1000);

	unique_hosts = get_unique_hosts(sess);

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(tuple) != unique_hosts.end(),
		"Host must exist: " + host + ", group: 2, backend: 1");
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:22,代码来源:backends_test.cpp

示例5: test_enable_backend

static void test_enable_backend(session &sess, uint32_t backend_id)
{
	server_node &node = get_setup()->nodes[0];

	std::string host = node.remote().to_string();
	auto tuple = std::make_tuple(host, 0, backend_id);

	auto unique_hosts = get_unique_hosts(sess);

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(tuple) == unique_hosts.end(),
	                      "Host must not exist: " + host + ", group: 0, backend: " +
	                          std::to_string(static_cast<long long>(backend_id)));

	ELLIPTICS_REQUIRE(enable_result, sess.enable_backend(node.remote(), backend_id));

	// Wait 0.1 secs to ensure that route list was changed
	usleep(100 * 1000);

	unique_hosts = get_unique_hosts(sess);

	BOOST_REQUIRE_MESSAGE(unique_hosts.find(tuple) != unique_hosts.end(),
	                      "Host must exist: " + host + ", group: 0, backend: " +
	                          std::to_string(static_cast<long long>(backend_id)));
}
开发者ID:interiorem,项目名称:elliptics,代码行数:24,代码来源:backends_test.cpp

示例6: test_enable_backend_again

static void test_enable_backend_again(session &sess)
{
	server_node &node = global_data->nodes[0];

	ELLIPTICS_REQUIRE_ERROR(enable_result, sess.enable_backend(node.remote(), 1), -EALREADY);
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:6,代码来源:backends_test.cpp


注:本文中的session::enable_backend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。