Exemple #1
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;
 }
Exemple #2
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;
 }
Exemple #3
0
 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;
 }
Exemple #4
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;
}
Exemple #5
0
 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;
 }
Exemple #6
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;
 }
Exemple #7
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;
    }
Exemple #8
0
    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;
    }
Exemple #9
0
 int CheckBlockResponseMessage::deserialize(common::Stream& input)
 {
   return input.get_vint64(blocks_);
 }