本文整理汇总了C++中ObDataBuffer::set_data方法的典型用法代码示例。如果您正苦于以下问题:C++ ObDataBuffer::set_data方法的具体用法?C++ ObDataBuffer::set_data怎么用?C++ ObDataBuffer::set_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObDataBuffer
的用法示例。
在下文中一共展示了ObDataBuffer::set_data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_frame_buffer
int ObServerRpc::get_frame_buffer(ObDataBuffer& data_buffer) const
{
int ret = OB_SUCCESS;
ThreadSpecificBuffer::Buffer* rpc_buffer = NULL;
if (NULL == rpc_frame_)
{
TBSYS_LOG(WARN, "server rpc doesn't init.");
ret = OB_ERROR;
}
if (OB_SUCCESS == ret)
{
rpc_buffer = frame_buffer_.get_buffer();
if (NULL == rpc_buffer)
{
TBSYS_LOG(WARN, "get thread rpc buff failed,buffer=%p.", rpc_buffer);
ret = OB_ERROR;
}
else
{
rpc_buffer->reset();
data_buffer.set_data(rpc_buffer->current(), rpc_buffer->remain());
}
}
return ret;
}
示例2:
int ObUpsRpcStub :: get_thread_buffer_(ObDataBuffer& data_buff)
{
int err = OB_SUCCESS;
ThreadSpecificBuffer::Buffer* rpc_buffer = NULL;
// get buffer for rpc send and receive
ObUpdateServerMain* obj = ObUpdateServerMain::get_instance();
if (NULL == obj)
{
TBSYS_LOG(ERROR, "get ObUpdateServerMain instance failed.");
}
else
{
const ObUpdateServer& server = obj->get_update_server();
rpc_buffer = server.get_rpc_buffer();
if (NULL == rpc_buffer)
{
TBSYS_LOG(ERROR, "get thread rpc buff failed:buffer[%p].", rpc_buffer);
err = OB_ERROR;
}
else
{
rpc_buffer->reset();
data_buff.set_data(rpc_buffer->current(), rpc_buffer->remain());
}
}
return err;
}
示例3: get_frame_buffer
int ObClientServerStub::get_frame_buffer(ObDataBuffer & data_buffer) const
{
int ret = OB_SUCCESS;
if (!check_inner_stat())
{
TBSYS_LOG(ERROR, "check inner stat failed.");
ret = OB_ERROR;
}
ThreadSpecificBuffer::Buffer* rpc_buffer = frame_buffer_.get_buffer();
if (OB_SUCCESS == ret)
{
if (NULL == rpc_buffer)
{
TBSYS_LOG(ERROR, "get thread rpc buff failed:buffer[%p].", rpc_buffer);
ret = OB_ERROR;
}
else
{
rpc_buffer->reset();
data_buffer.set_data(rpc_buffer->current(), rpc_buffer->remain());
}
}
return ret;
}
示例4: get_buffer
int TaskOutputFile::get_buffer(ObDataBuffer &buffer)
{
int ret = OB_SUCCESS;
ret = buffer_.ensure_space(2 * OB_MAX_PACKET_LENGTH);
if (ret != OB_SUCCESS)
{
TBSYS_LOG(ERROR, "no enough memory for buffer");
}
else
{
buffer.set_data(buffer_.get_buffer(), buffer_.get_buffer_size());
}
return ret;
}
示例5: create_tablet
int ObRootRpcStub::create_tablet(const common::ObServer& cs, const common::ObRange& range, const int64_t mem_version, const int64_t timeout_us)
{
int ret = OB_SUCCESS;
ObDataBuffer msgbuf;
static char buff[OB_MAX_PACKET_LENGTH];
msgbuf.set_data(buff, OB_MAX_PACKET_LENGTH);
if (NULL == client_mgr_)
{
TBSYS_LOG(ERROR, "client_mgr_=NULL");
ret = OB_ERROR;
}
else if (OB_SUCCESS != (ret = range.serialize(msgbuf.get_data(), msgbuf.get_capacity(), msgbuf.get_position())))
{
TBSYS_LOG(ERROR, "failed to serialize range, err=%d", ret);
}
else if (OB_SUCCESS != (ret = common::serialization::encode_vi64(msgbuf.get_data(), msgbuf.get_capacity(), msgbuf.get_position(), mem_version)))
{
TBSYS_LOG(ERROR, "failed to serialize key_src, err=%d", ret);
}
else if (OB_SUCCESS != (ret = client_mgr_->send_request(cs, OB_CS_CREATE_TABLE, DEFAULT_VERSION, timeout_us, msgbuf)))
{
TBSYS_LOG(WARN, "failed to send request, err=%d", ret);
}
else
{
ObResultCode result;
int64_t pos = 0;
static char range_buff[OB_MAX_ROW_KEY_LENGTH * 2];
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_)
{
range.to_string(range_buff, OB_MAX_ROW_KEY_LENGTH * 2);
TBSYS_LOG(WARN, "failed to create tablet, err=%d, cs=%s, range=%s", result.result_code_, cs.to_cstring(), range_buff);
ret = result.result_code_;
}
else
{
}
}
return ret;
}
示例6: get_rpc_buffer
int ObRpcStub::get_rpc_buffer(ObDataBuffer & data_buffer) const
{
int ret = OB_SUCCESS;
common::ThreadSpecificBuffer::Buffer* rpc_buffer = NULL;
if (!check_inner_stat())
{
TBSYS_LOG(WARN, "check inner stat failed");
ret = OB_INNER_STAT_ERROR;
}
else if (NULL == (rpc_buffer = rpc_buffer_->get_buffer()))
{
TBSYS_LOG(ERROR, "get thread rpc buff failed:buffer[%p].", rpc_buffer);
ret = OB_INNER_STAT_ERROR;
}
else
{
rpc_buffer->reset();
data_buffer.set_data(rpc_buffer->current(), rpc_buffer->remain());
}
return ret;
}