예제 #1
0
	void AddRequest(const O2Key &key)
	{
		Lock();
		O2KeyListIt it = std::find(
			RequestQueue.begin(), RequestQueue.end(), key);
		if (it == RequestQueue.end())
			RequestQueue.push_back(key);
		Unlock();
	}
예제 #2
0
uint64
O2KeyDB::
GetKeyList(O2KeyList &ret, time_t date_le)
{
	Lock();
	{
		O2Keys::iterator it;
		for (it = Keys.begin(); it != Keys.end(); it++) {
			if (date_le == 0 || it->date < date_le)
				ret.push_back(*it);
		}
	}
	Unlock();

	return (ret.size());
}
예제 #3
0
uint64
O2KeyDB::
GetKeyList(const hashT &target, O2KeyList &ret)
{
	Lock();
	{
		O2Keys::nth_index<1>::type& keys = Keys.get<1>();
		O2Keys::nth_index_iterator<1>::type it1 = keys.lower_bound(target);
		O2Keys::nth_index_iterator<1>::type it2 = keys.upper_bound(target);
		O2Keys::nth_index_iterator<1>::type it;
		for (it = it1; it != it2; it++) {
			ret.push_back(*it);
		}
	}
	Unlock();

	return (ret.size());
}