Forums expose API to request syncronization

This commit is contained in:
Gioacchino Mazzurco 2021-03-22 17:46:46 +01:00
parent fc404bd5d8
commit ebbd8cf938
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
3 changed files with 19 additions and 0 deletions

View File

@ -450,6 +450,17 @@ public:
const std::string& matchString,
std::vector<RsGxsSearchResult>& searchResults ) = 0;
/**
* @brief Request Synchronization with available peers
* Usually syncronization already happen automatically so be carefull
* to call this method only if necessary.
* It has been thinked for use cases like mobile phone where internet
* connection is intermittent and calling this may be useful when a system
* event about connection being available or about to go offline is received
* @jsonapi{development}
* @return Success or error details
*/
virtual std::error_condition requestSynchronization() = 0;
////////////////////////////////////////////////////////////////////////////
/* Following functions are deprecated and should not be considered a stable

View File

@ -1159,6 +1159,12 @@ std::error_condition p3GxsForums::setPostKeepForever(
}
}
std::error_condition p3GxsForums::requestSynchronization()
{
RsGenExchange::netService()->pullFromPeers();
return RsGenExchange::netService()->requestPull();
}
/* so we need the same tick idea as wiki for generating dummy forums
*/

View File

@ -175,6 +175,8 @@ public:
rs_owner_ptr<uint8_t>& resultData, uint32_t& resultSize ) override;
#endif
std::error_condition requestSynchronization() override;
/// implementation of rsGxsGorums
///
bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) override;