#include <debtags.h>
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.
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. | |
~Debtags () | |
time_t | timestamp () const |
Get the timestamp of when the index was last updated. | |
bool | hasData () const |
Return true if this data source has data, false if it's empty. | |
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. | |
const Vocabulary & | vocabulary () const |
Access the vocabulary in use. | |
PkgId & | pkgid () |
Access the PkgId in use. | |
const PkgId & | pkgid () const |
Access the PkgId in use. | |
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. | |
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. | |
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. | |
void | sendPatch () |
Send to the central archive a patch that can be used to turn the system database into the collection given. | |
void | sendPatch (const tagcoll::PatchList< std::string, std::string > &patch) |
Send the given patch to the central archive. | |
void | sendPatch (const tagcoll::PatchList< std::string, Tag > &patch) |
Send the given patch to the central archive. | |
template<typename OUT> | |
void | outputSystem (const OUT &cons) |
Output the current Debian tags database to a consumer of <std::string, Tag>. | |
template<typename OUT> | |
void | outputSystem (const std::string &filename, const OUT &out) |
Output the given tag file to a consumer of <std::string, Tag>. | |
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>. | |
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>. | |
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 |
Classes | |
class | const_iterator |
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().
ept::debtags::Debtags::~Debtags | ( | ) | [inline] |
std::string ept::debtags::Debtags::packageByID | ( | int | id | ) | const [inline, protected] |
References ept::debtags::PkgId::byID(), and m_pkgid.
Referenced by changes(), ept::debtags::Debtags::const_iterator::operator*(), and packagesById().
std::set<std::string> ept::debtags::Debtags::packagesById | ( | const IDS & | ids | ) | const [inline, protected] |
int ept::debtags::Debtags::idByPackage | ( | const std::string & | pkg | ) | const [inline, protected] |
References ept::debtags::PkgId::byName(), and m_pkgid.
Referenced by applyChange(), getTagsOfItem(), and idsByPackages().
std::set<int> ept::debtags::Debtags::idsByPackages | ( | const PKGS & | pkgs | ) | const [inline, protected] |
const_iterator ept::debtags::Debtags::begin | ( | ) | const [inline] |
References m_coll.
Referenced by TestPkgid::_1(), TestDebtags::_1(), TestPkgid::_2(), and TestDebtags::_5().
const_iterator ept::debtags::Debtags::end | ( | ) | const [inline] |
References m_coll.
Referenced by TestPkgid::_1(), TestDebtags::_1(), TestPkgid::_2(), and TestDebtags::_5().
time_t ept::debtags::Debtags::timestamp | ( | ) | const [inline] |
Get the timestamp of when the index was last updated.
References m_timestamp.
Referenced by TestDebtags::_5().
bool ept::debtags::Debtags::hasData | ( | ) | const [inline] |
Return true if this data source has data, false if it's empty.
References m_timestamp.
Referenced by 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().
bool ept::debtags::Debtags::hasTag | ( | const Tag & | tag | ) | const [inline] |
References ept::debtags::Tag::id(), and m_coll.
std::set<Tag> ept::debtags::Debtags::getTagsOfItem | ( | const std::string & | item | ) | const [inline] |
References idByPackage(), m_coll, ept::debtags::Vocabulary::tagsByID(), and vocabulary().
Referenced by TestDebtags::_2(), TestDebtags::_3(), TestDebtags::_4(), TestDebtags::_5(), and ept::textsearch::DebtagsExtraIndexer::operator()().
std::set<Tag> ept::debtags::Debtags::getTagsOfItems | ( | const ITEMS & | items | ) | const [inline] |
References idsByPackages(), m_coll, ept::debtags::Vocabulary::tagsByID(), and vocabulary().
Referenced by TestDebtags::_5().
std::set<std::string> ept::debtags::Debtags::getItemsHavingTag | ( | const Tag & | tag | ) | const [inline] |
References ept::debtags::Tag::id(), m_coll, and packagesById().
std::set<std::string> ept::debtags::Debtags::getItemsHavingTags | ( | const TAGS & | tags | ) | const [inline] |
std::set<Tag> ept::debtags::Debtags::getAllTags | ( | ) | const [inline] |
References m_coll, ept::debtags::Vocabulary::tagsByID(), and vocabulary().
Referenced by TestDebtags::_5().
Vocabulary& ept::debtags::Debtags::vocabulary | ( | ) | [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().
const Vocabulary& ept::debtags::Debtags::vocabulary | ( | ) | const [inline] |
PkgId& ept::debtags::Debtags::pkgid | ( | ) | [inline] |
const PkgId& ept::debtags::Debtags::pkgid | ( | ) | const [inline] |
int ept::debtags::Debtags::getCardinality | ( | const Tag & | tag | ) | const [inline] |
References ept::debtags::Tag::id(), and m_coll.
void ept::debtags::Debtags::applyChange | ( | const tagcoll::PatchList< std::string, Tag > & | change | ) | [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().
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.
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.
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().
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.
void ept::debtags::Debtags::outputSystem | ( | const OUT & | cons | ) | [inline] |
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 | |||
) | [inline] |
Output the given tag file to a consumer of <std::string, Tag>.
void ept::debtags::Debtags::outputPatched | ( | const OUT & | cons | ) | [inline] |
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 | |||
) | [inline] |
Output the given tag file, patched with local patch, to a Consumer of <std::string, Tag>.
tagcoll::diskindex::MasterMMap ept::debtags::Debtags::mastermmap [protected] |
Referenced by Debtags().
tagcoll::coll::IntDiskIndex ept::debtags::Debtags::m_rocoll [protected] |
Referenced by Debtags(), and outputSystem().
tagcoll::coll::Patched< tagcoll::coll::IntDiskIndex > ept::debtags::Debtags::m_coll [protected] |
Referenced by applyChange(), begin(), changes(), Debtags(), end(), getAllTags(), getCardinality(), getItemsHavingTag(), getItemsHavingTags(), getTagsOfItem(), getTagsOfItems(), hasTag(), outputPatched(), savePatch(), sendPatch(), and tagdb().
PkgId ept::debtags::Debtags::m_pkgid [protected] |
Referenced by Debtags(), idByPackage(), outputPatched(), outputSystem(), packageByID(), pkgid(), savePatch(), and sendPatch().
Vocabulary ept::debtags::Debtags::m_voc [protected] |
Referenced by vocabulary().
std::string ept::debtags::Debtags::rcdir [protected] |
Referenced by Debtags().
time_t ept::debtags::Debtags::m_timestamp [protected] |
Referenced by Debtags(), hasData(), and timestamp().