本文整理汇总了C++中common::Stream::get_free_length方法的典型用法代码示例。如果您正苦于以下问题:C++ Stream::get_free_length方法的具体用法?C++ Stream::get_free_length怎么用?C++ Stream::get_free_length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Stream
的用法示例。
在下文中一共展示了Stream::get_free_length方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
int WriteInfoBatchMessage::serialize(common::Stream& output) const
{
int64_t pos = 0;
int32_t have_block = (block_info_.block_id_ > 0) ? 1 : 0;
int32_t iret = write_data_info_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour(write_data_info_.length());
iret = output.set_int32(have_block);
}
if (common::TFS_SUCCESS == iret)
{
if (1 == have_block)
{
pos = 0;
iret = block_info_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour(block_info_.length());
}
}
}
if (common::TFS_SUCCESS == iret)
{
iret = output.set_int32(meta_list_.size());
}
if (common::TFS_SUCCESS == iret)
{
common::RawMetaVec::const_iterator iter = meta_list_.begin();
for (; iter != meta_list_.end(); ++iter)
{
pos = 0;
iret = const_cast<common::RawMeta*>((&(*iter)))->serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour((*iter).length());
}
else
{
break;
}
}
}
if (common::TFS_SUCCESS == iret)
{
iret = output.set_int32(cluster_);
}
if (common::TFS_SUCCESS == iret)
{
iret = output.set_int32(remove_flag_);
}
return iret;
}
示例2: serialize
int WriteDataMessage::serialize(common::Stream& output) const
{
if (has_lease())
{
ds_.push_back(ULONG_LONG_MAX);
ds_.push_back(static_cast<uint64_t>(version_));
ds_.push_back(static_cast<uint64_t>(lease_id_));
}
int64_t pos = 0;
int32_t iret = write_data_info_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour(write_data_info_.length());
iret = output.set_vint64(ds_);
}
if (common::TFS_SUCCESS == iret
&& write_data_info_.length_ > 0)
{
iret = output.set_bytes(data_, write_data_info_.length_);
}
// reparse, avoid push verion&lease again when clone twice;
if (common::TFS_SUCCESS == iret)
{
parse_special_ds(ds_, version_, lease_id_);
}
return iret;
}
示例3: serialize
int BlockFileInfoMessage::serialize(common::Stream& output) const
{
int32_t iret = output.set_int32(block_id_);
if (common::TFS_SUCCESS == iret)
{
iret = output.set_int32(fileinfo_list_.size());
}
if (common::TFS_SUCCESS == iret)
{
common::FILE_INFO_LIST::const_iterator iter = fileinfo_list_.begin();
for (; iter != fileinfo_list_.end(); ++iter)
{
int64_t pos = 0;
iret = (*iter).serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour((*iter).length());
}
else
{
break;
}
}
}
return iret;
}
示例4: serialize
int DsCommitCompactBlockCompleteToNsMessage::serialize(common::Stream& output) const
{
int32_t ret = output.set_int64(seqno_);
if (common::TFS_SUCCESS == ret)
{
int64_t pos = 0;
ret = block_info_.serialize(output.get_free(), output.get_free_length(), pos);
}
if (common::TFS_SUCCESS == ret)
{
output.pour(block_info_.length());
ret = output.set_int8(result_.size());
}
if (common::TFS_SUCCESS == ret)
{
std::vector<std::pair<uint64_t, int8_t> >::const_iterator iter = result_.begin();
for (; iter != result_.end() && common::TFS_SUCCESS == ret; ++iter)
{
ret = output.set_int64(iter->first);
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int8(iter->second);
}
}
}
return ret;
}
示例5: serialize
int ECMarshallingMessage::serialize(common::Stream& output) const
{
const int32_t MEMBER_NUM = GET_DATA_MEMBER_NUM(family_aid_info_) + GET_CHECK_MEMBER_NUM(family_aid_info_);
int32_t ret = output.set_int64(family_id_);
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int64(seqno_);
}
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int32(expire_time_);
}
if (common::TFS_SUCCESS == ret)
{
ret = (NULL != family_members_ && MEMBER_NUM > 0 && MEMBER_NUM <= MAX_MARSHALLING_NUM) ? common::TFS_SUCCESS : common::EXIT_PARAMETER_ERROR;
if (TFS_SUCCESS == ret)
{
ret = output.set_int32(family_aid_info_);
}
}
if (common::TFS_SUCCESS == ret)
{
for (int32_t index = 0; index < MEMBER_NUM && TFS_SUCCESS == ret; ++index)
{
int64_t pos = 0;
ret = family_members_[index].serialize(output.get_free(), output.get_free_length() , pos);
if (TFS_SUCCESS == ret)
output.pour(family_members_[index].length());
}
}
return ret;
}
示例6: serialize
int UnlinkFileMessage::serialize(common::Stream& output) const
{
if (has_lease())
{
dataservers_.push_back(ULONG_LONG_MAX);
dataservers_.push_back(static_cast<uint64_t> (version_));
dataservers_.push_back(static_cast<uint64_t> (lease_id_));
}
int64_t pos = 0;
int32_t ret = unlink_file_info_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == ret)
{
output.pour(unlink_file_info_.length());
}
if (common::TFS_SUCCESS == ret)
{
ret = output.set_vint64(dataservers_);
}
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int32(option_flag_);
}
if (common::TFS_SUCCESS == ret)
{
BasePacket::parse_special_ds(dataservers_, version_, lease_id_);
}
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int64(lease_id_ext_);
}
if (common::TFS_SUCCESS == ret)
{
if (common::INVALID_FAMILY_ID != family_info_.family_id_)
{
int64_t pos = 0;
ret = family_info_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == ret)
{
output.pour(family_info_.length());
}
}
}
return ret;
}
示例7: serialize
int MasterAndSlaveHeartMessage::serialize(common::Stream& output) const
{
int64_t pos = 0;
int32_t iret = ns_identity_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour(length());
}
return iret;
}
示例8: serialize
int ShowServerInformationMessage::serialize(common::Stream& output) const
{
int64_t pos = 0;
int32_t iret = param.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour(param.length());
}
return iret;
}
示例9: serialize
int ReportCheckBlockMessage::serialize(common::Stream& output) const
{
int64_t pos = 0;
int ret = param_.serialize(output.get_free(), output.get_free_length(), pos);
if (TFS_SUCCESS == ret)
{
output.pour(param_.length());
}
return ret;
}
示例10: serialize
int ClientCmdMessage::serialize(common::Stream& output) const
{
int64_t pos = 0;
int32_t iret = info_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
{
output.pour(info_.length());
}
return iret;
}
示例11: serialize
int MasterAndSlaveHeartMessage::serialize(common::Stream& output) const
{
int64_t pos = 0;
int32_t ret = ns_identity_.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == ret)
{
output.pour(ns_identity_.length());
}
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int64(lease_id_);
}
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int8(keepalive_type_);
}
return ret;
}
示例12: serialize
int ResolveBlockVersionConflictMessage::serialize(common::Stream& output) const
{
int32_t ret = output.set_int32(block_);
if (common::TFS_SUCCESS == ret)
{
ret = output.set_int32(members_.size());
}
if (common::TFS_SUCCESS == ret)
{
std::vector<std::pair<uint64_t, common::BlockInfo> >::const_iterator iter = members_.begin();
for (; iter != members_.end() && common::TFS_SUCCESS == ret; ++iter)
{
ret = output.set_int64(iter->first);
if (common::TFS_SUCCESS == ret)
{
int64_t pos = 0;
ret = iter->second.serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == ret)
output.pour(iter->second.length());
}
}
}
return ret;
}
示例13: set_counter_map
int AccessStatInfoMessage::set_counter_map(common::Stream& output, const COUNTER_TYPE & map, int32_t from_row,
int32_t return_row, int32_t size) const
{
int32_t iret = output.set_int32(size);
if (common::TFS_SUCCESS == iret)
{
if (size > 0)
{
int64_t pos = 0;
int32_t count = 0;
COUNTER_TYPE::const_iterator iter = map.begin();
for (; iter != map.end(); ++iter, ++count)
{
if (count <= from_row)
continue;
if (count > from_row + return_row)
break;
iret = output.set_int32(iter->first);
if (common::TFS_SUCCESS != iret)
break;
pos = 0;
iret = const_cast<common::Throughput*>(&iter->second)->serialize(output.get_free(), output.get_free_length(), pos);
if (common::TFS_SUCCESS == iret)
output.pour(iter->second.length());
else
break;
}
}
}
return iret;
}