libept
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ept::debtags::VocabularyIndexer Struct Reference

Infrastructure used to rebuild the vocabulary index when needed. More...

#include <vocabularyindexer.h>

Collaboration diagram for ept::debtags::VocabularyIndexer:
Collaboration graph
[legend]

Public Member Functions

time_t sourceTimestamp () const
 Get the timestamp of the newest vocabulary data source.
bool needsRebuild () const
 Return true if the vocabulary index needs rebuilding.
bool rebuild (const std::string &vocfname, const std::string &idxfname)
 Rebuild the vocabulary index.
bool rebuildIfNeeded ()
 Rebuild the vocabulary if needed.
bool getUpToDateVocabulary (std::string &vocfname, std::string &idxfname)
 Get the names of the merged vocabulary and vocabulary index that can be used to access Debtags vocabulary data.
bool userIndexIsRedundant () const
 Returns true if the index in the user home directory is redundant and can be deleted.
bool deleteRedundantUserIndex ()
 Deletes the user index if it is redundant.
void rescan ()
 Rescan the various timestamps.
 VocabularyIndexer ()

Static Public Member Functions

static bool obtainWorkingVocabulary (std::string &vocfname, std::string &idxfname)
 Get the names of the merged vocabulary and vocabulary index that can be used to access Debtags vocabulary data.

Public Attributes

SourceDir mainSource
SourceDir userSource
time_t ts_main_src
time_t ts_user_src
time_t ts_main_voc
time_t ts_main_idx
time_t ts_user_voc
time_t ts_user_idx

Detailed Description

Infrastructure used to rebuild the vocabulary index when needed.

Constructor & Destructor Documentation

ept::debtags::VocabularyIndexer::VocabularyIndexer ( )

References rescan().

Member Function Documentation

bool ept::debtags::VocabularyIndexer::deleteRedundantUserIndex ( )
bool ept::debtags::VocabularyIndexer::getUpToDateVocabulary ( std::string &  vocfname,
std::string &  idxfname 
)

Get the names of the merged vocabulary and vocabulary index that can be used to access Debtags vocabulary data.

The system or the user index will be returned according to which one is up to date.

References sourceTimestamp(), ts_main_idx, ts_main_voc, ts_user_idx, ts_user_src, ts_user_voc, ept::debtags::Path::userVocabulary(), ept::debtags::Path::userVocabularyIndex(), ept::debtags::Path::vocabulary(), and ept::debtags::Path::vocabularyIndex().

Referenced by obtainWorkingVocabulary().

bool ept::debtags::VocabularyIndexer::needsRebuild ( ) const

Return true if the vocabulary index needs rebuilding.

References sourceTimestamp(), ts_main_idx, ts_main_voc, ts_user_idx, ts_user_src, and ts_user_voc.

Referenced by rebuildIfNeeded().

bool ept::debtags::VocabularyIndexer::obtainWorkingVocabulary ( std::string &  vocfname,
std::string &  idxfname 
)
static

Get the names of the merged vocabulary and vocabulary index that can be used to access Debtags vocabulary data.

The system or the user index will be returned according to which one is up to date.

The files will be built or rebuilt if they are missing or outdated.

References deleteRedundantUserIndex(), getUpToDateVocabulary(), and rebuildIfNeeded().

Referenced by ept::debtags::Vocabulary::Vocabulary().

bool ept::debtags::VocabularyIndexer::rebuild ( const std::string &  vocfname,
const std::string &  idxfname 
)

Rebuild the vocabulary index.

Parameters
vocfnameFull pathname of the merged vocabulary to create
idxfnameFull pathname of the vocabulary index to create

References mainSource, ept::debtags::SourceDir::readVocabularies(), and userSource.

Referenced by rebuildIfNeeded().

bool ept::debtags::VocabularyIndexer::rebuildIfNeeded ( )
void ept::debtags::VocabularyIndexer::rescan ( )
time_t ept::debtags::VocabularyIndexer::sourceTimestamp ( ) const
inline

Get the timestamp of the newest vocabulary data source.

References ts_main_src, and ts_user_src.

Referenced by getUpToDateVocabulary(), needsRebuild(), and userIndexIsRedundant().

bool ept::debtags::VocabularyIndexer::userIndexIsRedundant ( ) const

Returns true if the index in the user home directory is redundant and can be deleted.

The user index is redundant if the system index is up to date.

References sourceTimestamp(), ts_main_idx, ts_main_voc, ts_user_idx, ts_user_src, and ts_user_voc.

Referenced by deleteRedundantUserIndex().

Member Data Documentation

SourceDir ept::debtags::VocabularyIndexer::mainSource

Referenced by rebuild(), and rescan().

time_t ept::debtags::VocabularyIndexer::ts_main_idx
time_t ept::debtags::VocabularyIndexer::ts_main_src

Referenced by rescan(), and sourceTimestamp().

time_t ept::debtags::VocabularyIndexer::ts_main_voc
time_t ept::debtags::VocabularyIndexer::ts_user_idx
time_t ept::debtags::VocabularyIndexer::ts_user_src
time_t ept::debtags::VocabularyIndexer::ts_user_voc
SourceDir ept::debtags::VocabularyIndexer::userSource

Referenced by rebuild(), and rescan().


The documentation for this struct was generated from the following files: