Пример #1
0
 bool ServerCollect::get_range_blocks_(common::ArrayHelper<BlockCollect*>& blocks, const uint32_t begin, const int32_t count) const
 {
   blocks.clear();
   int32_t actual = 0;
   BlockCollect query(begin);
   BLOCKS_ITER iter = 0 == begin ? hold_->begin() : hold_->upper_bound(&query);
   while(iter != hold_->end() && actual < count)
   {
     blocks.push_back((*iter));
     actual++;
     iter++;
   }
   return actual < count;
 }
Пример #2
0
 int OpMeta::get_members(common::ArrayHelper< BlockReplicaInfo >& helper) const
 {
   tbutil::Mutex::Lock lock(mutex_);
   int ret = TFS_SUCCESS;
   if (helper.get_array_size() < server_size_)
   {
     ret = EXIT_PARAMETER_ERROR;
   }
   else
   {
     for (int index = 0; index < server_size_; index++)
     {
       helper.push_back(std::make_pair(members_[index].server_, members_[index].info_));
     }
   }
   return ret;
 }