예제 #1
0
MojErr MojDbIndex::notifyWatches(const MojDbKey& key, MojDbStorageTxn* txn)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
	MojAssert(txn);

	// TODO: this will be much more efficient with an interval tree
	for (WatcherVec::ConstIterator i = m_watcherVec.begin(); i != m_watcherVec.end(); ++i) {
		const RangeVec& ranges = (*i)->ranges();
		for (RangeVec::ConstIterator j = ranges.begin(); j != ranges.end(); ++j) {
			if (j->contains(key)) {
				LOG_DEBUG("[db_mojodb] DbIndex_notifywatches adding to txn - kind: %s; index %s;\n",
					((m_kind) ? m_kind->id().data() :NULL), ((m_name) ? m_name.data() : NULL));
				MojErr err = txn->addWatcher(i->get(), key);
				MojErrCheck(err);
				break;
			}
		}
	}
	return MojErrNone;
}
예제 #2
0
파일: MojDbIndex.cpp 프로젝트: KyleMaas/db8
MojErr MojDbIndex::notifyWatches(const MojDbKey& key, MojDbStorageTxn* txn)
{
	MojAssert(txn);
	MojLogTrace(s_log);

	// TODO: this will be much more efficient with an interval tree
	for (WatcherVec::ConstIterator i = m_watcherVec.begin(); i != m_watcherVec.end(); ++i) {
		const RangeVec& ranges = (*i)->ranges();
		for (RangeVec::ConstIterator j = ranges.begin(); j != ranges.end(); ++j) {
			if (j->contains(key)) {
				MojLogInfo(s_log, _T("DbIndex_notifywatches adding to txn - kind: %s; index %s;\n"),
					((m_kind) ? m_kind->id().data() :NULL), ((m_name) ? m_name.data() : NULL));
				MojErr err = txn->addWatcher(i->get(), key);
				MojErrCheck(err);
				break;
			}
		}
	}
	return MojErrNone;
}