mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-29 00:27:27 -04:00
fixed merge with upstream/master
This commit is contained in:
commit
38e89d4055
100 changed files with 2795 additions and 1806 deletions
|
@ -1193,7 +1193,7 @@ bool RsGenExchange::getGroupList(const uint32_t &token, std::list<RsGxsGroupId>
|
|||
bool RsGenExchange::getMsgList(const uint32_t &token,
|
||||
GxsMsgIdResult &msgIds)
|
||||
{
|
||||
return mDataAccess->getMsgList(token, msgIds);
|
||||
return mDataAccess->getMsgIdList(token, msgIds);
|
||||
}
|
||||
|
||||
bool RsGenExchange::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult &msgIds)
|
||||
|
@ -1692,7 +1692,7 @@ void RsGenExchange::notifyChangedGroupStats(const RsGxsGroupId &grpId)
|
|||
{
|
||||
RS_STACK_MUTEX(mGenMtx);
|
||||
|
||||
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PROCESSED, false);
|
||||
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_STATISTICS_CHANGED, false);
|
||||
gc->mGrpIdList.push_back(grpId);
|
||||
mNotifications.push_back(gc);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,6 +22,7 @@
|
|||
#ifndef RSGXSDATAACCESS_H
|
||||
#define RSGXSDATAACCESS_H
|
||||
|
||||
#include <queue>
|
||||
#include "retroshare/rstokenservice.h"
|
||||
#include "rsgxsrequesttypes.h"
|
||||
#include "rsgds.h"
|
||||
|
@ -30,6 +31,8 @@
|
|||
typedef std::map< RsGxsGroupId, std::map<RsGxsMessageId, RsGxsMsgMetaData*> > MsgMetaFilter;
|
||||
typedef std::map< RsGxsGroupId, RsGxsGrpMetaData* > GrpMetaFilter;
|
||||
|
||||
bool operator<(const std::pair<uint32_t,GxsRequest*>& p1,const std::pair<uint32_t,GxsRequest*>& p2);
|
||||
|
||||
class RsGxsDataAccess : public RsTokenService
|
||||
{
|
||||
public:
|
||||
|
@ -56,7 +59,7 @@ public:
|
|||
* @param groupIds group id to request info for
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds);
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId> &groupIds) override;
|
||||
|
||||
/*!
|
||||
* Use this to request all group related info
|
||||
|
@ -65,7 +68,7 @@ public:
|
|||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
* @return
|
||||
*/
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts);
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts) override;
|
||||
|
||||
/*!
|
||||
* Use this to get msg information (id, meta, or data), store token value to poll for request completion
|
||||
|
@ -75,7 +78,7 @@ public:
|
|||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds);
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds) override;
|
||||
|
||||
/*!
|
||||
* Use this to get message information (id, meta, or data), store token value to poll for request completion
|
||||
|
@ -86,7 +89,7 @@ public:
|
|||
* all messages for all groups are retrieved
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds);
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds) override;
|
||||
|
||||
/*!
|
||||
* For requesting msgs related to a given msg id within a group
|
||||
|
@ -96,7 +99,7 @@ public:
|
|||
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
|
||||
* @return true if request successful false otherwise
|
||||
*/
|
||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::vector<RsGxsGrpMsgIdPair> &msgIds);
|
||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::vector<RsGxsGrpMsgIdPair> &msgIds) override;
|
||||
|
||||
/*!
|
||||
* This request statistics on amount of data held
|
||||
|
@ -107,19 +110,20 @@ public:
|
|||
* total size of messages
|
||||
* total size of groups
|
||||
* @param token
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
*/
|
||||
void requestServiceStatistic(uint32_t& token);
|
||||
void requestServiceStatistic(uint32_t& token, const RsTokReqOptions &opts) override;
|
||||
|
||||
/*!
|
||||
* To request statistic on a group
|
||||
* @param token set to value to be redeemed to get statistic
|
||||
* @param grpId the id of the group
|
||||
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
|
||||
*/
|
||||
void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId);
|
||||
|
||||
void requestGroupStatistic(uint32_t& token, const RsGxsGroupId& grpId, const RsTokReqOptions &opts) override;
|
||||
|
||||
/* Poll */
|
||||
GxsRequestStatus requestStatus(const uint32_t token);
|
||||
GxsRequestStatus requestStatus(uint32_t token);
|
||||
|
||||
/* Cancel Request */
|
||||
bool cancelRequest(const uint32_t &token);
|
||||
|
@ -200,7 +204,8 @@ public:
|
|||
* @param token request token to be redeemed
|
||||
* @param msgIds
|
||||
*/
|
||||
bool getMsgList(const uint32_t &token, GxsMsgIdResult &msgIds);
|
||||
bool getMsgIdList(const uint32_t &token, GxsMsgIdResult &msgIds);
|
||||
|
||||
|
||||
/*!
|
||||
* Retrieve msg list for a given token for message related info
|
||||
|
@ -271,7 +276,7 @@ private:
|
|||
* @param token the value of the token for the request object handle wanted
|
||||
* @return the request associated to this token
|
||||
*/
|
||||
GxsRequest* locked_retrieveRequest(const uint32_t& token);
|
||||
GxsRequest* locked_retrieveCompetedRequest(const uint32_t& token);
|
||||
|
||||
/*!
|
||||
* Add a gxs request to queue
|
||||
|
@ -378,8 +383,18 @@ private:
|
|||
* @param req
|
||||
* @return false if unsuccessful, true otherwise
|
||||
*/
|
||||
bool getMsgList(MsgIdReq* req);
|
||||
bool getMsgIdList(MsgIdReq* req);
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve msg Meta list from data store
|
||||
* Computationally/CPU-Bandwidth expensive
|
||||
*
|
||||
* @param msgIds List of message Ids for the Message Metas to retrieve
|
||||
* @param opts GxsRequest options
|
||||
* @param result Map of Meta information for messages
|
||||
*
|
||||
*/
|
||||
bool getMsgMetaDataList( const GxsMsgReq& msgIds, const RsTokReqOptions& opts, GxsMsgMetaResult& result );
|
||||
|
||||
/*!
|
||||
* Attempts to retrieve group meta data from data store
|
||||
|
@ -445,7 +460,7 @@ private:
|
|||
* @param opts the request options set by user
|
||||
* @param meta The accompanying meta information for msg, ids
|
||||
*/
|
||||
void filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOptions& opts, const MsgMetaFilter& meta) const;
|
||||
void filterMsgIdList(GxsMsgIdResult& msgIds, const RsTokReqOptions& opts, const MsgMetaFilter& meta) const;
|
||||
|
||||
/*!
|
||||
* This filter msgs based of options supplied (at the moment just status masks)
|
||||
|
@ -482,9 +497,10 @@ private:
|
|||
* @param opts the options used to parameterise the id filter
|
||||
* @param msgIdsOut the left overs ids after filter is applied to msgIds
|
||||
*/
|
||||
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions& opts, GxsMsgReq& msgIdsOut);
|
||||
bool getMsgIdList(const GxsMsgReq& msgIds, const RsTokReqOptions& opts, GxsMsgReq& msgIdsOut);
|
||||
|
||||
private:
|
||||
bool locked_clearRequest(const uint32_t &token);
|
||||
|
||||
RsGeneralDataService* mDataStore;
|
||||
|
||||
|
@ -492,10 +508,9 @@ private:
|
|||
|
||||
uint32_t mNextToken;
|
||||
std::map<uint32_t, GxsRequestStatus> mPublicToken;
|
||||
std::map<uint32_t, GxsRequest*> mRequests;
|
||||
|
||||
|
||||
|
||||
std::set<std::pair<uint32_t,GxsRequest*> > mRequestQueue;
|
||||
std::map<uint32_t, GxsRequest*> mCompletedRequests;
|
||||
};
|
||||
|
||||
#endif // RSGXSDATAACCESS_H
|
||||
|
|
|
@ -23,6 +23,128 @@
|
|||
#include "rsgxsrequesttypes.h"
|
||||
#include "util/rsstd.h"
|
||||
|
||||
std::ostream& operator<<(std::ostream& o,const GxsRequest& g)
|
||||
{
|
||||
return g.print(o);
|
||||
}
|
||||
|
||||
|
||||
std::ostream& GroupMetaReq::print(std::ostream& o) const
|
||||
{
|
||||
o << "[Request type=GroupMeta groupIds (size=" << mGroupIds.size() << "): " ;
|
||||
|
||||
if(!mGroupIds.empty())
|
||||
{
|
||||
o << *mGroupIds.begin() ;
|
||||
|
||||
if(mGroupIds.size() > 1)
|
||||
o << " ..." ;
|
||||
}
|
||||
|
||||
o << "]" ;
|
||||
|
||||
return o;
|
||||
}
|
||||
std::ostream& GroupIdReq::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=GroupIdReq" << "]" ;
|
||||
}
|
||||
|
||||
std::ostream& GroupSerializedDataReq::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=GroupSerializedData" << "]" ;
|
||||
}
|
||||
|
||||
std::ostream& GroupDataReq::print(std::ostream& o) const
|
||||
{
|
||||
o << "[Request type=GroupDataReq groupIds (size=" << mGroupIds.size() << "): " ;
|
||||
|
||||
if(!mGroupIds.empty())
|
||||
{
|
||||
o << *mGroupIds.begin() ;
|
||||
|
||||
if(mGroupIds.size() > 1)
|
||||
o << " ..." ;
|
||||
}
|
||||
|
||||
o << "]" ;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& MsgIdReq::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=MsgId" << "]" ;
|
||||
}
|
||||
|
||||
std::ostream& MsgMetaReq::print(std::ostream& o) const
|
||||
{
|
||||
o << "[Request type=MsgMetaReq groups (size=" << mMsgIds.size() << "): " ;
|
||||
|
||||
if(!mMsgIds.empty())
|
||||
{
|
||||
o << mMsgIds.begin()->first << " (" << mMsgIds.begin()->second.size() << " messages)";
|
||||
|
||||
if(mMsgIds.size() > 1)
|
||||
o << " ..." ;
|
||||
}
|
||||
|
||||
o << "]" ;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& MsgDataReq::print(std::ostream& o) const
|
||||
{
|
||||
o << "[Request type=MsgDataReq groups (size=" << mMsgIds.size() << "): " ;
|
||||
|
||||
if(!mMsgIds.empty())
|
||||
{
|
||||
o << mMsgIds.begin()->first << " (" << mMsgIds.begin()->second.size() << " messages)";
|
||||
|
||||
if(mMsgIds.size() > 1)
|
||||
o << " ..." ;
|
||||
}
|
||||
|
||||
o << "]" ;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& MsgRelatedInfoReq::print(std::ostream& o) const
|
||||
{
|
||||
o << "[Request type=MsgRelatedInfo msgIds (size=" << mMsgIds.size() << "): " ;
|
||||
|
||||
if(!mMsgIds.empty())
|
||||
{
|
||||
o << mMsgIds.begin()->first ;
|
||||
|
||||
if(mMsgIds.size() > 1)
|
||||
o << " ..." ;
|
||||
}
|
||||
|
||||
o << "]" ;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& GroupSetFlagReq::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=GroupFlagSet grpId=" << grpId << "]" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::ostream& ServiceStatisticRequest::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=ServiceStatistics" << "]" ;
|
||||
}
|
||||
|
||||
std::ostream& GroupStatisticRequest::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=GroupStatistics grpId=" << mGrpId << "]" ;
|
||||
}
|
||||
|
||||
GroupMetaReq::~GroupMetaReq()
|
||||
{
|
||||
//rsstd::delete_all(mGroupMetaData.begin(), mGroupMetaData.end()); // now memory ownership is kept by the cache.
|
||||
|
@ -57,3 +179,8 @@ MsgRelatedInfoReq::~MsgRelatedInfoReq()
|
|||
rsstd::delete_all(dataIt->second.begin(), dataIt->second.end());
|
||||
}
|
||||
}
|
||||
std::ostream& MessageSetFlagReq::print(std::ostream& o) const
|
||||
{
|
||||
return o << "[Request type=MsgFlagSet" << "]" ;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,25 +29,30 @@
|
|||
struct GxsRequest
|
||||
{
|
||||
GxsRequest() :
|
||||
token(0), reqTime(0), ansType(0), reqType(0),
|
||||
token(0), reqTime(0), clientAnswerType(0), reqType(0),
|
||||
status(RsTokenService::FAILED) {}
|
||||
virtual ~GxsRequest() {}
|
||||
|
||||
uint32_t token;
|
||||
uint32_t reqTime;
|
||||
|
||||
RS_DEPRECATED uint32_t ansType; /// G10h4ck: This is of no use
|
||||
uint32_t clientAnswerType; /// This is made available to the clients in order to keep track of why specific requests where sent..
|
||||
uint32_t reqType;
|
||||
RsTokReqOptions Options;
|
||||
|
||||
RsTokenService::GxsRequestStatus status;
|
||||
|
||||
virtual std::ostream& print(std::ostream& o) const = 0;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& o,const GxsRequest& g);
|
||||
|
||||
class GroupMetaReq : public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual ~GroupMetaReq();
|
||||
|
||||
virtual std::ostream& print(std::ostream& o) const override;
|
||||
public:
|
||||
std::list<RsGxsGroupId> mGroupIds;
|
||||
std::list<const RsGxsGrpMetaData*> mGroupMetaData;
|
||||
|
@ -56,12 +61,16 @@ public:
|
|||
class GroupIdReq : public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
|
||||
std::list<RsGxsGroupId> mGroupIds;
|
||||
std::list<RsGxsGroupId> mGroupIdResult;
|
||||
};
|
||||
class GroupSerializedDataReq : public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
|
||||
std::list<RsGxsGroupId> mGroupIds;
|
||||
std::list<RsNxsGrp*> mGroupData;
|
||||
};
|
||||
|
@ -71,6 +80,7 @@ class GroupDataReq : public GxsRequest
|
|||
public:
|
||||
virtual ~GroupDataReq();
|
||||
|
||||
virtual std::ostream& print(std::ostream& o) const override;
|
||||
public:
|
||||
std::list<RsGxsGroupId> mGroupIds;
|
||||
std::list<RsNxsGrp*> mGroupData;
|
||||
|
@ -79,6 +89,8 @@ public:
|
|||
class MsgIdReq : public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
|
||||
GxsMsgReq mMsgIds;
|
||||
GxsMsgIdResult mMsgIdResult;
|
||||
};
|
||||
|
@ -88,6 +100,8 @@ class MsgMetaReq : public GxsRequest
|
|||
public:
|
||||
virtual ~MsgMetaReq();
|
||||
|
||||
virtual std::ostream& print(std::ostream& o) const override;
|
||||
|
||||
public:
|
||||
GxsMsgReq mMsgIds;
|
||||
GxsMsgMetaResult mMsgMetaData;
|
||||
|
@ -98,6 +112,7 @@ class MsgDataReq : public GxsRequest
|
|||
public:
|
||||
virtual ~MsgDataReq();
|
||||
|
||||
virtual std::ostream& print(std::ostream& o) const override;
|
||||
public:
|
||||
GxsMsgReq mMsgIds;
|
||||
NxsMsgDataResult mMsgData;
|
||||
|
@ -106,12 +121,15 @@ public:
|
|||
class ServiceStatisticRequest: public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
GxsServiceStatistic mServiceStatistic;
|
||||
};
|
||||
|
||||
struct GroupStatisticRequest: public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
|
||||
RsGxsGroupId mGrpId;
|
||||
GxsGroupStatistic mGroupStatistic;
|
||||
};
|
||||
|
@ -121,6 +139,7 @@ class MsgRelatedInfoReq : public GxsRequest
|
|||
public:
|
||||
virtual ~MsgRelatedInfoReq();
|
||||
|
||||
std::ostream& print(std::ostream& o) const override;
|
||||
public:
|
||||
std::vector<RsGxsGrpMsgIdPair> mMsgIds;
|
||||
MsgRelatedIdResult mMsgIdResult;
|
||||
|
@ -131,6 +150,8 @@ public:
|
|||
class GroupSetFlagReq : public GxsRequest
|
||||
{
|
||||
public:
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
|
||||
const static uint32_t FLAG_SUBSCRIBE;
|
||||
const static uint32_t FLAG_STATUS;
|
||||
|
||||
|
@ -145,6 +166,7 @@ class MessageSetFlagReq : public GxsRequest
|
|||
public:
|
||||
const static uint32_t FLAG_STATUS;
|
||||
|
||||
virtual std::ostream& print(std::ostream& o) const override ;
|
||||
uint8_t type;
|
||||
uint32_t flag;
|
||||
uint32_t flagMask;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue