Ejemplo n.º 1
0
void
MyUtil::__readInt2IntSeqMap(::IceInternal::BasicStream* __is, ::MyUtil::Int2IntSeqMap& v)
{
    ::Ice::Int sz;
    __is->readSize(sz);
    while(sz--)
    {
        ::std::pair<const  ::Ice::Int, ::MyUtil::IntSeq> pair;
        __is->read(const_cast< ::Ice::Int&>(pair.first));
        ::MyUtil::Int2IntSeqMap::iterator __i = v.insert(v.end(), pair);
        __is->read(__i->second);
    }
}
Ejemplo n.º 2
0
void UserLoginData::AppendSingleRelationFriend(int userId, MyUtil::Int2IntSeqMap& result) {
	HotFeedSeq singleFeedList = HotFeedRecommendCacheAdapter::instance().Get(userId, -1);

	ostringstream singleFeedListStream;
	for (HotFeedSeq::iterator iter = singleFeedList.begin();
			iter != singleFeedList.end(); ++iter) {
		if (result.find(iter->userId) == result.end()) {
			result.insert(make_pair<int, IntSeq>(iter->userId, IntSeq()));
			singleFeedListStream << iter->userId << ", ";
		}
	}
	singleFeedListStream << singleFeedList.size();
	MCE_INFO("[UserLoginData] AppendSingleRelationFriend userId(" << userId << ") detail " << singleFeedListStream.str());
}
Ejemplo n.º 3
0
MyUtil::Int2IntSeqMap BuddyByAddTimeCacheAdapter::getFriendLists(const MyUtil::IntSeq& ids){
	if (ids.empty()){
		return MyUtil::Int2IntSeqMap();
	}
	size_t numCluster_sizeT = getCluster();
	int numCluster = (int)numCluster_sizeT;
	if (numCluster < 0) {
		MCE_WARN("[BuddyByAddTimeCacheAdapter::getFriendLists] this should not be seen! Why cluster=" << numCluster_sizeT << " ???" );
		return MyUtil::Int2IntSeqMap();
	}
	if (numCluster == 0 || numCluster == 1) {
		try {
			return getProxy(ids.at(0))->getFriendLists(ids);
		} catch (...) {
			return MyUtil::Int2IntSeqMap();
		}
	} else {
                vector< vector<int> > seperatedIds;
                seperatedIds.resize( numCluster );
                for( MyUtil::IntSeq::const_iterator it = ids.begin(); it
                                != ids.end(); ++it ){
                        seperatedIds.at( *it % numCluster ).push_back( *it );
                }
                MyUtil::Int2IntSeqMap result;
                for (int posCluster = 0; posCluster < numCluster; ++posCluster) {
                        MyUtil::Int2IntSeqMap someResult;
                        if( seperatedIds.at(posCluster).size() > 0 ){
                                try {
                                        someResult = getProxy(posCluster)->getFriendLists(seperatedIds.at(posCluster));
                                } catch (...) {
                                        MCE_WARN( "BuddyByAddTimeCacheAdapter::getFriendLists from Proxy(" << posCluster << ") handle unknown exception." );
                                }
                                result.insert( someResult.begin(), someResult.end() );
                        }
                }
                return result;
	}
}
Ejemplo n.º 4
0
void SetDataHelper::SetDataThread::run() {
  while (true){
    std::vector< pair<long,Ice::ObjectPtr> > to_be_set_;
    helper_.swap( to_be_set_ );
    if( to_be_set_.empty() ){
      MCE_INFO("[SetDataHelper::SetDataThread::run] setData: 0 objs." );
      continue;
    }
    ostringstream idstr;
    MyUtil::ObjectResultPtr objs = new MyUtil::ObjectResult();
    MyUtil::Int2IntSeqMap lists;
    MyUtil::Int2IntMap counts;
    for ( std::vector< pair<long, Ice::ObjectPtr> >::iterator it = to_be_set_.begin();
        it != to_be_set_.end(); ++it ){
      objs->data.insert(*it);
      MyUtil::IntSeq& list = BuddyFriendsDataPtr::dynamicCast( it->second )->friends;
      lists.insert( make_pair<Ice::Int,MyUtil::IntSeq>(it->first,list) );
      counts.insert( make_pair<Ice::Int,Ice::Int>(it->first,list.size()) );
      idstr << " " << it->first << "(" << list.size() << ")";
    }
    MCE_INFO("[SetDataHelper::SetDataThread::run] setData:" << idstr.str() );
    BuddyFriendsCacheAdapter::instance().setData(objs);
  }
}