moved constants for GXS group management into rsgxs.h

This commit is contained in:
csoler 2016-11-09 16:18:43 +01:00
parent f3a34bf5a3
commit 143829c881
4 changed files with 24 additions and 12 deletions

View File

@ -39,8 +39,6 @@
#include "serialiser/rsnxsitems.h" #include "serialiser/rsnxsitems.h"
#include "rsgxsutil.h" #include "rsgxsutil.h"
#define DEFAULT_MSG_STORE_PERIOD 60*60*24*31*4 // 4 months
template<class GxsItem, typename Identity = std::string> template<class GxsItem, typename Identity = std::string>
class GxsPendingItem class GxsPendingItem
{ {
@ -128,7 +126,7 @@ public:
*/ */
RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns,
RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy, RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy,
uint32_t messageStorePeriod = DEFAULT_MSG_STORE_PERIOD); uint32_t messageStorePeriod = RS_GXS_DEFAULT_MSG_STORE_PERIOD);
virtual ~RsGenExchange(); virtual ~RsGenExchange();

View File

@ -35,5 +35,10 @@
typedef std::map<RsGxsGroupId, std::vector<RsGxsMsgMetaData*> > GxsMsgMetaResult; typedef std::map<RsGxsGroupId, std::vector<RsGxsMsgMetaData*> > GxsMsgMetaResult;
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsGxsMsgMetaData*> > MsgRelatedMetaResult; typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsGxsMsgMetaData*> > MsgRelatedMetaResult;
// Default values that are used throughout GXS code
static const uint32_t RS_GXS_DEFAULT_MSG_STORE_PERIOD = 86400 * 31 * 6 ; // six months. Default time for which messages are keps in the database.
static const uint32_t RS_GXS_DEFAULT_MSG_SEND_PERIOD = 86400 * 31 * 1 ; // one months. Default delay after which we don't send messages
static const uint32_t RS_GXS_DEFAULT_MSG_REQ_PERIOD = 86400 * 31 * 1 ; // one months. Default Delay after which we don't request messages
#endif // RSGXS_H #endif // RSGXS_H

View File

@ -679,7 +679,7 @@ void RsGxsNetService::syncGrpStatistics()
for(std::map<RsGxsGroupId,RsGxsGrpMetaData*>::const_iterator it(grpMeta.begin());it!=grpMeta.end();++it) for(std::map<RsGxsGroupId,RsGxsGrpMetaData*>::const_iterator it(grpMeta.begin());it!=grpMeta.end();++it)
{ {
RsGroupNetworkStatsRecord& rec(mGroupNetworkStats[it->first]) ; RsGroupNetworkStatsRecord& rec(GrpConfigMap[it->first]) ;
#ifdef NXS_NET_DEBUG_6 #ifdef NXS_NET_DEBUG_6
GXSNETDEBUG__G(it->first) << " group " << it->first ; GXSNETDEBUG__G(it->first) << " group " << it->first ;
#endif #endif

View File

@ -37,6 +37,7 @@
#include "serialiser/rstlvkeys.h" #include "serialiser/rstlvkeys.h"
#endif #endif
#include "gxs/rsgxs.h"
#include "gxs/rsgxsdata.h" #include "gxs/rsgxsdata.h"
#include "serialiser/rstlvidset.h" #include "serialiser/rstlvidset.h"
@ -50,20 +51,28 @@ const uint8_t RS_PKT_SUBTYPE_GXS_GRP_CONFIG = 0x09;
class RsGxsGrpConfigItem : public RsItem { class RsGxsGrpConfigItem : public RsItem {
public: public:
RsGxsGrpConfigItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG) {} RsGxsGrpConfigItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG)
{
msg_keep_delay = RS_GXS_DEFAULT_MSG_STORE_PERIOD ;
msg_send_delay = RS_GXS_DEFAULT_MSG_SEND_PERIOD ;
msg_req_delay = RS_GXS_DEFAULT_MSG_REQ_PERIOD ;
max_visible_count = 0 ;
update_TS = 0 ;
}
virtual ~RsGxsGrpConfigItem() {} virtual ~RsGxsGrpConfigItem() {}
virtual void clear() {} virtual void clear() {}
virtual std::ostream &print(std::ostream &out, uint16_t indent) { return out;} virtual std::ostream &print(std::ostream &out, uint16_t indent) { return out;}
RsGxsGroupId grpId ; RsGxsGroupId grpId ;
uint32_t msg_keep_delay ; uint32_t msg_keep_delay ; // delay after which we discard the posts
uint32_t msg_send_delay ; uint32_t msg_send_delay ; // delay after which we dont send the posts anymore
uint32_t msg_req_delay ; uint32_t msg_req_delay ; // delay after which we dont get the posts from friends
RsTlvPeerIdSet suppliers; RsTlvPeerIdSet suppliers; // list of friends who feed this group
uint32_t max_visible_count ; uint32_t max_visible_count ; // max visible count reported by contributing friends
time_t update_TS ; time_t update_TS ; // last time the max visible count was updated.
}; };
class RsGxsGrpUpdateItem : public RsItem { class RsGxsGrpUpdateItem : public RsItem {