本文整理汇总了C++中common::ObServer::to_string方法的典型用法代码示例。如果您正苦于以下问题:C++ ObServer::to_string方法的具体用法?C++ ObServer::to_string怎么用?C++ ObServer::to_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::ObServer
的用法示例。
在下文中一共展示了ObServer::to_string方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_migrate_msg
int BalanceTestRpc::push_migrate_msg(const common::ObServer& src_cs, const common::ObServer& dest_cs, const common::ObRange& range, bool keep_src)
{
int ret = OB_SUCCESS;
MigrateMsg* msg = new_migrate_msg(src_cs, dest_cs, range, keep_src);
assert(msg);
assert(msg->next_ == NULL);
char addr_buf1[OB_IP_STR_BUFF];
char addr_buf2[OB_IP_STR_BUFF];
static char range_buf[OB_MAX_ROW_KEY_LENGTH * 2];
src_cs.to_string(addr_buf1, OB_IP_STR_BUFF);
dest_cs.to_string(addr_buf2, OB_IP_STR_BUFF);
tbsys::CThreadGuard guard(&migrate_msg_mutex_);
if (NULL == msg_head_)
{
msg_head_ = msg;
}
else
{
msg->next_ = msg_head_;
msg_head_ = msg;
}
msg_count_++;
msg->range_.to_string(range_buf, OB_MAX_ROW_KEY_LENGTH*2);
TBSYS_LOG(DEBUG, "push migrate msg, src=%s dest=%s range=%s",
addr_buf1, addr_buf2, range_buf);
return ret;
}
示例2: switch_schema
int ObRootRpcStub::switch_schema(const common::ObServer& ups, const common::ObSchemaManagerV2& schema_manager, const int64_t timeout_us)
{
int ret = OB_SUCCESS;
ObDataBuffer msgbuf;
if (NULL == client_mgr_)
{
TBSYS_LOG(ERROR, "client_mgr_=NULL");
ret = OB_ERROR;
}
else if (OB_SUCCESS != (ret = get_thread_buffer_(msgbuf)))
{
TBSYS_LOG(ERROR, "failed to get thread buffer, err=%d", ret);
}
else if (OB_SUCCESS != (ret = schema_manager.serialize(msgbuf.get_data(), msgbuf.get_capacity(), msgbuf.get_position())))
{
TBSYS_LOG(ERROR, "failed to serialize schema, err=%d", ret);
}
else if (OB_SUCCESS != (ret = client_mgr_->send_request(ups, OB_SWITCH_SCHEMA, DEFAULT_VERSION, timeout_us, msgbuf)))
{
TBSYS_LOG(WARN, "failed to send request, err=%d", ret);
}
else
{
ObResultCode result;
int64_t pos = 0;
if (OB_SUCCESS != (ret = result.deserialize(msgbuf.get_data(), msgbuf.get_position(), pos)))
{
TBSYS_LOG(ERROR, "failed to deserialize response, err=%d", ret);
}
else if (OB_SUCCESS != result.result_code_)
{
TBSYS_LOG(WARN, "failed to switch schema, err=%d", result.result_code_);
ret = result.result_code_;
}
else
{
char server_buf[OB_IP_STR_BUFF];
ups.to_string(server_buf, OB_IP_STR_BUFF);
TBSYS_LOG(INFO, "send up_switch_schema, ups=%s schema_version=%ld", server_buf, schema_manager.get_version());
}
}
return ret;
}