コード例 #1
0
MojErr MojDbQuotaEngine::quotaUsage(const MojChar* owner, MojInt64& sizeOut, MojInt64& usageOut)
{
	sizeOut = 0;
	usageOut = 0;
	QuotaMap::ConstIterator iter = m_quotas.find(owner);
	if (iter == m_quotas.end()) {
		MojErrThrow(MojErrNotFound);
	}
	sizeOut = iter.value()->size();
	usageOut = iter.value()->usage();

	return MojErrNone;
}
コード例 #2
0
ファイル: MojDbQuotaEngine.cpp プロジェクト: ctbrowser/db8
MojErr MojDbQuotaEngine::quotaUsage(const MojChar* owner, MojInt64& sizeOut, MojInt64& usageOut)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);

	sizeOut = 0;
	usageOut = 0;
	QuotaMap::ConstIterator iter = m_quotas.find(owner);
	if (iter == m_quotas.end()) {
		MojErrThrow(MojErrNotFound);
	}
	sizeOut = iter.value()->size();
	usageOut = iter.value()->usage();

	return MojErrNone;
}
コード例 #3
0
MojErr MojDbQuotaEngine::stats(MojObject& objOut, MojDbReq& req)
{
	// check for admin permission
	if (!req.admin()) {
		MojErrThrow(MojErrDbPermissionDenied);
	}
	for (QuotaMap::ConstIterator i = m_quotas.begin(); i != m_quotas.end(); ++i) {
		MojObject quota;
		MojErr err = quota.put(MojDbServiceDefs::SizeKey, i.value()->size());
		MojErrCheck(err);
		err = quota.put(MojDbServiceDefs::UsedKey, i.value()->usage());
		MojErrCheck(err);
		err = objOut.put(i.key(), quota);
		MojErrCheck(err);
	}
	return MojErrNone;
}