int CarryBlockMessage::serialize(common::Stream& output) const { int32_t ret = output.set_vint32(expire_blocks_); if (common::TFS_SUCCESS == ret) { ret = output.set_vint32(remove_blocks_); } if (common::TFS_SUCCESS == ret) { ret = output.set_vint32(new_blocks_); } return ret; }
int RespHeartMessage::serialize(common::Stream& output) const { int32_t iret = output.set_int32(status_); if (common::TFS_SUCCESS == iret) { iret = output.set_int32(heart_interval_); } if (common::TFS_SUCCESS == iret) { iret = output.set_vint32(expire_blocks_); } if (common::TFS_SUCCESS == iret) { iret = output.set_vint32(new_blocks_); } return iret; }
int RespListBlockMessage::serialize(common::Stream& output) const { int32_t ret = output.set_int32(status_type_); if (common::TFS_SUCCESS == ret) { if (status_type_ & common::LB_BLOCK) { ret = output.set_vint64(blocks_); } if (common::TFS_SUCCESS == ret && status_type_ & common::LB_PAIRS) { ret = output.set_int32(block_pairs_.size()); if (common::TFS_SUCCESS == ret) { std::map<uint64_t, std::vector<int32_t> >:: const_iterator iter = block_pairs_.begin(); for (; iter != block_pairs_.end(); ++iter) { ret = output.set_int64(iter->first); if (common::TFS_SUCCESS != ret) break; ret = output.set_vint32(iter->second); if (common::TFS_SUCCESS != ret) break; } } } if (common::TFS_SUCCESS == ret && status_type_ & common::LB_INFOS) { ret = output.set_int32(block_infos_.size()); if (common::TFS_SUCCESS == ret) { std::vector<common::BlockInfoV2>::const_iterator iter = block_infos_.begin(); for (; iter != block_infos_.end(); ++iter) { int64_t pos = 0; ret = iter->serialize(output.get_free(), output.get_free_length(), pos); if (common::TFS_SUCCESS == ret) output.pour(iter->length()); else break; } } } } return ret; }
int BatchGetBlockInfoMessage::serialize(common::Stream& output) const { int32_t ret = output.set_int32(mode_); if (common::TFS_SUCCESS == ret) { if (mode_ & common::T_READ) { ret = output.set_vint32(block_ids_); } else { ret = output.set_int32(block_count_); } } return ret; }
int NewBlockMessage::serialize(common::Stream& output) const { return output.set_vint32(new_blocks_); }