mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-27 18:12:21 -04:00
* Refinement of new Cache Interface:
- Defined expected parameters for GxsGroups (see comments in rsidentity.h) - Added Various #defines for Groups / Msgs (again in rsidentity.h) - Converted new Group / new Msg into async "token" calls, returing MetaData. - Refined Grp/Msg Status Flags... similarly to how Forums used them... Expect UNREAD & UNPROCESSED flags to be set for a new msg, and UPDATED flag to be set for the corresponding group. There is flexibility for services to add their own flags too. - removed groupsChanged(). This can alternatively be implemented using. getGroupList(opts.Status == UPDATED)... - refined SubscribeFlags in a similar manner. - Added "ServiceString" to Group/Msg MetaData. This is freeform cache storage for service to use... currently p3Posted uses it to count Votes. - Added MsgStatus & SubscribeFlag filtering to Cache Requests. - Implemented these filters in GxsDataProxy (no efficient yet!) * Cleaned up all 6 new Cache Services to conform to new interface. * Removed old interface code that was #ifdef'd out. * Implemented Basic Ranking algorithms for p3posted: - Background process to process new votes/comments. - getRanking(token) interface call. - Intercept StatusRequests, etc to hide internal data requests. - While the basic code is complete, it needs much testing / tweaking. - Should shift work to a seperate thread. - Comment Ranking has still to be done. - Interfacing with GUI not yet attempted. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5276 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
081b59ee1a
commit
8387c538f1
20 changed files with 1793 additions and 514 deletions
|
@ -347,23 +347,31 @@ bool p3Wire::cancelRequest(const uint32_t &token)
|
|||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/* Functions from Forums -> need to be implemented generically */
|
||||
bool p3Wire::groupsChanged(std::list<std::string> &groupIds)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get Message Status - is retrived via MessageSummary.
|
||||
bool p3Wire::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
|
||||
{
|
||||
return false;
|
||||
return mWireProxy->setMessageStatus(msgId, status, statusMask);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
bool p3Wire::groupSubscribe(const std::string &groupId, bool subscribe)
|
||||
bool p3Wire::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
|
||||
{
|
||||
return false;
|
||||
return mWireProxy->setGroupStatus(groupId, status, statusMask);
|
||||
}
|
||||
|
||||
bool p3Wire::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
|
||||
{
|
||||
return mWireProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
|
||||
}
|
||||
|
||||
bool p3Wire::setMessageServiceString(const std::string &msgId, const std::string &str)
|
||||
{
|
||||
return mWireProxy->setMessageServiceString(msgId, str);
|
||||
}
|
||||
|
||||
bool p3Wire::setGroupServiceString(const std::string &grpId, const std::string &str)
|
||||
{
|
||||
return mWireProxy->setGroupServiceString(grpId, str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -392,7 +400,8 @@ std::string p3Wire::genRandomId()
|
|||
return randomId;
|
||||
}
|
||||
|
||||
bool p3Wire::createGroup(RsWireGroup &group)
|
||||
|
||||
bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
|
||||
{
|
||||
if (group.mMeta.mGroupId.empty())
|
||||
{
|
||||
|
@ -407,20 +416,31 @@ bool p3Wire::createGroup(RsWireGroup &group)
|
|||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
mUpdated = true;
|
||||
mWireProxy->addGroup(group);
|
||||
}
|
||||
|
||||
// Fake a request to return the GroupMetaData.
|
||||
generateToken(token);
|
||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
||||
RsTokReqOptions opts; // NULL is good.
|
||||
std::list<std::string> groupIds;
|
||||
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
|
||||
|
||||
std::cerr << "p3Wiree::createGroup() Generating Request Token: " << token << std::endl;
|
||||
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
|
||||
|
||||
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
mUpdated = true;
|
||||
|
||||
mWireProxy->addGroup(group);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool p3Wire::createPulse(RsWirePulse &pulse)
|
||||
bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
|
||||
{
|
||||
if (pulse.mMeta.mGroupId.empty())
|
||||
{
|
||||
|
@ -456,11 +476,22 @@ bool p3Wire::createPulse(RsWirePulse &pulse)
|
|||
std::cerr << "p3Wire::createPulse() OrigPulseId: " << pulse.mMeta.mOrigMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
|
||||
{
|
||||
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
mUpdated = true;
|
||||
|
||||
mWireProxy->addPulse(pulse);
|
||||
mUpdated = true;
|
||||
mWireProxy->addPulse(pulse);
|
||||
}
|
||||
|
||||
// Fake a request to return the MsgMetaData.
|
||||
generateToken(token);
|
||||
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
|
||||
RsTokReqOptions opts; // NULL is good.
|
||||
std::list<std::string> msgIds;
|
||||
msgIds.push_back(pulse.mMeta.mMsgId); // It will just return this one.
|
||||
|
||||
std::cerr << "p3Wire::createPulse() Generating Request Token: " << token << std::endl;
|
||||
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue