last bit needed have statistic functions

- getgrpstatistic and getservicestatistic should be working now


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7458 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2014-07-19 08:29:56 +00:00
parent da335802e2
commit 99519f14bd

View File

@ -724,7 +724,9 @@ void RsGxsDataAccess::processRequests()
MsgMetaReq* mmr; MsgMetaReq* mmr;
MsgDataReq* mdr; MsgDataReq* mdr;
MsgIdReq* mir; MsgIdReq* mir;
MsgRelatedInfoReq* mri; MsgRelatedInfoReq* mri;
GroupStatisticRequest* gsr;
ServiceStatisticRequest* ssr;
for(it = mRequests.begin(); it != mRequests.end(); it++) for(it = mRequests.begin(); it != mRequests.end(); it++)
{ {
@ -766,10 +768,18 @@ void RsGxsDataAccess::processRequests()
{ {
getMsgList(mir); getMsgList(mir);
} }
else if((mri = dynamic_cast<MsgRelatedInfoReq*>(req)) != NULL) else if((mri = dynamic_cast<MsgRelatedInfoReq*>(req)) != NULL)
{ {
getMsgRelatedInfo(mri); getMsgRelatedInfo(mri);
} }
else if((gsr = dynamic_cast<GroupStatisticRequest*>(req)) != NULL)
{
getGroupStatistic(gsr);
}
else if((ssr = dynamic_cast<ServiceStatisticRequest*>(req)) != NULL)
{
getServiceStatistic(ssr);
}
else else
{ {
std::cerr << "RsGxsDataAccess::processRequests() Failed to process request, token: " std::cerr << "RsGxsDataAccess::processRequests() Failed to process request, token: "
@ -1452,6 +1462,8 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req)
RsGxsMsgMetaData* m = msgMetaV[i]; RsGxsMsgMetaData* m = msgMetaV[i];
req->mGroupStatistic.mTotalSizeOfMsgs += m->mMsgSize + m->serial_size(); req->mGroupStatistic.mTotalSizeOfMsgs += m->mMsgSize + m->serial_size();
} }
cleanseMsgMetaMap(metaResult);
return true; return true;
} }
@ -1477,6 +1489,7 @@ bool RsGxsDataAccess::getServiceStatistic(ServiceStatisticRequest *req)
getGroupStatistic(&gr); getGroupStatistic(&gr);
req->mServiceStatistic.mNumMsgs += gr.mGroupStatistic.mNumMsgs; req->mServiceStatistic.mNumMsgs += gr.mGroupStatistic.mNumMsgs;
req->mServiceStatistic.mSizeOfMsgs += gr.mGroupStatistic.mTotalSizeOfMsgs; req->mServiceStatistic.mSizeOfMsgs += gr.mGroupStatistic.mTotalSizeOfMsgs;
delete m;
} }
req->mServiceStatistic.mSizeStore = req->mServiceStatistic.mSizeOfGrps + req->mServiceStatistic.mSizeOfMsgs; req->mServiceStatistic.mSizeStore = req->mServiceStatistic.mSizeOfGrps + req->mServiceStatistic.mSizeOfMsgs;