Esempio n. 1
0
MyUtil::IntSeq AccountFilterI::GetIdBySHA256(const MyUtil::StrSeq &digests, const Ice::Current &current) {
  ostringstream oss;
  oss << "digest.size: " << digests.size();
  InvokeClient ic = InvokeClient::create(current, oss.str(), InvokeClient::INVOKE_LEVEL_DEBUG);
  MyUtil::IntSeq result;
  MyUtil::StrSeq::const_iterator it = digests.begin();
  for(; it != digests.end(); ++it) {
    if(it->size() != SHA256::HEX_SIZE || !MyUtil::StrUtil::isXDigit(*it)) {
      MCE_WARN("AccountFilterI::GetIdBySHA256 invalid digest: " << *it << " ,size: " << it->size());
      continue;
    }
    string digest_lower = MyUtil::StrUtil::toLower(*it);
    int bucket = bucket_manager_.GetBucket(digest_lower);
    DigestMap& digest_map = buckets_[bucket];
    boost::shared_lock<boost::shared_mutex> read_lock(mutex_[bucket]);
    DigestMap::iterator it_digest = digest_map.find(digest_lower);
    if(it_digest != digest_map.end()) {
      BOOST_FOREACH(int id, it_digest->second.ids) {
        result.push_back(id);
      }
    }
  }
Esempio n. 2
0
void PvLogHandler::PushBack(const MyUtil::StrSeq& logs) {
  IceUtil::Mutex::Lock lock(mutex_);
  for (MyUtil::StrSeq::const_iterator it = logs.begin(); it != logs.end(); ++it) {
    queue_.push(*it);
  }
}