本文整理汇总了C++中Index::PreFetch方法的典型用法代码示例。如果您正苦于以下问题:C++ Index::PreFetch方法的具体用法?C++ Index::PreFetch怎么用?C++ Index::PreFetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::PreFetch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddIndex
OP_STATUS IntersectionIndexGroup::AddIndex(index_gid_t index_id)
{
if (m_indexes.Contains(index_id))
return OpStatus::OK;
Index* index = m_indexer->GetIndexById(index_id);
if (index)
{
RETURN_IF_ERROR(index->PreFetch());
OpINT32Vector all_messages;
RETURN_IF_ERROR(m_index->GetAllMessages(all_messages));
for (UINT32 i = 0; i < all_messages.GetCount(); i++)
{
if (!index->Contains(all_messages.Get(i)))
{
RETURN_IF_ERROR(m_index->RemoveMessage(all_messages.Get(i)));
}
}
RETURN_IF_ERROR(m_indexes.Insert(index_id));
RETURN_IF_ERROR(index->AddObserver(this));
}
return OpStatus::OK;
}
示例2: GhostBuster
/***********************************************************************************
**
** MailRecovery::GhostBuster
***********************************************************************************/
OP_STATUS MailRecovery::GhostBuster()
{
Store* store = g_m2_engine->GetStore();
// we can only run this if we have loaded all messages!
if (!store->HasFinishedLoading())
return OpStatus::OK;
OpString8 indexes_with_ghosts;
OpStringC8 log_heading("Ghostbuster");
OpStatus::Ignore(DesktopFileLogger::Log(m_recovery_log,log_heading,"Started"));
INT32 num_ghosts = 0;
Index* current;
// go through all indexes
for (INT32 it = -1; (current = g_m2_engine->GetIndexer()->GetRange(0, IndexTypes::LAST, it)) != NULL; )
{
OpINT32Vector message_ids;
if (OpStatus::IsError(current->PreFetch()) || OpStatus::IsError(current->GetAllMessages(message_ids)))
continue;
// go through all messages in all indexes
for (UINT32 nb = 0; nb < message_ids.GetCount(); nb++)
{
INT32 message_id = message_ids.Get(nb);
// check if the message really exists in store
if (!store->MessageAvailable(message_id))
{
// we have a ghost, a message that doesn't exist in store, but exists in an index
current->RemoveMessage(message_id);
num_ghosts++;
indexes_with_ghosts.AppendFormat(" %d",current->GetId());
}
}
}
OpStatus::Ignore(store->CommitData());
OpString8 log_text;
OpStatus::Ignore(log_text.AppendFormat("Finished: Deleted %d ghosts from the following indexes:%s", num_ghosts, indexes_with_ghosts.CStr()));
OpStatus::Ignore(DesktopFileLogger::Log(m_recovery_log,log_heading,log_text));
return OpStatus::OK;
}