int WriteInfoBatchMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = write_data_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(write_data_info_.length()); } int32_t have_block = 0; if (common::TFS_SUCCESS == iret) { iret = input.get_int32(&have_block); } if (common::TFS_SUCCESS == iret) { if (1 == have_block) { pos = 0; iret = block_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(block_info_.length()); } } } int32_t size = 0; if (common::TFS_SUCCESS == iret) { iret = input.get_int32(&size); } if (common::TFS_SUCCESS == iret) { for (int32_t i = 0; i < size; ++i) { pos = 0; common::RawMeta raw_meta; iret = raw_meta.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { meta_list_.push_back(raw_meta); input.drain(raw_meta.length()); } else { break; } } } if (common::TFS_SUCCESS == iret) { iret = input.get_int32(&cluster_); } return iret; }
int ECMarshallingMessage::deserialize(common::Stream& input) { int32_t ret = input.get_int64(&family_id_); if (common::TFS_SUCCESS == ret) { ret = input.get_int64(&seqno_); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&expire_time_); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&family_aid_info_); } if (common::TFS_SUCCESS == ret) { const int32_t MEMBER_NUM = GET_DATA_MEMBER_NUM(family_aid_info_) + GET_CHECK_MEMBER_NUM(family_aid_info_); ret = (MEMBER_NUM > 0 && MEMBER_NUM <= MAX_MARSHALLING_NUM) ? common::TFS_SUCCESS : common::EXIT_PARAMETER_ERROR; if (TFS_SUCCESS == ret) { family_members_ = new (std::nothrow)FamilyMemberInfo[MEMBER_NUM]; assert(family_members_); for (int32_t index = 0; index < MEMBER_NUM && TFS_SUCCESS == ret; ++index) { int64_t pos = 0; ret = family_members_[index].deserialize(input.get_data(), input.get_data_length() , pos); if (TFS_SUCCESS == ret) input.drain(family_members_[index].length()); } } } return ret; }
int ResolveBlockVersionConflictMessage::deserialize(common::Stream& input) { int32_t size = 0; int32_t ret = input.get_int32(reinterpret_cast<int32_t*>(&block_)); if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&size); } if (common::TFS_SUCCESS == ret) { std::pair<uint64_t, common::BlockInfo> item; for (int32_t index = 0; index < size && common::TFS_SUCCESS == ret; ++index) { ret = input.get_int64(reinterpret_cast<int64_t*>(&item.first)); if (common::TFS_SUCCESS == ret) { int64_t pos = 0; ret = item.second.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) input.drain(item.second.length()); } if (common::TFS_SUCCESS == ret) { members_.push_back(item); } } } return ret; }
int BlockFileInfoMessage::deserialize(common::Stream& input) { int32_t size = 0; int32_t iret = input.get_int32(reinterpret_cast<int32_t*> (&block_id_)); if (common::TFS_SUCCESS == iret) { iret = input.get_int32(&size); } if (common::TFS_SUCCESS == iret) { common::FileInfo info; for (int32_t i = 0; i < size; ++i) { int64_t pos = 0; iret = info.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(info.length()); fileinfo_list_.push_back(info); } else { break; } } } return iret; }
int DsCommitCompactBlockCompleteToNsMessage::deserialize(common::Stream& input) { int32_t ret = input.get_int64(&seqno_); if (common::TFS_SUCCESS == ret) { int64_t pos = 0; ret = block_info_.deserialize(input.get_data(), input.get_data_length(), pos); } int8_t size = 0; if (common::TFS_SUCCESS == ret) { input.drain(block_info_.length()); ret = input.get_int8(&size); } if (common::TFS_SUCCESS == ret) { for (int8_t index = 0; index < size && common::TFS_SUCCESS == ret; ++index) { std::pair<uint64_t, int8_t> item; ret = input.get_int64(reinterpret_cast<int64_t*>(&item.first)); if (common::TFS_SUCCESS == ret) { ret = input.get_int8(&item.second); } if (common::TFS_SUCCESS == ret) { result_.push_back(item); } } } return ret; }
int AccessStatInfoMessage::get_counter_map(common::Stream& input, COUNTER_TYPE & map) { int32_t size = 0; int32_t iret = input.get_int32(&size); if (common::TFS_SUCCESS == iret) { common::Throughput t; int64_t pos = 0; int32_t id = 0; for (int32_t i = 0; i < size; ++i) { iret = input.get_int32(&id); if (common::TFS_SUCCESS != iret) break; pos = 0; iret = t.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS != iret) break; else { input.drain(t.length()); map.insert(COUNTER_TYPE::value_type(id, t)); } } } return iret; }
int ReportCheckBlockResponseMessage::deserialize(common::Stream& input) { int ret = input.get_int64(reinterpret_cast<int64_t*>(&server_id_)); if (TFS_SUCCESS == ret) { ret = input.get_int64(&seqno_); } int32_t size = 0; if (TFS_SUCCESS == ret) { ret = input.get_int32(&size); } for (int32_t index = 0; index < size && TFS_SUCCESS == ret; index++) { CheckResult item; int64_t pos = 0; ret = item.deserialize(input.get_data(), input.get_data_length(), pos); if (TFS_SUCCESS == ret) { input.drain(result_[index].length()); result_.push_back(item); } } return ret; }
int BlockWriteCompleteMessage::deserialize(common::Stream& input) { int32_t ret = input.get_int64( reinterpret_cast<int64_t*> (&server_id_)); if (common::TFS_SUCCESS == ret) { int64_t pos = 0; ret = block_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(block_info_.length()); } } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(reinterpret_cast<int32_t*> (&lease_id_)); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(reinterpret_cast<int32_t*> (&write_complete_status_)); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(reinterpret_cast<int32_t*> (&unlink_flag_)); } return ret; }
int MasterAndSlaveHeartMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = ns_identity_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(ns_identity_.length()); } return iret; }
int UpdateBlockInfoMessage::deserialize(common::Stream& input) { int32_t ret = input.get_int32(reinterpret_cast<int32_t*> (&block_id_)); if (common::TFS_SUCCESS == ret) { ret = input.get_int64(reinterpret_cast<int64_t*> (&server_id_)); } int32_t have_block = 0; if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&have_block); } if (common::TFS_SUCCESS == ret && have_block) { int64_t pos = 0; ret = block_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(block_info_.length()); } } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&repair_); } int32_t have_sdbm = 0; if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&have_sdbm); } if (common::TFS_SUCCESS == ret && have_sdbm > 0) { int64_t pos = 0; ret = db_stat_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(db_stat_.length()); } } return ret; }
int ShowServerInformationMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = param.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(pos); } return iret; }
int ReportCheckBlockMessage::deserialize(common::Stream& input) { int64_t pos = 0; int ret = param_.deserialize(input.get_data(), input.get_data_length(), pos); if (TFS_SUCCESS == ret) { input.drain(param_.length()); } return ret; }
int ClientCmdMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(info_.length()); } return iret; }
int WriteRawDataMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = write_data_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(write_data_info_.length()); if (write_data_info_.length_ > 0) { data_ = input.get_data(); input.drain( write_data_info_.length_); } } if (common::TFS_SUCCESS == iret) { iret = input.get_int32(&flag_); } return iret; }
int WriteDataMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = write_data_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain( write_data_info_.length()); iret = input.get_vint64(ds_); } if (common::TFS_SUCCESS == iret && write_data_info_.length_ > 0) { data_ = input.get_data(); input.drain(write_data_info_.length_); } if (common::TFS_SUCCESS == iret) { parse_special_ds(ds_, version_, lease_id_); } return iret; }
int MasterAndSlaveHeartResponseMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t iret = ns_identity_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == iret) { input.drain(ns_identity_.length()); if (ns_identity_.flags_ == HEART_GET_DATASERVER_LIST_FLAGS_YES) { iret = input.get_vint64(ds_list_); } } return iret; }
int ReadRawdataRespMessageV2::deserialize(common::Stream& input) { int ret = input.get_int32(&length_); if (TFS_SUCCESS == ret) { if (length_ > 0) { data_ = input.get_data(); input.drain(length_); } } return ret; }
int UnlinkFileMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t ret = unlink_file_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(unlink_file_info_.length()); } if (common::TFS_SUCCESS == ret) { ret = input.get_vint64(dataservers_); } if (common::TFS_SUCCESS == ret) { input.get_int32(&option_flag_); } if (common::TFS_SUCCESS == ret) { BasePacket::parse_special_ds(dataservers_, version_, lease_id_); } if ((common::TFS_SUCCESS == ret) && input.get_data_length() > 0) { ret = input.get_int64(reinterpret_cast<int64_t*>(&lease_id_ext_)); } if (common::TFS_SUCCESS == ret && input.get_data_length() > 0) { int64_t pos = 0; ret = family_info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(family_info_.length()); } } return ret; }
int CheckBlockRequestMessage::deserialize(common::Stream& input) { int64_t pos = 0; int ret = range_.deserialize(input.get_data(), input.get_data_length(), pos); if (TFS_SUCCESS == ret) { input.drain(range_.length()); } if (TFS_SUCCESS == ret) { ret = input.get_int32(&group_count_); } if (TFS_SUCCESS == ret) { ret = input.get_int32(&group_seq_); } return ret; }
int WriteRawIndexMessage::deserialize(common::Stream& input) { uint32_t index_count = 0; int32_t iret = input.get_int32((int32_t*)&block_id_); if (common::TFS_SUCCESS == iret) { iret = input.get_int64(&family_id_); } if (common::TFS_SUCCESS == iret) { iret = input.get_int32(reinterpret_cast<int32_t*>(&index_op_)); } if (common::TFS_SUCCESS == iret) { iret = input.get_int32((int32_t*)&index_count); } index_vec_.clear(); for (uint32_t i = 0; i < index_count && common::TFS_SUCCESS == iret; i++) { common::RawIndex index; if (common::TFS_SUCCESS == iret) { iret = input.get_int32((int32_t*)&index.block_id_); } if (common::TFS_SUCCESS == iret) { iret = input.get_int32((int32_t*)&index.size_); } if (index.size_ > 0) { index.data_ = input.get_data(); input.drain(index.size_); } index_vec_.push_back(index); } return iret; }
int WriteDataResponseMessage::deserialize(common::Stream& input) { int32_t ret = input.get_int64(reinterpret_cast<int64_t*>(&server_)); if (common::TFS_SUCCESS == ret) { ret = input.get_int64(&offset_); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&status_); } if (common::TFS_SUCCESS == ret) { int64_t pos = 0; ret = info_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) input.drain(info_.length()); } return ret; }
int MasterAndSlaveHeartMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t ret = ns_identity_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(ns_identity_.length()); } if (common::TFS_SUCCESS == ret) { if (input.get_data_length() > 0) ret = input.get_int64(&lease_id_); } if (common::TFS_SUCCESS == ret) { if (input.get_data_length() > 0) ret = input.get_int8(&keepalive_type_); } return ret; }
int MasterAndSlaveHeartResponseMessage::deserialize(common::Stream& input) { int64_t pos = 0; int32_t ret = ns_identity_.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(ns_identity_.length()); } if (common::TFS_SUCCESS == ret) { ret = input.get_int64(&lease_id_); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&lease_expired_time_); } if (common::TFS_SUCCESS == ret) { ret = input.get_int32(&renew_lease_interval_time_); } return ret; }
int RespListBlockMessage::deserialize(common::Stream& input) { int32_t ret = input.get_int32(&status_type_); if (common::TFS_SUCCESS == ret) { need_free_ = 1; if (status_type_ & common::LB_BLOCK)//blocks { ret = input.get_vint64(blocks_); } if (common::TFS_SUCCESS == ret && status_type_ & common::LB_PAIRS)//pairs { int32_t size = 0; ret = input.get_int32(&size); if (common::TFS_SUCCESS == ret) { std::vector<int32_t> tmp; uint64_t block_id = 0; for (int32_t i = 0; i < size; ++i) { ret = input.get_int64(reinterpret_cast<int64_t*> (&block_id)); if (common::TFS_SUCCESS == ret) { tmp.clear(); ret = input.get_vint32(tmp); if (common::TFS_SUCCESS == ret) { block_pairs_.insert(std::map<uint64_t, std::vector<int32_t> >::value_type(block_id, tmp)); } else { break; } } else { break; } } } } if (common::TFS_SUCCESS == ret && status_type_ & common::LB_INFOS) { int32_t size = 0; ret = input.get_int32(&size); if (common::TFS_SUCCESS == ret) { int64_t pos = 0; common::BlockInfoV2 info; for (int32_t i = 0; i < size; ++i) { pos = 0; ret = info.deserialize(input.get_data(), input.get_data_length(), pos); if (common::TFS_SUCCESS == ret) { input.drain(info.length()); block_infos_.push_back(info); } else { break; } } } } } return ret; }