本文整理汇总了C++中CDatabase::flushUpdates方法的典型用法代码示例。如果您正苦于以下问题:C++ CDatabase::flushUpdates方法的具体用法?C++ CDatabase::flushUpdates怎么用?C++ CDatabase::flushUpdates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDatabase
的用法示例。
在下文中一共展示了CDatabase::flushUpdates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Update manager
*/
bool CDbManager::update()
{
H_AUTO(PDS_DbManager_update);
CHECK_DB_MGR_INIT(update, false);
// update stamp
CTableBuffer::updateCommonStamp();
TDatabaseMap::iterator it;
CDatabase::checkUpdateRates();
// check evently if database need to write some delta
TTime tm = CTime::getLocalTime();
if (tm >= _NextTimeDelta)
{
CTimestamp starttime = _LastUpdateTime;
CTimestamp endtime;
endtime.setToCurrent();
std::vector<uint32> ack;
for (it=_DatabaseMap.begin(); it!=_DatabaseMap.end(); ++it)
{
CDatabase* database = (*it).second;
// generate deltas
if (!database->buildDelta(starttime, endtime))
nlwarning("failed to build delta for database '%d' '%s'", (*it).first, database->getName().c_str());
// obsolete? since RBS build references and tells PDS of success/failure
database->checkReferenceChange();
// acknowledge last updates
database->flushUpdates(ack);
if (!ack.empty() && database->getMappedService().get() != 0xffff)
{
CMessage msgack("PD_ACK_UPD");
uint32 databaseId = (*it).first;
msgack.serial(databaseId);
msgack.serialCont(ack);
CUnifiedNetwork::getInstance()->send(database->getMappedService(), msgack);
}
}
_NextTimeDelta = tm - (tm%(DeltaUpdateRate*1000)) + (DeltaUpdateRate*1000);
_LastUpdateTime = endtime;
}
CTimestamp ts;
ts.setToCurrent();
// check databases require some delta packing/reference generation
for (it=_DatabaseMap.begin(); it!=_DatabaseMap.end(); ++it)
{
CDatabase* database = (*it).second;
database->sendBuildCommands(ts);
}
// send messages to RBS if ready
while (_RBSUp && !_RBSMessages.empty())
{
CUnifiedNetwork::getInstance()->send("RBS", *(_RBSMessages.front()));
delete _RBSMessages.front();
_RBSMessages.pop_front();
}
return true;
}