libept
0.5.25
|
Access the on-disk Debtags tag database. More...
#include <debtags.h>
Classes | |
class | const_iterator |
Public Types | |
typedef tagcoll::coll::Patched < tagcoll::coll::IntDiskIndex > | coll_type |
typedef std::pair< std::string, std::set< Tag > > | value_type |
Public Member Functions | |
const_iterator | begin () const |
const_iterator | end () const |
Debtags (bool editable=false) | |
Create a new accessor for the on-disk Debtags database. More... | |
~Debtags () | |
time_t | timestamp () const |
Get the timestamp of when the index was last updated. More... | |
bool | hasData () const |
Return true if this data source has data, false if it's empty. More... | |
coll_type & | tagdb () |
const coll_type & | tagdb () const |
tagcoll::PatchList < std::string, Tag > | changes () const |
bool | hasTag (const Tag &tag) const |
std::set< Tag > | getTagsOfItem (const std::string &item) const |
template<typename ITEMS > | |
std::set< Tag > | getTagsOfItems (const ITEMS &items) const |
std::set< std::string > | getItemsHavingTag (const Tag &tag) const |
template<typename TAGS > | |
std::set< std::string > | getItemsHavingTags (const TAGS &tags) const |
std::set< Tag > | getAllTags () const |
Vocabulary & | vocabulary () |
Access the vocabulary in use. More... | |
const Vocabulary & | vocabulary () const |
Access the vocabulary in use. More... | |
PkgId & | pkgid () |
Access the PkgId in use. More... | |
const PkgId & | pkgid () const |
Access the PkgId in use. More... | |
int | getCardinality (const Tag &tag) const |
void | applyChange (const tagcoll::PatchList< std::string, Tag > &change) |
void | savePatch () |
Check if the tag database has been created (i.e. More... | |
void | savePatch (const tagcoll::PatchList< std::string, std::string > &patch) |
Save in the state storage directory a patch to turn the system database into the collection given. More... | |
void | savePatch (const tagcoll::PatchList< std::string, Tag > &patch) |
Save in the state storage directory a patch to turn the system database into the collection given. More... | |
void | sendPatch () |
Send to the central archive a patch that can be used to turn the system database into the collection given. More... | |
void | sendPatch (const tagcoll::PatchList< std::string, std::string > &patch) |
Send the given patch to the central archive. More... | |
void | sendPatch (const tagcoll::PatchList< std::string, Tag > &patch) |
Send the given patch to the central archive. More... | |
template<typename OUT > | |
void | outputSystem (const OUT &cons) |
Output the current Debian tags database to a consumer of <std::string, Tag> More... | |
template<typename OUT > | |
void | outputSystem (const std::string &filename, const OUT &out) |
Output the given tag file to a consumer of <std::string, Tag> More... | |
template<typename OUT > | |
void | outputPatched (const OUT &cons) |
Output the current Debian tags database, patched with local patch, to a Consumer of <std::string, Tag> More... | |
template<typename OUT > | |
void | outputPatched (const std::string &filename, const OUT &out) |
Output the given tag file, patched with local patch, to a Consumer of <std::string, Tag> More... | |
Protected Member Functions | |
std::string | packageByID (int id) const |
template<typename IDS > | |
std::set< std::string > | packagesById (const IDS &ids) const |
int | idByPackage (const std::string &pkg) const |
template<typename PKGS > | |
std::set< int > | idsByPackages (const PKGS &pkgs) const |
Protected Attributes | |
tagcoll::diskindex::MasterMMap | mastermmap |
tagcoll::coll::IntDiskIndex | m_rocoll |
tagcoll::coll::Patched < tagcoll::coll::IntDiskIndex > | m_coll |
PkgId | m_pkgid |
Vocabulary | m_voc |
std::string | rcdir |
time_t | m_timestamp |
Access the on-disk Debtags tag database.
The database is normally found in /var/lib/debtags.
Tags and Facets are returned as Tag and Facet objects. The objects follow the flyweight pattern and access the data contained in the Vocabulary instantiated inside Debtags.
It is possible to get a reference to the Vocabulary object using the vocabulary() method.
typedef tagcoll::coll::Patched< tagcoll::coll::IntDiskIndex > ept::debtags::Debtags::coll_type |
typedef std::pair< std::string, std::set<Tag> > ept::debtags::Debtags::value_type |
ept::debtags::Debtags::Debtags | ( | bool | editable = false | ) |
Create a new accessor for the on-disk Debtags database.
editable | Specifies if recording of modifications should be enabled. If editable is true, then the local state directory will be created when the object is instantiated. |
References ept::debtags::Path::access(), ept::debtags::Path::debtagsUserSourceDir(), m_coll, m_pkgid, m_rocoll, m_timestamp, mastermmap, ept::debtags::DebtagsIndexer::obtainWorkingDebtags(), ept::debtags::patchStringToInt(), rcdir, ept::debtags::Path::timestamp(), and vocabulary().
|
inline |
|
inline |
References idByPackage().
Referenced by TestDebtags::_4().
|
inline |
Referenced by TestPkgid::_1(), TestDebtags::_1(), TestPkgid::_2(), and TestDebtags::_5().
tagcoll::PatchList< std::string, Tag > ept::debtags::Debtags::changes | ( | ) | const |
References m_coll, packageByID(), and vocabulary().
Referenced by TestDebtags::_4(), and TestDebtags::_5().
|
inline |
Referenced by TestPkgid::_1(), TestDebtags::_1(), TestPkgid::_2(), and TestDebtags::_5().
|
inline |
References ept::debtags::Vocabulary::tagsByID(), and vocabulary().
Referenced by TestDebtags::_5().
|
inline |
References ept::debtags::Tag::id().
|
inline |
References ept::debtags::Tag::id(), and packagesById().
|
inline |
References packagesById().
Referenced by TestDebtags::_3().
|
inline |
References idByPackage(), ept::debtags::Vocabulary::tagsByID(), and vocabulary().
Referenced by TestDebtags::_2(), TestDebtags::_3(), TestDebtags::_4(), and TestDebtags::_5().
|
inline |
References idsByPackages(), ept::debtags::Vocabulary::tagsByID(), and vocabulary().
Referenced by TestDebtags::_5().
|
inline |
Return true if this data source has data, false if it's empty.
Referenced by TestDebtags::_5().
|
inline |
References ept::debtags::Tag::id().
|
inlineprotected |
References ept::debtags::PkgId::byName().
Referenced by applyChange(), getTagsOfItem(), and idsByPackages().
|
inlineprotected |
References idByPackage().
Referenced by getTagsOfItems().
void ept::debtags::Debtags::outputPatched | ( | const OUT & | cons | ) |
Output the current Debian tags database, patched with local patch, to a Consumer of <std::string, Tag>
References ept::debtags::intToPkg(), m_coll, m_pkgid, and vocabulary().
Referenced by TestDebtags::_1(), and TestDebtags::_5().
void ept::debtags::Debtags::outputPatched | ( | const std::string & | filename, |
const OUT & | out | ||
) |
Output the given tag file, patched with local patch, to a Consumer of <std::string, Tag>
void ept::debtags::Debtags::outputSystem | ( | const OUT & | cons | ) |
Output the current Debian tags database to a consumer of <std::string, Tag>
References ept::debtags::intToPkg(), m_pkgid, m_rocoll, and vocabulary().
Referenced by TestDebtags::_1(), and TestDebtags::_5().
void ept::debtags::Debtags::outputSystem | ( | const std::string & | filename, |
const OUT & | out | ||
) |
Output the given tag file to a consumer of <std::string, Tag>
|
inlineprotected |
References ept::debtags::PkgId::byID().
Referenced by changes(), ept::debtags::Debtags::const_iterator::operator*(), and packagesById().
|
inlineprotected |
References packageByID().
Referenced by getItemsHavingTag(), and getItemsHavingTags().
|
inline |
|
inline |
void ept::debtags::Debtags::savePatch | ( | ) |
Check if the tag database has been created (i.e.
if something equivalend to debtags update has been run) Save in the state storage directory a patch that can be used to turn the system database into the collection given
References m_coll, m_pkgid, ept::debtags::patchIntToString(), and vocabulary().
Referenced by TestDebtags::_4(), and savePatch().
void ept::debtags::Debtags::savePatch | ( | const tagcoll::PatchList< std::string, std::string > & | patch | ) |
Save in the state storage directory a patch to turn the system database into the collection given.
References rcdir.
void ept::debtags::Debtags::savePatch | ( | const tagcoll::PatchList< std::string, Tag > & | patch | ) |
Save in the state storage directory a patch to turn the system database into the collection given.
References savePatch().
void ept::debtags::Debtags::sendPatch | ( | ) |
Send to the central archive a patch that can be used to turn the system database into the collection given.
References m_coll, m_pkgid, ept::debtags::patchIntToString(), and vocabulary().
Referenced by sendPatch().
void ept::debtags::Debtags::sendPatch | ( | const tagcoll::PatchList< std::string, std::string > & | patch | ) |
Send the given patch to the central archive.
void ept::debtags::Debtags::sendPatch | ( | const tagcoll::PatchList< std::string, Tag > & | patch | ) |
Send the given patch to the central archive.
References sendPatch().
|
inline |
Get the timestamp of when the index was last updated.
References m_timestamp.
Referenced by TestDebtags::_5().
|
inline |
Access the vocabulary in use.
References m_voc.
Referenced by changes(), Debtags(), getAllTags(), getTagsOfItem(), getTagsOfItems(), ept::debtags::Debtags::const_iterator::operator*(), outputPatched(), outputSystem(), savePatch(), sendPatch(), and TestDebtags::voc().
|
inline |
Access the vocabulary in use.
References m_voc.
|
protected |
Referenced by changes(), Debtags(), outputPatched(), savePatch(), sendPatch(), and tagdb().
|
protected |
Referenced by Debtags(), outputPatched(), outputSystem(), pkgid(), savePatch(), and sendPatch().
|
protected |
Referenced by Debtags(), and outputSystem().
|
protected |
Referenced by Debtags(), and timestamp().
|
protected |
Referenced by vocabulary().
|
protected |
Referenced by Debtags().
|
protected |
Referenced by Debtags(), and savePatch().