Пример #1
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;
 }
Пример #2
0
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;
}
Пример #3
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;
 }
Пример #4
0
 int GetTableFromRtsResponseMessage::deserialize(common::Stream& input)
 {
   int32_t iret = input.get_int64(&version_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_int64(&length_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_bytes(tables_, length_);
   }
   return iret;
 }
 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;
 }
Пример #6
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;
 }
Пример #7
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;
 }
Пример #8
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;
 }
Пример #9
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;
 }
Пример #10
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;
 }
Пример #11
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;
}
Пример #12
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;
    }
Пример #13
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;
 }
Пример #14
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;
 }
Пример #15
0
 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;
 }
Пример #16
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;
 }
Пример #17
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;
    }
Пример #18
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;
    }