Improved token service interface with more obvious request calls (grpIds and msgIds list being empty is not implicit of retrieving all ids)

Updated GXS tests and applied fixes
started transfering flags to gxs flags header file

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5513 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-09-04 22:32:52 +00:00
parent 84074fdca1
commit 08904bf82f
15 changed files with 387 additions and 114 deletions

View File

@ -29,6 +29,7 @@
#include "gxs/rsgds.h"
#include "util/retrodb.h"
class RsDataService : public RsGeneralDataService
{
public:

View File

@ -151,7 +151,7 @@ public:
* @param cache whether to store retrieval in mem for faster later retrieval
* @return error code
*/
virtual int retrieveGxsMsgMetaData(GxsMsgReq& grpIds, GxsMsgMetaResult& msgMeta) = 0;
virtual int retrieveGxsMsgMetaData(GxsMsgReq& msgIds, GxsMsgMetaResult& msgMeta) = 0;
/*!
* remove msgs in data store listed in msgIds param

View File

@ -32,6 +32,7 @@
#include "rsgenexchange.h"
#include "gxssecurity.h"
#include "util/contentvalue.h"
#include "rsgxsflags.h"
RsGenExchange::RsGenExchange(RsGeneralDataService *gds,
RsNetworkExchangeService *ns, RsSerialType *serviceSerialiser, uint16_t servType)

View File

@ -32,6 +32,7 @@
#include <list>
#include <set>
#include <map>
#include <vector>
/* data types used throughout Gxs from netservice to genexchange */

View File

@ -65,43 +65,88 @@ RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds)
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts,
const std::list<std::string> &groupIds)
{
GxsRequest* req = NULL;
uint32_t reqType = opts.mReqType;
if(groupIds.empty())
{
std::cerr << "Group Id list is empty" << std::endl;
return false;
}
if(reqType & GXS_REQUEST_TYPE_GROUP_META)
{
GroupMetaReq* gmr = new GroupMetaReq();
gmr->mGroupIds = groupIds;
req = gmr;
}
else if(reqType & GXS_REQUEST_TYPE_GROUP_DATA)
{
GroupDataReq* gdr = new GroupDataReq();
gdr->mGroupIds = groupIds;
req = gdr;
}
else if(reqType & GXS_REQUEST_TYPE_GROUP_IDS)
{
GroupIdReq* gir = new GroupIdReq();
gir->mGroupIds = groupIds;
req = gir;
}
GxsRequest* req = NULL;
uint32_t reqType = opts.mReqType;
if(req == NULL)
{
std::cerr << "RsGxsDataAccess::requestMsgInfo() request type not recognised, type "
<< reqType << std::endl;
return false;
}else
{
generateToken(token);
std::cerr << "RsGxsDataAccess::requestMsgInfo() gets Token: " << token << std::endl;
}
if(reqType & GXS_REQUEST_TYPE_GROUP_META)
{
GroupMetaReq* gmr = new GroupMetaReq();
gmr->mGroupIds = groupIds;
req = gmr;
}
else if(reqType & GXS_REQUEST_TYPE_GROUP_DATA)
{
GroupDataReq* gdr = new GroupDataReq();
gdr->mGroupIds = groupIds;
req = gdr;
}
else if(reqType & GXS_REQUEST_TYPE_GROUP_IDS)
{
GroupIdReq* gir = new GroupIdReq();
gir->mGroupIds = groupIds;
req = gir;
}
setReq(req, token, ansType, opts);
storeRequest(req);
if(req == NULL)
{
std::cerr << "RsGxsDataAccess::requestMsgInfo() request type not recognised, type "
<< reqType << std::endl;
return false;
}else
{
generateToken(token);
std::cerr << "RsGxsDataAccess::requestMsgInfo() gets Token: " << token << std::endl;
}
return true;
setReq(req, token, ansType, opts);
storeRequest(req);
return true;
}
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts)
{
GxsRequest* req = NULL;
uint32_t reqType = opts.mReqType;
if(reqType & GXS_REQUEST_TYPE_GROUP_META)
{
GroupMetaReq* gmr = new GroupMetaReq();
req = gmr;
}
else if(reqType & GXS_REQUEST_TYPE_GROUP_DATA)
{
GroupDataReq* gdr = new GroupDataReq();
req = gdr;
}
else if(reqType & GXS_REQUEST_TYPE_GROUP_IDS)
{
GroupIdReq* gir = new GroupIdReq();
req = gir;
}
if(req == NULL)
{
std::cerr << "RsGxsDataAccess::requestMsgInfo() request type not recognised, type "
<< reqType << std::endl;
return false;
}else
{
generateToken(token);
std::cerr << "RsGxsDataAccess::requestMsgInfo() gets Token: " << token << std::endl;
}
setReq(req, token, ansType, opts);
storeRequest(req);
return true;
}
void RsGxsDataAccess::generateToken(uint32_t &token)
@ -121,21 +166,41 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
GxsRequest* req = NULL;
uint32_t reqType = opts.mReqType;
// remove all empty grpId entries
GxsMsgReq::const_iterator mit = msgIds.begin();
std::vector<RsGxsGroupId> toRemove;
for(; mit != msgIds.end(); mit++)
{
if(mit->second.empty())
toRemove.push_back(mit->first);
}
std::vector<RsGxsGroupId>::const_iterator vit = toRemove.begin();
GxsMsgReq filteredMsgIds = msgIds;
for(; vit != toRemove.end(); vit++)
filteredMsgIds.erase(*vit);
if(reqType & GXS_REQUEST_TYPE_MSG_META)
{
MsgMetaReq* mmr = new MsgMetaReq();
mmr->mMsgIds = msgIds;
mmr->mMsgIds = filteredMsgIds;
req = mmr;
}else if(reqType & GXS_REQUEST_TYPE_MSG_DATA)
{
MsgDataReq* mdr = new MsgDataReq();
mdr->mMsgIds = msgIds;
mdr->mMsgIds = filteredMsgIds;
req = mdr;
}else if(reqType & GXS_REQUEST_TYPE_MSG_IDS)
{
MsgIdReq* mir = new MsgIdReq();
mir->mMsgIds = msgIds;
mir->mMsgIds = filteredMsgIds;
req = mir;
}
if(req == NULL)
@ -154,8 +219,58 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
return true;
}
bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds)
{
GxsRequest* req = NULL;
uint32_t reqType = opts.mReqType;
bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds)
std::list<RsGxsGroupId>::const_iterator lit = grpIds.begin();
if(reqType & GXS_REQUEST_TYPE_MSG_META)
{
MsgMetaReq* mmr = new MsgMetaReq();
for(; lit != grpIds.end(); lit++)
mmr->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
req = mmr;
}else if(reqType & GXS_REQUEST_TYPE_MSG_DATA)
{
MsgDataReq* mdr = new MsgDataReq();
for(; lit != grpIds.end(); lit++)
mdr->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
req = mdr;
}else if(reqType & GXS_REQUEST_TYPE_MSG_IDS)
{
MsgIdReq* mir = new MsgIdReq();
for(; lit != grpIds.end(); lit++)
mir->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
req = mir;
}
if(req == NULL)
{
std::cerr << "RsGxsDataAccess::requestMsgInfo() request type not recognised, type "
<< reqType << std::endl;
return false;
}else
{
generateToken(token);
std::cerr << "RsGxsDataAccess::requestMsgInfo() gets Token: " << token << std::endl;
}
setReq(req, token, ansType, opts);
storeRequest(req);
return true;
}
bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts,
const GxsMsgReq& msgIds)
{
MsgRelatedInfoReq* req = new MsgRelatedInfoReq();
@ -166,7 +281,6 @@ bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, c
setReq(req, token, ansType, opts);
storeRequest(req);
return true;
}

View File

@ -44,24 +44,43 @@ public:
/** S: RsTokenService **/
/*!
*
* @param token
* @param ansType
* @param opts
* @param groupIds
* Use this to request group related information
* @param token The token returned for the request, store this value to pool for request completion
* @param ansType The type of result (e.g. group data, meta, ids)
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @param groupIds group id to request info for
* @return
*/
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds);
/*!
* For requesting info on all messages of one or more groups
* @param token
* @param ansType
* @param opts
* @param groupIds
* Use this to request all group related info
* @param token The token returned for the request, store this value to pool for request completion
* @param ansType The type of result (e.g. group data, meta, ids)
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @return
*/
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq&);
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts);
/*!
* Use this to get msg related information, store this value to pole for request completion
* @param token The token returned for the request
* @param ansType The type of result wanted
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @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 RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds);
/*!
* Use this to get msg related information, store this value to pole for request completion
* @param token The token returned for the request
* @param ansType The type of result wanted
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
* @return true if request successful false otherwise
*/
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& grpIds);
/*!
* For requesting msgs related to a given msg id within a group
@ -71,7 +90,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 RsTokReqOptionsV2 &opts, const GxsMsgReq&);
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds);
/* Poll */
uint32_t requestStatus(const uint32_t token);

View File

@ -3,6 +3,8 @@
#include "inttypes.h"
// this serves a single point of call for definining grp and msg modes
// GXS. These modes say
namespace GXS_SERV {
@ -10,30 +12,30 @@ namespace GXS_SERV {
/* type of group */
static const uint32_t FLAG_GRP_TYPE_MASK;
static const uint32_t FLAG_GRP_TYPE_MASK = 0;
// pub key encrypted
static const uint32_t FLAG_GRP_TYPE_PRIVATE;
static const uint32_t FLAG_GRP_TYPE_PRIVATE = 0;
// single publisher, read only
static const uint32_t FLAG_GRP_TYPE_RESTRICTED;
static const uint32_t FLAG_GRP_TYPE_RESTRICTED = 0;
// anyone can publish
static const uint32_t FLAG_GRP_TYPE_PUBLIC;
static const uint32_t FLAG_GRP_TYPE_PUBLIC = 0;
/* type of msgs allowed */
static const uint32_t FLAG_MSG_TYPE_MASK;
static const uint32_t FLAG_MSG_TYPE_MASK = 0;
// only signee can edit, and sign required
static const uint32_t FLAG_MSG_TYPE_SIGNED;
static const uint32_t FLAG_MSG_TYPE_SIGNED = 0;
// no sign required, but signee can edit if signed
static const uint32_t FLAG_MSG_TYPE_ANON;
static const uint32_t FLAG_MSG_TYPE_ANON = 0;
// anyone can mod but sign must be provided (needed for wikis)
static const uint32_t FLAG_MSG_TYPE_SIGNED_SHARED;
static const uint32_t FLAG_MSG_TYPE_SIGNED_SHARED = 0;
/*** GROUP FLAGS ***/
@ -42,13 +44,22 @@ namespace GXS_SERV {
/*** MESSAGE FLAGS ***/
// indicates message edits an existing message
static const uint32_t FLAG_MSG_EDIT;
static const uint32_t FLAG_MSG_EDIT = 0;
// indicates msg is id signed
static const uint32_t FLAG_MSG_ID_SIGNED;
static const uint32_t FLAG_MSG_ID_SIGNED = 0;
/*** MESSAGE FLAGS ***/
// Subscription Flags. (LOCAL)
static const uint32_t RSGXS_GROUP_SUBSCRIBE_ADMIN = 0x00000001;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_PUBLISH = 0x00000002;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED = 0x00000004;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_MONITOR = 0x00000008;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_MASK = 0x0000000f;
}

View File

@ -25,6 +25,7 @@
*/
#include "rsgxsnetservice.h"
#include "rsgxsflags.h"
#define NXS_NET_DEBUG
@ -85,24 +86,40 @@ void RsGxsNetService::syncWithPeers()
sendItem(grp);
}
std::map<RsGxsGroupId, RsGxsGrpMetaData* > grpMeta;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
std::map<RsGxsGroupId, RsGxsGrpMetaData* >::iterator
mit = grpMeta.begin();
std::vector<RsGxsGroupId> grpIds;
for(; mit != grpMeta.end(); mit++)
{
RsGxsGrpMetaData* meta = mit->second;
if(meta->mSubscribeFlags & GXS_SERV::RSGXS_GROUP_SUBSCRIBE_MASK)
grpIds.push_back(mit->first);
}
sit = peers.begin();
// TODO msgs
for(; sit != peers.end(); sit++)
{
RsStackMutex stack(mNxsMutex);
std::set<std::string>::iterator sit_grp = mGroupSubscribedTo.begin();
std::vector<RsGxsGroupId>::iterator vit = grpIds.begin();
for(; sit_grp != mGroupSubscribedTo.end(); sit_grp++)
for(; vit != grpIds.end(); vit++)
{
RsNxsSyncMsg* msg = new RsNxsSyncMsg(mServType);
msg->clear();
msg->PeerId(*sit);
msg->grpId = *sit_grp;
msg->PeerId(*sit);
msg->grpId = *vit;
sendItem(msg);
}
}
}
bool RsGxsNetService::loadList(std::list<RsItem*>& load)
@ -600,10 +617,6 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
{
tr->mItems.pop_front();
grps.push_back(grp);
//TODO: remove subscription should be handled
// outside netservice
mGroupSubscribedTo.insert(grp->grpId);
}
else
{

View File

@ -290,44 +290,44 @@ private:
* of msgs received from peer stored in passed transaction
* @param tr transaction responsible for generating msg request
*/
void locked_genReqMsgTransaction(NxsTransaction* tr);
void locked_genReqMsgTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send grp requests based on list
* of grps received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void locked_genReqGrpTransaction(NxsTransaction* tr);
void locked_genReqGrpTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send msg data based on list
* of grpids received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void locked_genSendMsgsTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send msg data based on list
* of grpids received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void locked_genSendMsgsTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send grp data based on list
* of grps received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void locked_genSendGrpsTransaction(NxsTransaction* tr);
/*!
* Generates new transaction to send grp data based on list
* of grps received from peer stored in passed transaction
* @param tr transaction responsible for generating grp request
*/
void locked_genSendGrpsTransaction(NxsTransaction* tr);
/*!
* convenience function to add a transaction to list
* @param tr transaction to add
*/
bool locked_addTransaction(NxsTransaction* tr);
/*!
* convenience function to add a transaction to list
* @param tr transaction to add
*/
bool locked_addTransaction(NxsTransaction* tr);
void cleanTransactionItems(NxsTransaction* tr) const;
void cleanTransactionItems(NxsTransaction* tr) const;
/*!
* @param tr the transaction to check for timeout
* @return false if transaction has timed out, true otherwise
*/
bool locked_checkTransacTimedOut(NxsTransaction* tr);
/*!
* @param tr the transaction to check for timeout
* @return false if transaction has timed out, true otherwise
*/
bool locked_checkTransacTimedOut(NxsTransaction* tr);
/** E: Transaction processing **/
/** E: Transaction processing **/
/** S: item handlers **/
@ -395,9 +395,7 @@ private:
RsMutex mNxsMutex;
uint32_t mSyncTs;
// TODO: remove, temp, for testing.
// subscription handled outside netservice
std::set<std::string> mGroupSubscribedTo;
const uint32_t mSYNC_PERIOD;
};

View File

@ -114,18 +114,27 @@ public:
RsTokenServiceV2() { return; }
virtual ~RsTokenServiceV2() { return; }
/* Data Requests */
/* Data Requests */
/*!
* Use this to request group related information
* @param token The token returned for the request, store this value to pool for request completion
* @param ansType The type of result (e.g. group data, meta, ids)
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @param groupIds group id to request info for. Leave empty to get info on all groups,
* @param groupIds group id to request info for
* @return
*/
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId> &groupIds) = 0;
/*!
* Use this to request all group related info
* @param token The token returned for the request, store this value to pool for request completion
* @param ansType The type of result (e.g. group data, meta, ids)
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @return
*/
virtual bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts) = 0;
/*!
* Use this to get msg related information, store this value to pole for request completion
* @param token The token returned for the request
@ -136,6 +145,16 @@ public:
*/
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds) = 0;
/*!
* Use this to get msg related information, store this value to pole for request completion
* @param token The token returned for the request
* @param ansType The type of result wanted
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list
* @return true if request successful false otherwise
*/
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const std::list<RsGxsGroupId>& msgIds) = 0;
/*!
* For requesting msgs related to a given msg id within a group
* @param token The token returned for the request
@ -147,7 +166,7 @@ public:
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds) = 0;
/* Poll */
/* Poll */
/*!
* Request the status of ongoing request.

View File

@ -2274,6 +2274,8 @@ int RsServer::StartupRetroShare()
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
RS_SERVICE_TYPE_PHOTO, NULL);
photo_ds->resetDataStore();
// TODO need net manager
//RsGxsNetService* photo_ns = new RsGxsNetService(
// RS_SERVICE_TYPE_PHOTO, photo_ds, NULL, mPhotoV2);

View File

@ -175,7 +175,7 @@ bool GenExchangeTester::testGrpSubmissionRetrieval()
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
std::list<RsGxsGroupId> grpIds;
mTokenService->requestGroupInfo(token, 0, opts, grpIds);
mTokenService->requestGroupInfo(token, 0, opts);
pollForToken(token, opts);
@ -272,7 +272,7 @@ bool GenExchangeTester::testGrpMetaRetrieval()
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
std::list<RsGxsGroupId> grpIds;
mTokenService->requestGroupInfo(token, 0, opts, grpIds);
mTokenService->requestGroupInfo(token, 0, opts);
pollForToken(token, opts);
@ -319,7 +319,7 @@ bool GenExchangeTester::testGrpIdRetrieval()
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
uint32_t token;
std::list<RsGxsGroupId> grpIds;
mTokenService->requestGroupInfo(token, 0, opts, grpIds);
mTokenService->requestGroupInfo(token, 0, opts);
pollForToken(token, opts);
@ -676,13 +676,13 @@ bool GenExchangeTester::testMsgIdRetrieval()
// now do ask of all msg ids
GxsMsgReq req;
std::list<RsGxsGroupId> req;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
// use empty grp ids request types, non specific msgs ids
for(int i=0; i < mRandGrpIds.size(); i++)
{
req[mRandGrpIds[i]] = std::vector<RsGxsMessageId>();
req.push_back(mRandGrpIds[i]);
}
mTokenService->requestMsgInfo(token, 0, opts, req);

View File

@ -0,0 +1,92 @@
#-------------------------------------------------
#
# Project created by QtCreator 2012-05-06T09:19:26
#
#-------------------------------------------------
QT += core network
QT -= gui
TARGET = rs_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
CONFIG += debug
debug {
# DEFINES *= DEBUG
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG
# DEFINES *= CONTROL_DEBUG FT_DEBUG DEBUG_FTCHUNK P3TURTLE_DEBUG
# DEFINES *= P3TURTLE_DEBUG
# DEFINES *= NET_DEBUG
# DEFINES *= DISTRIB_DEBUG
# DEFINES *= P3TURTLE_DEBUG FT_DEBUG DEBUG_FTCHUNK MPLEX_DEBUG
# DEFINES *= STATUS_DEBUG SERV_DEBUG RSSERIAL_DEBUG #CONN_DEBUG
QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
}
################################# Linux ##########################################
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
linux-* {
#CONFIG += version_detail_bash_script
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
system(which gpgme-config >/dev/null 2>&1) {
INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
} else {
message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
}
PRE_TARGETDEPS *= /home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/lib/libretroshare.a
LIBS += /home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/lib/libretroshare.a
LIBS += /home/crispy/workspace/v0.5-gxs-b1/libbitdht/src/lib/libbitdht.a
LIBS += /home/crispy/workspace/v0.5-gxs-b1/openpgpsdk/src/lib/libops.a
LIBS += -lssl -lgpgme -lupnp -lixml -lgnome-keyring -lsqlite3 -lbz2
LIBS *= -rdynamic -frtti
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
DEFINES *= UBUNTU
}
linux-g++ {
OBJECTS_DIR = temp/linux-g++/obj
}
linux-g++-64 {
OBJECTS_DIR = temp/linux-g++-64/obj
}
version_detail_bash_script {
DEFINES += ADD_LIBRETROSHARE_VERSION_INFO
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
install_rs {
INSTALLS += binary_rs
binary_rs.path = $$(PREFIX)/usr/bin
binary_rs.files = ./RetroShare
}
SOURCES += \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/data_support.cc \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/nxstesthub.cc \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/nxstestscenario.cc \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/rsgxsnetservice_test.cc \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/support.cc
HEADERS += \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/data_support.h \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/nxstesthub.h \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/nxstestscenario.h \
/home/crispy/workspace/v0.5-gxs-b1/libretroshare/src/tests/gxs/support.h
INCLUDEPATH += /home/crispy/workspace/v0.5-gxs-b1/libretroshare/src

View File

@ -2,6 +2,7 @@
#include "support.h"
#include "data_support.h"
#include "rsdataservice_test.h"
#include "gxs/rsgds.h"
#include "gxs/rsdataservice.h"
#define DATA_BASE_NAME "msg_grp_Store"
@ -57,9 +58,9 @@ void test_groupStoreAndRetrieve(){
dStore->storeGroup(grps);
std::map<std::string, RsNxsGrp*> gR;
std::map<std::string, RsGxsGrpMetaData*> grpMetaR;
dStore->retrieveNxsGrps(gR, false);
std::map<RsGxsGroupId, RsNxsGrp*> gR;
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetaR;
dStore->retrieveNxsGrps(gR, false, false);
dStore->retrieveGxsGrpMetaData(grpMetaR);
std::map<RsNxsGrp*, RsGxsGrpMetaData*>::iterator mit = grps.begin();
@ -164,7 +165,7 @@ void test_messageStoresAndRetrieve()
const std::string& grpId = grpV[chosen];
if(chosen)
req[grpId].insert(msg->msgId);
req[grpId].push_back(msg->msgId);
msgMeta->mMsgId = msg->msgId;
msgMeta->mGroupId = msg->grpId = grpId;
@ -189,7 +190,7 @@ void test_messageStoresAndRetrieve()
msgs.insert(p);
}
req[grpV[0]] = std::set<std::string>(); // assign empty list for other
req[grpV[0]] = std::vector<RsGxsMessageId>(); // assign empty list for other
dStore->storeMessage(msgs);
@ -199,7 +200,8 @@ void test_messageStoresAndRetrieve()
GxsMsgResult msgResult;
GxsMsgMetaResult msgMetaResult;
dStore->retrieveNxsMsgs(req, msgResult, false);
dStore->retrieveGxsMsgMetaData(grpV, msgMetaResult);
dStore->retrieveGxsMsgMetaData(req, msgMetaResult);
// now look at result for grpId 1
std::vector<RsNxsMsg*>& result0 = msgResult[grpId0];

View File

@ -69,7 +69,7 @@ public:
RsDummySerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_DUMMY)
: RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_DUMMY)
{ return; }
virtual ~RsDummySerialiser() { return; }