本文整理汇总了C++中ObPacket::deserialize方法的典型用法代码示例。如果您正苦于以下问题:C++ ObPacket::deserialize方法的具体用法?C++ ObPacket::deserialize怎么用?C++ ObPacket::deserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObPacket
的用法示例。
在下文中一共展示了ObPacket::deserialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_request
int MockNodeServer::do_request(ObPacket* base_packet)
{
int err = OB_SUCCESS;
ObPacket* req = static_cast<ObPacket*>(base_packet);
int packet_code = req->get_packet_code();
err = req->deserialize();
if(OB_SUCCESS == err)
{
switch(packet_code)
{
case OB_MMS_HEART_BEAT:
case OB_MMS_STOP_SLAVE:
case OB_MMS_SLAVE_DOWN:
case OB_MMS_TRANSFER_2_MASTER:
err = node_.handlePacket(req);
break;
default:
err = OB_ERROR;
TBSYS_LOG(ERROR, "wrong packet code:packet[%d]", packet_code);
break;
}
}
if(err != OB_SUCCESS)
{
TBSYS_LOG(WARN, "check handle failed:ret[%d]", err);
}
return err;
}
示例2: deserialize_packet
int ObMsSqlRpcEvent::deserialize_packet(ObPacket & packet, ObNewScanner & result)
{
ObDataBuffer * data_buff = NULL;
int ret = packet.deserialize();
if (ret != OB_SUCCESS)
{
TBSYS_LOG(WARN, "deserialize the packet failed:ret[%d]", ret);
}
else
{
data_buff = packet.get_buffer();
if (NULL == data_buff)
{
ret = OB_INNER_STAT_ERROR;
TBSYS_LOG(WARN, "check packet data buff failed:buff[%p]", data_buff);
}
if (packet.get_packet_code() == OB_SESSION_END)
{
/// when session end, set session id to 0
set_session_end();
}
else
{
set_session_id(packet.get_session_id());
}
}
ObResultCode code;
if (OB_SUCCESS == ret)
{
ret = code.deserialize(data_buff->get_data(), data_buff->get_capacity(),
data_buff->get_position());
if (OB_SUCCESS != ret)
{
TBSYS_LOG(ERROR, "deserialize result failed:pos[%ld], ret[%d]",
data_buff->get_position(), ret);
}
else
{
ObCommonSqlRpcEvent::set_result_code(code.result_code_);
}
}
///
result.clear();
if ((OB_SUCCESS == ret) && (OB_SUCCESS == code.result_code_))
{
ret = result.deserialize(data_buff->get_data(), data_buff->get_capacity(),
data_buff->get_position());
if (ret != OB_SUCCESS)
{
TBSYS_LOG(WARN, "deserialize scanner failed:pos[%ld], ret[%d]",
data_buff->get_position(), ret);
}
}
return ret;
}
示例3: do_request
int MockMergeServer::do_request(ObPacket * base_packet)
{
ObPacket * packet = base_packet;
int32_t packet_code = packet->get_packet_code();
int ret = OB_SUCCESS;
ret = packet->deserialize();
int64_t receive_time = packet->get_receive_ts();
int32_t version = packet->get_api_version();
int32_t channelId = packet->getChannelId();
tbnet::Connection *connection = packet->get_connection();
ObDataBuffer *in_buff = packet->get_buffer();
ThreadSpecificBuffer::Buffer *thread_buff = response_packet_buffer_.get_buffer();
//貌似刨去了网络时间?
int64_t timeout_us = packet->get_source_timeout() - (tbsys::CTimeUtil::getTime() - packet->get_receive_ts());
if (NULL != thread_buff)
{
thread_buff->reset();
ObDataBuffer out_buff(thread_buff->current(), thread_buff->remain());
if (OB_SUCCESS == ret)
{
switch(packet_code)
{
case OB_SCAN_REQUEST:
ret = ms_scan(receive_time, version, channelId, connection, *in_buff, out_buff, timeout_us);
if (ret != OB_SUCCESS)
{
TBSYS_LOG(WARN, "ms_scan failed");
}
break;
}
}
}
return ret;
}