示例#1
0
 int WriteDataMessage::serialize(common::Stream& output) const
 {
   if (has_lease())
   {
     ds_.push_back(ULONG_LONG_MAX);
     ds_.push_back(static_cast<uint64_t>(version_));
     ds_.push_back(static_cast<uint64_t>(lease_id_));
   }
   int64_t pos = 0;
   int32_t iret = write_data_info_.serialize(output.get_free(), output.get_free_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     output.pour(write_data_info_.length());
     iret = output.set_vint64(ds_);
   }
   if (common::TFS_SUCCESS == iret
       && write_data_info_.length_ > 0)
   {
     iret = output.set_bytes(data_, write_data_info_.length_);
   }
   // reparse, avoid push verion&lease again when clone twice;
   if (common::TFS_SUCCESS == iret)
   {
     parse_special_ds(ds_, version_, lease_id_);
   }
   return iret;
 }
示例#2
0
 int DumpPlanResponseMessage::serialize(common::Stream& output) const
 {
   int32_t iret = common::TFS_SUCCESS;
   if (data_.getDataLen() > 0)
   {
     iret = output.set_bytes(data_.getData(), data_.getDataLen());
   }
   return iret;
 }
 int GetTableFromRtsResponseMessage::serialize(common::Stream& output) const 
 {
   int32_t iret = output.set_int64(version_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = output.set_int64(length_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     iret = output.set_bytes(tables_, length_);
   }
   return iret;
 }
示例#4
0
    int ReadRawdataRespMessageV2::serialize(common::Stream& output) const
    {
      int ret = output.set_int32(length_);
      if (TFS_SUCCESS == ret)
      {
        if ((length_ > 0) && (NULL != data_))
        {
          ret = output.set_bytes(data_, length_);
        }
      }

      return ret;
    }
示例#5
0
 int RespListBitMapMessage::serialize(common::Stream& output)  const
 {
   int32_t ret = output.set_int32(uuse_len_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = output.set_int32(ubitmap_len_);
   }
   if (common::TFS_SUCCESS == ret
       && ubitmap_len_ > 0)
   {
     ret = output.set_bytes(data_, ubitmap_len_);
   }
   return ret;
 }
示例#6
0
    int WriteRawDataMessage::serialize(common::Stream& output) const
    {
      int64_t pos = 0;
      int32_t iret = write_data_info_.serialize(output.get_free(), output.get_free_length(), pos);
      if (common::TFS_SUCCESS == iret)
      {
        output.pour(write_data_info_.length());
        if (write_data_info_.length_ > 0)
        {
          iret = output.set_bytes(data_, write_data_info_.length_);
        }
      }

      if (common::TFS_SUCCESS == iret)
      {
        iret = output.set_int32(flag_);
      }
      return iret;
    }
示例#7
0
    int WriteRawIndexMessage::serialize(common::Stream& output) const
    {
      int32_t iret = output.set_int32(block_id_);

      if (common::TFS_SUCCESS == iret)
      {
        iret = output.set_int64(family_id_);
      }

      if (common::TFS_SUCCESS == iret)
      {
        iret = output.set_int32(index_op_);
      }

      if (common::TFS_SUCCESS == iret)
      {
        iret = output.set_int32(index_vec_.size());
      }

      for (uint32_t i = 0; i < index_vec_.size() && common::TFS_SUCCESS == iret; i++)
      {
        if (common::TFS_SUCCESS == iret)
        {
          iret = output.set_int32(index_vec_[i].block_id_);
        }

        if (common::TFS_SUCCESS == iret)
        {
          iret = output.set_int32(index_vec_[i].size_);
        }

        if (common::TFS_SUCCESS == iret && index_vec_[i].size_ > 0)
        {
          iret = output.set_bytes(index_vec_[i].data_, index_vec_[i].size_);
        }
      }

      return iret;
    }