mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 00:15:51 -04:00
removed TokenQueue from GxsTransportStatistics
This commit is contained in:
parent
72a22bcc88
commit
4653f18dd1
6 changed files with 171 additions and 166 deletions
|
@ -43,7 +43,7 @@ p3GxsTrans::~p3GxsTrans()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3GxsTrans::getStatistics(GxsTransStatistics& stats)
|
bool p3GxsTrans::getDataStatistics(GxsTransStatistics& stats)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mDataMutex);
|
RS_STACK_MUTEX(mDataMutex);
|
||||||
|
@ -1335,4 +1335,53 @@ bool p3GxsTrans::acceptNewMessage(const RsGxsMsgMetaData *msgMeta,uint32_t msg_s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool p3GxsTrans::getGroupStatistics(std::map<RsGxsGroupId,RsGxsTransGroupStatistics>& stats)
|
||||||
|
{
|
||||||
|
uint32_t token1;
|
||||||
|
|
||||||
|
RsTokReqOptions opts1;
|
||||||
|
opts1.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||||
|
if( !requestGroupInfo(token1, opts1) || waitToken(token1) != RsTokenService::COMPLETE )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::list<RsGroupMetaData> group_metas;
|
||||||
|
getGroupSummary(token1,group_metas);
|
||||||
|
|
||||||
|
for(auto& group_meta:group_metas)
|
||||||
|
{
|
||||||
|
RsGxsTransGroupStatistics& stat(stats[group_meta.mGroupId]);
|
||||||
|
|
||||||
|
uint32_t token2;
|
||||||
|
if(!RsGxsIfaceHelper::requestGroupStatistic(token2,group_meta.mGroupId) || waitToken(token2) != RsTokenService::COMPLETE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RsGenExchange::getGroupStatistic(token2,stat);
|
||||||
|
|
||||||
|
stat.popularity = group_meta.mPop ;
|
||||||
|
stat.subscribed = IS_GROUP_SUBSCRIBED(group_meta.mSubscribeFlags) ;
|
||||||
|
stat.mGrpId = group_meta.mGroupId ;
|
||||||
|
|
||||||
|
std::vector<RsMsgMetaData> metas;
|
||||||
|
|
||||||
|
uint32_t token3;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
||||||
|
|
||||||
|
std::list<RsGxsGroupId> groupIds;
|
||||||
|
groupIds.push_back(group_meta.mGroupId);
|
||||||
|
|
||||||
|
if( !requestMsgInfo(token3, opts, groupIds) || waitToken(token3, std::chrono::seconds(5)) != RsTokenService::COMPLETE )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
GxsMsgMetaMap metaMap;
|
||||||
|
if(!RsGenExchange::getMsgMeta(token3, metaMap) || metaMap.size() != 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for(auto& meta: metaMap.begin()->second)
|
||||||
|
stat.addMessageMeta(group_meta.mGroupId,meta) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,13 +113,21 @@ public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief getStatistics
|
* \brief getStatistics
|
||||||
* Gathers all sorts of statistics about the internals of p3GxsTrans, in order to display info about the running status,
|
* Gathers all sorts of statistics about the data transported by p3GxsTrans, in order to display info about the running status,
|
||||||
* message transport, etc.
|
* message transport, etc. This is a blocking call. Use it in a thread.
|
||||||
* \param stats This structure contains all statistics information.
|
* \param stats This structure contains all statistics information.
|
||||||
* \return true is the call succeeds.
|
* \return true is the call succeeds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual bool getStatistics(GxsTransStatistics& stats);
|
virtual bool getDataStatistics(GxsTransStatistics& stats) override;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief getGroupStatistics
|
||||||
|
* Gathers statistics about GXS groups and messages used by GxsTrans to transport data. This is a blocking call. Use it in a thread.
|
||||||
|
* \param stats
|
||||||
|
* \return true if the data collection succeeds.
|
||||||
|
*/
|
||||||
|
virtual bool getGroupStatistics(std::map<RsGxsGroupId,RsGxsTransGroupStatistics>& stats) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an email to recipient, in the process author of the email is
|
* Send an email to recipient, in the process author of the email is
|
||||||
|
|
|
@ -85,8 +85,7 @@ public:
|
||||||
* @param groupIds the ids return for given request token
|
* @param groupIds the ids return for given request token
|
||||||
* @return false if request token is invalid, check token status for error report
|
* @return false if request token is invalid, check token status for error report
|
||||||
*/
|
*/
|
||||||
bool getGroupList(const uint32_t &token,
|
bool getGroupList(const uint32_t &token, std::list<RsGxsGroupId> &groupIds)
|
||||||
std::list<RsGxsGroupId> &groupIds)
|
|
||||||
{
|
{
|
||||||
return mGxs.getGroupList(token, groupIds);
|
return mGxs.getGroupList(token, groupIds);
|
||||||
}
|
}
|
||||||
|
@ -119,8 +118,7 @@ public:
|
||||||
* @param groupInfo the ids returned for given request token
|
* @param groupInfo the ids returned for given request token
|
||||||
* @return false if request token is invalid, check token status for error report
|
* @return false if request token is invalid, check token status for error report
|
||||||
*/
|
*/
|
||||||
bool getGroupSummary(const uint32_t &token,
|
bool getGroupSummary(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo)
|
||||||
std::list<RsGroupMetaData> &groupInfo)
|
|
||||||
{
|
{
|
||||||
return mGxs.getGroupMeta(token, groupInfo);
|
return mGxs.getGroupMeta(token, groupInfo);
|
||||||
}
|
}
|
||||||
|
@ -130,8 +128,7 @@ public:
|
||||||
* @param msgInfo the message metadata returned for given request token
|
* @param msgInfo the message metadata returned for given request token
|
||||||
* @return false if request token is invalid, check token status for error report
|
* @return false if request token is invalid, check token status for error report
|
||||||
*/
|
*/
|
||||||
bool getMsgSummary(const uint32_t &token,
|
bool getMsgSummary(const uint32_t &token, GxsMsgMetaMap &msgInfo)
|
||||||
GxsMsgMetaMap &msgInfo)
|
|
||||||
{
|
{
|
||||||
return mGxs.getMsgMeta(token, msgInfo);
|
return mGxs.getMsgMeta(token, msgInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,8 @@ enum class GxsTransSendStatus : uint8_t
|
||||||
|
|
||||||
typedef uint64_t RsGxsTransId;
|
typedef uint64_t RsGxsTransId;
|
||||||
|
|
||||||
class RsGxsTransGroup
|
class RsGxsTransGroup: public RsGxsGenericGroupData
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
RsGroupMetaData mMeta;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsGxsTransMsg
|
class RsGxsTransMsg
|
||||||
|
@ -103,7 +101,34 @@ struct RsGxsTransOutgoingRecord
|
||||||
RsGxsGroupId group_id ;
|
RsGxsGroupId group_id ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RsGxsTransGroupStatistics: public GxsGroupStatistic
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsGxsTransGroupStatistics()
|
||||||
|
{
|
||||||
|
last_publish_TS = 0;
|
||||||
|
popularity = 0;
|
||||||
|
subscribed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addMessageMeta(const RsGxsGroupId& grp,const RsMsgMetaData& meta)
|
||||||
|
{
|
||||||
|
messages_metas[meta.mMsgId] = meta ;
|
||||||
|
last_publish_TS = std::max(last_publish_TS,meta.mPublishTs) ;
|
||||||
|
mGrpId = grp ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool subscribed ;
|
||||||
|
int popularity ;
|
||||||
|
|
||||||
|
rstime_t last_publish_TS;
|
||||||
|
|
||||||
|
std::map<RsGxsMessageId,RsMsgMetaData> messages_metas ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// RetroShare GxsTrans asyncronous redundant small mail trasport on top of GXS
|
/// RetroShare GxsTrans asyncronous redundant small mail trasport on top of GXS
|
||||||
|
///
|
||||||
class RsGxsTrans: public RsGxsIfaceHelper
|
class RsGxsTrans: public RsGxsIfaceHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -120,10 +145,8 @@ public:
|
||||||
|
|
||||||
virtual ~RsGxsTrans() {}
|
virtual ~RsGxsTrans() {}
|
||||||
|
|
||||||
virtual bool getStatistics(GxsTransStatistics& stats)=0;
|
virtual bool getDataStatistics(GxsTransStatistics& stats)=0;
|
||||||
|
virtual bool getGroupStatistics(std::map<RsGxsGroupId,RsGxsTransGroupStatistics>& stats) =0;
|
||||||
// virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsTransGroup> &groups) = 0;
|
|
||||||
// virtual bool getPostData(const uint32_t &token, std::vector<RsGxsTransMsg> &posts) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RsGxsTrans *rsGxsTrans ;
|
extern RsGxsTrans *rsGxsTrans ;
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "util/QtVersion.h"
|
#include "util/QtVersion.h"
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/gxs/GxsIdLabel.h"
|
#include "gui/gxs/GxsIdLabel.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||||
|
@ -85,8 +86,6 @@ GxsTransportStatistics::GxsTransportStatistics(QWidget *parent)
|
||||||
mStateHelper = new UIStateHelper(this);
|
mStateHelper = new UIStateHelper(this);
|
||||||
mStateHelper->addWidget(GXSTRANS_GROUP_META, treeWidget);
|
mStateHelper->addWidget(GXSTRANS_GROUP_META, treeWidget);
|
||||||
|
|
||||||
mTransQueue = new TokenQueue(rsGxsTrans->getTokenService(), this);
|
|
||||||
|
|
||||||
m_bProcessSettings = false;
|
m_bProcessSettings = false;
|
||||||
mLastGroupReqTS = 0 ;
|
mLastGroupReqTS = 0 ;
|
||||||
|
|
||||||
|
@ -154,7 +153,8 @@ void GxsTransportStatistics::updateDisplay(bool)
|
||||||
std::cerr << "GxsTransportStatistics::updateDisplay()" << std::endl;
|
std::cerr << "GxsTransportStatistics::updateDisplay()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
requestGroupMeta();
|
loadGroups();
|
||||||
|
|
||||||
mLastGroupReqTS = now ;
|
mLastGroupReqTS = now ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void GxsTransportStatistics::updateContent()
|
||||||
{
|
{
|
||||||
RsGxsTrans::GxsTransStatistics transinfo ;
|
RsGxsTrans::GxsTransStatistics transinfo ;
|
||||||
|
|
||||||
rsGxsTrans->getStatistics(transinfo) ;
|
rsGxsTrans->getDataStatistics(transinfo) ;
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
|
|
||||||
|
@ -333,92 +333,8 @@ void GxsTransportStatistics::personDetails()
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsTransportStatistics::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
#ifdef TO_REMOVE
|
||||||
{
|
void GxsTransportStatistics::loadGroupMeta(const std::vector<RsGroupMetaData>& groupInfo)
|
||||||
#ifdef DEBUG_GXSTRANS_STATS
|
|
||||||
std::cerr << "GxsTransportStatistics::loadRequest() UserType: " << req.mUserType << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (queue != mTransQueue)
|
|
||||||
{
|
|
||||||
std::cerr << "Wrong queue!" << std::endl;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now switch on req */
|
|
||||||
switch(req.mUserType)
|
|
||||||
{
|
|
||||||
case GXSTRANS_GROUP_META: loadGroupMeta(req.mToken);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXSTRANS_GROUP_STAT: loadGroupStat(req.mToken);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GXSTRANS_MSG_META: loadMsgMeta(req.mToken);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
std::cerr << "GxsTransportStatistics::loadRequest() ERROR: INVALID TYPE";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsTransportStatistics::requestGroupMeta()
|
|
||||||
{
|
|
||||||
mStateHelper->setLoading(GXSTRANS_GROUP_META, true);
|
|
||||||
|
|
||||||
#ifdef DEBUG_GXSTRANS_STATS
|
|
||||||
std::cerr << "GxsTransportStatisticsWidget::requestGroupMeta()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
|
||||||
|
|
||||||
uint32_t token;
|
|
||||||
mTransQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, GXSTRANS_GROUP_META);
|
|
||||||
}
|
|
||||||
void GxsTransportStatistics::requestGroupStat(const RsGxsGroupId &groupId)
|
|
||||||
{
|
|
||||||
uint32_t token;
|
|
||||||
rsGxsTrans->getTokenService()->requestGroupStatistic(token, groupId);
|
|
||||||
mTransQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, GXSTRANS_GROUP_STAT);
|
|
||||||
}
|
|
||||||
void GxsTransportStatistics::requestMsgMeta(const RsGxsGroupId& grpId)
|
|
||||||
{
|
|
||||||
mStateHelper->setLoading(GXSTRANS_MSG_META, true);
|
|
||||||
|
|
||||||
#ifdef DEBUG_GXSTRANS_STATS
|
|
||||||
std::cerr << "GxsTransportStatisticsWidget::requestGroupMeta()";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
|
||||||
|
|
||||||
std::list<RsGxsGroupId> grouplist ;
|
|
||||||
grouplist.push_back(grpId) ;
|
|
||||||
|
|
||||||
uint32_t token;
|
|
||||||
rsGxsTrans->getTokenService()->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grouplist);
|
|
||||||
mTransQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, GXSTRANS_MSG_META);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsTransportStatistics::loadGroupStat(const uint32_t &token)
|
|
||||||
{
|
|
||||||
GxsGroupStatistic stats;
|
|
||||||
rsGxsTrans->getGroupStatistic(token, stats);
|
|
||||||
|
|
||||||
#ifdef DEBUG_GXSTRANS_STATS
|
|
||||||
std::cerr << "Loading group stats: " << stats.mGrpId << ", num msgs=" << stats.mNumMsgs << ", total size=" << stats.mTotalSizeOfMsgs << std::endl;
|
|
||||||
#endif
|
|
||||||
dynamic_cast<GxsGroupStatistic&>(mGroupStats[stats.mGrpId]) = stats ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsTransportStatistics::loadGroupMeta(const uint32_t& token)
|
|
||||||
{
|
{
|
||||||
mStateHelper->setLoading(GXSTRANS_GROUP_META, false);
|
mStateHelper->setLoading(GXSTRANS_GROUP_META, false);
|
||||||
|
|
||||||
|
@ -427,22 +343,11 @@ void GxsTransportStatistics::loadGroupMeta(const uint32_t& token)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::list<RsGroupMetaData> groupInfo;
|
|
||||||
std::list<RsGroupMetaData>::iterator vit;
|
|
||||||
|
|
||||||
if (!rsGxsTrans->getGroupSummary(token,groupInfo))
|
|
||||||
{
|
|
||||||
std::cerr << "GxsTransportStatistics::loadGroupMeta() Error getting GroupMeta";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
mStateHelper->setActive(GXSTRANS_GROUP_META, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mStateHelper->setActive(GXSTRANS_GROUP_META, true);
|
mStateHelper->setActive(GXSTRANS_GROUP_META, true);
|
||||||
|
|
||||||
std::set<RsGxsGroupId> existing_groups ;
|
std::set<RsGxsGroupId> existing_groups ;
|
||||||
|
|
||||||
for(vit = groupInfo.begin(); vit != groupInfo.end(); ++vit)
|
for(auto vit = groupInfo.begin(); vit != groupInfo.end(); ++vit)
|
||||||
{
|
{
|
||||||
existing_groups.insert(vit->mGroupId) ;
|
existing_groups.insert(vit->mGroupId) ;
|
||||||
|
|
||||||
|
@ -451,8 +356,8 @@ void GxsTransportStatistics::loadGroupMeta(const uint32_t& token)
|
||||||
std::cerr << "GxsTransportStatisticsWidget::loadGroupMeta() GroupId: " << vit->mGroupId << " Group: " << vit->mGroupName << std::endl;
|
std::cerr << "GxsTransportStatisticsWidget::loadGroupMeta() GroupId: " << vit->mGroupId << " Group: " << vit->mGroupName << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
requestGroupStat(vit->mGroupId) ;
|
loadGroupStats(vit->mGroupId) ;
|
||||||
requestMsgMeta(vit->mGroupId) ;
|
loadMsgMetas(vit->mGroupId) ;
|
||||||
|
|
||||||
RsGxsTransGroupStatistics& s(mGroupStats[vit->mGroupId]);
|
RsGxsTransGroupStatistics& s(mGroupStats[vit->mGroupId]);
|
||||||
s.popularity = vit->mPop ;
|
s.popularity = vit->mPop ;
|
||||||
|
@ -469,17 +374,74 @@ void GxsTransportStatistics::loadGroupMeta(const uint32_t& token)
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsTransportStatistics::loadMsgMeta(const uint32_t& token)
|
void GxsTransportStatistics::loadGroupStats(const RsGxsGroupId& groupId)
|
||||||
{
|
{
|
||||||
mStateHelper->setLoading(GXSTRANS_MSG_META, false);
|
#ifdef DEBUG_GXSTRANS_STATS
|
||||||
|
std::cerr << "Loading group stats: " << stats.mGrpId << ", num msgs=" << stats.mNumMsgs << ", total size=" << stats.mTotalSizeOfMsgs << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
GxsMsgMetaMap m ;
|
RsThread::async([this]()
|
||||||
|
{
|
||||||
|
// 1 - get message data from p3GxsForums
|
||||||
|
|
||||||
if (!rsGxsTrans->getMsgSummary(token,m))
|
#ifdef DEBUG_FORUMS
|
||||||
return ;
|
std::cerr << "Retrieving post data for post " << mThreadId << std::endl;
|
||||||
|
#endif
|
||||||
|
GxsGroupStatistic stats;
|
||||||
|
rsGxsTrans->getGroupStatistic(groupId,stats);
|
||||||
|
|
||||||
for(GxsMsgMetaMap::const_iterator it(m.begin());it!=m.end();++it)
|
RsQThreadUtils::postToObject( [stats,this]()
|
||||||
for(uint32_t i=0;i<it->second.size();++i)
|
{
|
||||||
mGroupStats[it->first].addMessageMeta(it->first,it->second[i]) ;
|
/* Here it goes any code you want to be executed on the Qt Gui
|
||||||
|
* thread, for example to update the data model with new information
|
||||||
|
* after a blocking call to RetroShare API complete */
|
||||||
|
|
||||||
|
dynamic_cast<GxsGroupStatistic&>(mGroupStats[stats.mGrpId]) = stats ;
|
||||||
|
|
||||||
|
mStateHelper->setLoading(GXSTRANS_GROUP_STAT, false);
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void GxsTransportStatistics::loadGroups()
|
||||||
|
{
|
||||||
|
mStateHelper->setLoading(GXSTRANS_GROUP_META, true);
|
||||||
|
|
||||||
|
RsThread::async([this]()
|
||||||
|
{
|
||||||
|
// 1 - get message data from p3GxsForums
|
||||||
|
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "Retrieving post data for post " << mThreadId << std::endl;
|
||||||
|
#endif
|
||||||
|
std::map<RsGxsGroupId,RsGxsTransGroupStatistics> stats;
|
||||||
|
|
||||||
|
if(!rsGxsTrans->getGroupStatistics(stats))
|
||||||
|
{
|
||||||
|
RsErr() << "Cannot retrieve group statistics in GxsTransportStatistics" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsQThreadUtils::postToObject( [stats,this]()
|
||||||
|
{
|
||||||
|
/* Here it goes any code you want to be executed on the Qt Gui
|
||||||
|
* thread, for example to update the data model with new information
|
||||||
|
* after a blocking call to RetroShare API complete */
|
||||||
|
|
||||||
|
mGroupStats = stats;
|
||||||
|
|
||||||
|
updateContent();
|
||||||
|
|
||||||
|
mStateHelper->setLoading(GXSTRANS_GROUP_META, false);
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <retroshare/rsgrouter.h>
|
#include <retroshare/rsgrouter.h>
|
||||||
#include <retroshare/rstypes.h>
|
#include <retroshare/rstypes.h>
|
||||||
|
#include <retroshare/rsgxstrans.h>
|
||||||
|
|
||||||
#include "util/TokenQueue.h"
|
|
||||||
#include "RsAutoUpdatePage.h"
|
#include "RsAutoUpdatePage.h"
|
||||||
#include "ui_GxsTransportStatistics.h"
|
#include "ui_GxsTransportStatistics.h"
|
||||||
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
||||||
|
@ -35,32 +35,7 @@
|
||||||
class GxsTransportStatisticsWidget ;
|
class GxsTransportStatisticsWidget ;
|
||||||
class UIStateHelper;
|
class UIStateHelper;
|
||||||
|
|
||||||
class RsGxsTransGroupStatistics: public GxsGroupStatistic
|
class GxsTransportStatistics: public MainPage, public Ui::GxsTransportStatistics
|
||||||
{
|
|
||||||
public:
|
|
||||||
RsGxsTransGroupStatistics()
|
|
||||||
{
|
|
||||||
last_publish_TS = 0;
|
|
||||||
popularity = 0;
|
|
||||||
subscribed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void addMessageMeta(const RsGxsGroupId& grp,const RsMsgMetaData& meta)
|
|
||||||
{
|
|
||||||
messages_metas[meta.mMsgId] = meta ;
|
|
||||||
last_publish_TS = std::max(last_publish_TS,meta.mPublishTs) ;
|
|
||||||
mGrpId = grp ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool subscribed ;
|
|
||||||
int popularity ;
|
|
||||||
|
|
||||||
rstime_t last_publish_TS;
|
|
||||||
|
|
||||||
std::map<RsGxsMessageId,RsMsgMetaData> messages_metas ;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GxsTransportStatistics: public MainPage, public TokenResponse, public Ui::GxsTransportStatistics
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -71,8 +46,6 @@ public:
|
||||||
// Cache for peer names.
|
// Cache for peer names.
|
||||||
static QString getPeerName(const RsPeerId& peer_id) ;
|
static QString getPeerName(const RsPeerId& peer_id) ;
|
||||||
|
|
||||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req) ;
|
|
||||||
|
|
||||||
void updateContent() ;
|
void updateContent() ;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -82,19 +55,12 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDisplay(bool complete) ;
|
void updateDisplay(bool complete) ;
|
||||||
void loadGroupMeta(const uint32_t& token);
|
void loadGroups();
|
||||||
void loadGroupStat(const uint32_t& token);
|
|
||||||
void loadMsgMeta(const uint32_t& token);
|
|
||||||
|
|
||||||
void requestGroupMeta();
|
|
||||||
void requestMsgMeta(const RsGxsGroupId& groupId);
|
|
||||||
void requestGroupStat(const RsGxsGroupId &groupId);
|
|
||||||
|
|
||||||
void processSettings(bool bLoad);
|
void processSettings(bool bLoad);
|
||||||
bool m_bProcessSettings;
|
bool m_bProcessSettings;
|
||||||
|
|
||||||
GxsTransportStatisticsWidget *_tst_CW ;
|
GxsTransportStatisticsWidget *_tst_CW ;
|
||||||
TokenQueue *mTransQueue ;
|
|
||||||
UIStateHelper *mStateHelper;
|
UIStateHelper *mStateHelper;
|
||||||
uint32_t mLastGroupReqTS ;
|
uint32_t mLastGroupReqTS ;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue