示例#1
0
 int RespHeartMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(&status_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&heart_interval_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&max_mr_network_bandwith_mb_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&max_rw_network_bandwith_mb_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int8(&ns_role_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int8(&enable_old_interface_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int8(&enable_version_check_);
   }
   if (common::TFS_SUCCESS == ret && input.get_data_length() > 0)
   {
     ret = input.get_int32(&verify_index_reserved_space_ratio_);
   }
   return ret;
 }
示例#2
0
 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;
 }
示例#3
0
 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 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 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;
 }
示例#6
0
 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;
 }
示例#7
0
    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;
    }
示例#8
0
 int GetBlockInfoMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(&mode_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32( reinterpret_cast<int32_t*> (&block_id_));
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_vint64(fail_server_);
   }
   return ret;
 }
 int GetServerStatusMessage::deserialize(common::Stream& input)
 {
   int32_t iret = input.get_int32(&status_type_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_int32(&from_row_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_int32(&return_row_);
   }
   return iret;
 }
示例#10
0
    int NewReplicateBlockMessage::deserialize(common::Stream& input)
    {
      int32_t iret = input.get_int32(&command_);
      if (TFS_SUCCESS == iret)
      {
        iret = input.get_int32(&expire_);
      }

      if (TFS_SUCCESS == iret)
      {
        iret = repl_block_.deserialize(input);
      }
      return iret;
    }
示例#11
0
 int BatchGetBlockInfoMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(&mode_);
   if (common::TFS_SUCCESS == ret)
   {
     if (mode_ & common::T_READ)
     {
       ret = input.get_vint32(block_ids_);
     }
     else
     {
       ret = input.get_int32(&block_count_);
     }
   }
   return ret;
 }
示例#12
0
 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;
 }
示例#13
0
 int RespHeartMessage::deserialize(common::Stream& input)
 {
   int32_t iret = input.get_int32(&status_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_int32(&heart_interval_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_vint32(expire_blocks_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_vint32(new_blocks_);
   }
   return iret;
 }
示例#14
0
int NsRequestCompactBlockMessage::deserialize(common::Stream& input)
{
    int32_t ret = input.get_int32( reinterpret_cast<int32_t*> (&block_id_));
    if (common::TFS_SUCCESS == ret)
    {
        ret = input.get_vint64(servers_);
    }
    if (common::TFS_SUCCESS == ret)
    {
        ret = input.get_int64(&seqno_);
    }
    if (common::TFS_SUCCESS == ret)
    {
        ret = input.get_int32(&expire_time_);
    }
    return ret;
}
示例#15
0
 int GetFamilyInfoMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(&mode_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int64(&family_id_);
   }
   return ret;
 }
示例#16
0
 int RemoveBlockResponseMessage::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(&seqno_);
   }
   return ret;
 }
示例#17
0
 int AccessStatInfoMessage::deserialize(common::Stream& input)
 {
   int32_t iret = input.get_int32(&has_next_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = get_counter_map(input, stats_);
   }
   return iret;
 }
示例#18
0
 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;
 }
示例#19
0
    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;
    }
示例#20
0
 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;
 }
示例#21
0
 int RespListBitMapMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(reinterpret_cast<int32_t*> (&uuse_len_));
   if (common::TFS_SUCCESS == ret)
   {
     input.get_int32(reinterpret_cast<int32_t*> (&ubitmap_len_));
   }
   if (common::TFS_SUCCESS == ret
     && ubitmap_len_ > 0)
   {
     char* data = alloc_data(ubitmap_len_);
     ret = NULL != data ? common::TFS_SUCCESS : common::TFS_ERROR;
     if (common::TFS_SUCCESS == ret)
     {
       ret = input.get_bytes(data, ubitmap_len_);
     }
   }
   return ret;
 }
示例#22
0
 int RemoveBlockMessage::deserialize(common::Stream& input)
 {
   int32_t reserve = 0;
   int32_t ret = input.get_int32(&reserve);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(reinterpret_cast<int32_t*>(&id_));
   }
   if (common::TFS_SUCCESS == ret
      && input.get_data_length() > 0)
   {
     ret = input.get_int8(&response_flag_);
   }
   if (common::TFS_SUCCESS == ret
      && input.get_data_length() > 0)
   {
     ret = input.get_int64(&seqno_);
   }
   return ret;
 }
示例#23
0
 // count, blockid, server_count, server_id1, server_id2, ..., blockid, server_count, server_id1 ...
 int BatchSetBlockInfoMessage::deserialize(common::Stream& input)
 {
   int32_t count = 0;
   int32_t iret = input.get_int32(&count);
   if (common::TFS_SUCCESS == iret)
   {
     uint32_t block_id = 0;
     for (int32_t i = 0; i < count; ++i)
     {
       common::BlockInfoSeg block_info;
       iret = input.get_int32(reinterpret_cast<int32_t*>(&block_id));
       if (common::TFS_SUCCESS != iret)
           break;
       iret = input.get_vint64(block_info.ds_);
       if (common::TFS_SUCCESS != iret)
           break;
       common::BasePacket::parse_special_ds(block_info.ds_, block_info.version_, block_info.lease_id_);
       block_infos_[block_id] = block_info;
     }
   }
   return iret;
 }
示例#24
0
 //block_id, server_count, server_id1, server_id2, ..., filename_len, filename
 int SetBlockInfoMessage::deserialize(common::Stream& input)
 {
   int32_t iret = input.get_int32(reinterpret_cast<int32_t*> (&block_id_));
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_vint64(ds_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     common::BasePacket::parse_special_ds(ds_, version_, lease_id_);
   }
   return iret;
 }
示例#25
0
 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;
 }
示例#26
0
    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;
    }
示例#27
0
    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;
    }
示例#28
0
 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;
 }
示例#29
0
 int GetFamilyInfoResponseMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int64(&family_id_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&family_aid_info_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     int32_t index = 0;
     const int32_t MEMBER_NUM = GET_DATA_MEMBER_NUM(family_aid_info_) + GET_CHECK_MEMBER_NUM(family_aid_info_);
     for (index = 0; index < MEMBER_NUM && common::TFS_SUCCESS == ret; ++index)
     {
       std::pair<uint64_t, uint64_t>* item = &members_[index];
       ret = input.get_int64(reinterpret_cast<int64_t*>(&item->first));
       if (common::TFS_SUCCESS == ret)
         ret = input.get_int64(reinterpret_cast<int64_t*>(&item->second));
     }
     if (common::TFS_SUCCESS == ret)
       ret = index == MEMBER_NUM ? common::TFS_SUCCESS : common::EXIT_DESERIALIZE_ERROR;
   }
   return ret;
 }
示例#30
0
    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;
    }