예제 #1
0
MojErr MojDbQuotaEngine::applyUsage(MojDbStorageTxn* txn)
{
	MojLogTrace(s_log);

	for (OffsetMap::ConstIterator i = txn->m_offsetMap.begin();
		 i != txn->m_offsetMap.end(); ++i) {
		MojErr err = applyOffset(i.key(), i.value()->offset(), txn);
		MojErrCheck(err);
	}
	return MojErrNone;
}
예제 #2
0
MojErr MojDbQuotaEngine::applyQuota(MojDbStorageTxn* txn)
{
	MojLogTrace(s_log);

	for (OffsetMap::ConstIterator i = txn->m_offsetMap.begin();
		 i != txn->m_offsetMap.end(); ++i) {
		if (i.value()->m_quota.get()) {
			i.value()->m_quota->offset(i.value()->offset());
		}
	}
	return MojErrNone;
}
예제 #3
0
MojErr MojDbQuotaEngine::applyQuota(MojDbStorageTxn* txn)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);

	for (OffsetMap::ConstIterator i = txn->m_offsetMap.begin();
		 i != txn->m_offsetMap.end(); ++i) {
		if (i.value()->m_quota.get()) {
			i.value()->m_quota->offset(i.value()->offset());
		}
	}
	return MojErrNone;
}
예제 #4
0
MojErr MojDbQuotaEngine::applyUsage(MojDbStorageTxn* txn)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);

	for (OffsetMap::ConstIterator i = txn->m_offsetMap.begin();
		 i != txn->m_offsetMap.end(); ++i) {
		MojErr err = applyOffset(i.key(), i.value()->offset(), txn);
		MojErrCheck(err);

		if(!m_db->getQuotaAlert().isEmpty()) //optimization for empty list
		{
			err = informQuotaSubscribers(i.key());
			MojErrCheck(err);
		}
	}
	return MojErrNone;
}
예제 #5
0
MojErr MojDbQuotaEngine::curKind(const MojDbKind* kind, MojDbStorageTxn* txn)
{
	MojLogTrace(s_log);
	MojAssert(kind && txn);

	txn->m_quotaEngine = this;
	const MojString& id = kind->id();
	// set the current offset
	OffsetMap::ConstIterator i = txn->m_offsetMap.find(id);
	if (i == txn->m_offsetMap.end()) {
		txn->m_curQuotaOffset.reset(new MojDbQuotaEngine::Offset(id));
		MojAllocCheck(txn->m_curQuotaOffset.get());
		MojErr err = txn->m_offsetMap.put(id, txn->m_curQuotaOffset);
		MojErrCheck(err);
	} else {
		txn->m_curQuotaOffset = i.value();
	}
	// find the quota for this kind
	MojErr err = quotaForKind(kind, txn->m_curQuotaOffset->m_quota);
	MojErrCheck(err);

	return MojErrNone;
}