本文整理汇总了C++中session::disable_backend方法的典型用法代码示例。如果您正苦于以下问题:C++ session::disable_backend方法的具体用法?C++ session::disable_backend怎么用?C++ session::disable_backend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::disable_backend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
示例2: test_disable_backend
static void test_disable_backend(session &sess)
{
server_node &node = global_data->nodes[0];
std::string host = node.remote().to_string();
auto tuple = std::make_tuple(host, 0, 1);
auto unique_hosts = get_unique_hosts(sess);
BOOST_REQUIRE_MESSAGE(unique_hosts.find(tuple) != unique_hosts.end(),
"Host must exist: " + host + ", group: 0, backend: 1");
ELLIPTICS_REQUIRE(enable_result, sess.disable_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 not exist: " + host + ", group: 0, backend: 1");
}
示例3: test_disable_backend_again
static void test_disable_backend_again(session &sess)
{
server_node &node = global_data->nodes[0];
ELLIPTICS_REQUIRE_ERROR(enable_result, sess.disable_backend(node.remote(), 1), -EALREADY);
}