本文整理汇总了C++中session::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ session::exec方法的具体用法?C++ session::exec怎么用?C++ session::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::exec方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start_application
static void start_application(session &sess, const std::string &app_name)
{
key key_id = app_name;
key_id.transform(sess);
dnet_id id = key_id.id();
ELLIPTICS_REQUIRE(result, sess.exec(&id, app_name + "@start-task", data_pointer()));
}
示例2: init_application_impl
static void init_application_impl(session &sess, const std::string &app_name, nodes_data &data)
{
node_info info = node_info::create(data, sess.get_groups());
ELLIPTICS_REQUIRE(exec_result, sess.exec(NULL, app_name + "@init", info.pack()));
sync_exec_result result = exec_result;
BOOST_REQUIRE_EQUAL(result.size(), data.nodes.size());
for (auto it = result.begin(); it != result.end(); ++it)
BOOST_REQUIRE_EQUAL(it->context().data().to_string(), "inited");
}
示例3: send_echo
static void send_echo(session &sess, const std::string &app_name, const std::string &data)
{
key key_id = app_name;
key_id.transform(sess);
dnet_id id = key_id.id();
ELLIPTICS_REQUIRE(exec_result, sess.exec(&id, app_name + "@echo", data));
sync_exec_result result = exec_result;
BOOST_REQUIRE_EQUAL(result.size(), 1);
BOOST_REQUIRE_EQUAL(result[0].context().data().to_string(), data);
}
示例4: init_application_impl
void init_application_impl(session &sess, const std::string &app_name, const nodes_data *setup)
{
sess.set_timeout(600);
auto log = sess.get_logger();
DNET_LOG_INFO(log, "Sending @init");
node_info info = node_info_create(setup, sess.get_groups());
ELLIPTICS_REQUIRE(exec_result, sess.exec(NULL, app_name + "@init", info.pack()));
sync_exec_result result = exec_result;
BOOST_REQUIRE_EQUAL(result.size(), setup->nodes.size());
for (auto it = result.begin(); it != result.end(); ++it)
BOOST_REQUIRE_EQUAL(it->context().data().to_string(), "inited");
}
示例5: init_application
static void init_application(session &sess, const std::string &app_name)
{
key key_id = app_name;
key_id.transform(sess);
dnet_id id = key_id.id();
node_info info;
info.groups = { 1 };
info.path = global_data->directory.path();
for (auto it = global_data->nodes.begin(); it != global_data->nodes.end(); ++it)
info.remotes.push_back(it->remote());
ELLIPTICS_REQUIRE(exec_result, sess.exec(&id, app_name + "@init", info.pack()));
sync_exec_result result = exec_result;
BOOST_REQUIRE_EQUAL(result.size(), 1);
BOOST_REQUIRE_EQUAL(result[0].context().data().to_string(), "inited");
}
示例6: start_application
static void start_application(session &sess, const std::string &app_name)
{
ELLIPTICS_REQUIRE(result, sess.exec(NULL, app_name + "@start-task", data_pointer()));
}