ept::debtags::Debtags Class Reference

Access the on-disk Debtags tag database. More...

#include <debtags.h>

Collaboration diagram for ept::debtags::Debtags:

Collaboration graph
[legend]

List of all members.

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.
 ~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_typetagdb ()
const coll_typetagdb () const
tagcoll::PatchList
< std::string, Tag
changes () const
bool hasTag (const Tag &tag) const
std::set< TaggetTagsOfItem (const std::string &item) const
template<typename ITEMS >
std::set< TaggetTagsOfItems (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< TaggetAllTags () const
Vocabularyvocabulary ()
 Access the vocabulary in use.
const Vocabularyvocabulary () const
 Access the vocabulary in use.
PkgIdpkgid ()
 Access the PkgId in use.
const PkgIdpkgid () 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


Detailed Description

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.


Member Typedef Documentation

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


Constructor & Destructor Documentation

ept::debtags::Debtags::Debtags ( bool  editable = false  ) 

Create a new accessor for the on-disk Debtags database.

Parameters:
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, timestamp(), and vocabulary().

ept::debtags::Debtags::~Debtags (  )  [inline]


Member Function Documentation

void ept::debtags::Debtags::applyChange ( const tagcoll::PatchList< std::string, Tag > &  change  )  [inline]

References idByPackage(), and m_coll.

Referenced by TestDebtags::_4().

const_iterator ept::debtags::Debtags::begin (  )  const [inline]

tagcoll::PatchList< std::string, Tag > ept::debtags::Debtags::changes (  )  const

References m_coll, packageByID(), and vocabulary().

Referenced by TestDebtags::_4(), and TestDebtags::_5().

const_iterator ept::debtags::Debtags::end (  )  const [inline]

std::set<Tag> ept::debtags::Debtags::getAllTags (  )  const [inline]

int ept::debtags::Debtags::getCardinality ( const Tag tag  )  const [inline]

References ept::debtags::Tag::id(), and m_coll.

std::set<std::string> ept::debtags::Debtags::getItemsHavingTag ( const Tag tag  )  const [inline]

template<typename TAGS >
std::set<std::string> ept::debtags::Debtags::getItemsHavingTags ( const TAGS &  tags  )  const [inline]

References m_coll, and packagesById().

Referenced by TestDebtags::_3().

std::set<Tag> ept::debtags::Debtags::getTagsOfItem ( const std::string &  item  )  const [inline]

template<typename ITEMS >
std::set<Tag> ept::debtags::Debtags::getTagsOfItems ( const ITEMS &  items  )  const [inline]

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().

bool ept::debtags::Debtags::hasTag ( const Tag tag  )  const [inline]

References ept::debtags::Tag::id(), and m_coll.

int ept::debtags::Debtags::idByPackage ( const std::string &  pkg  )  const [inline, protected]

template<typename PKGS >
std::set<int> ept::debtags::Debtags::idsByPackages ( const PKGS &  pkgs  )  const [inline, protected]

References idByPackage().

Referenced by getTagsOfItems().

template<typename OUT >
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>.

Note:
The collection is sent to 'cons' without merging repeated items

template<typename OUT >
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>.

Note:
The collection is sent to 'cons' without merging repeated items

References ept::debtags::intToPkg(), m_coll, m_pkgid, and vocabulary().

Referenced by TestDebtags::_1(), and TestDebtags::_5().

template<typename OUT >
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>.

Note:
The collection is sent to 'cons' without merging repeated items

template<typename OUT >
void ept::debtags::Debtags::outputSystem ( const OUT &  cons  )  [inline]

Output the current Debian tags database to a consumer of <std::string, Tag>.

Note:
The collection is sent to 'cons' without merging repeated items

References ept::debtags::intToPkg(), m_pkgid, m_rocoll, and vocabulary().

Referenced by TestDebtags::_1(), and TestDebtags::_5().

std::string ept::debtags::Debtags::packageByID ( int  id  )  const [inline, protected]

template<typename IDS >
std::set<std::string> ept::debtags::Debtags::packagesById ( const IDS &  ids  )  const [inline, protected]

References packageByID().

Referenced by getItemsHavingTag(), and getItemsHavingTags().

const PkgId& ept::debtags::Debtags::pkgid (  )  const [inline]

Access the PkgId in use.

Note:
Future implementations may not rely on a PkgId

References m_pkgid.

PkgId& ept::debtags::Debtags::pkgid (  )  [inline]

Access the PkgId in use.

Note:
Future implementations may not rely on a PkgId

References m_pkgid.

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::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 (  ) 

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::sendPatch ( const tagcoll::PatchList< std::string, Tag > &  patch  ) 

Send the given patch to the central archive.

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 (  ) 

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().

const coll_type& ept::debtags::Debtags::tagdb (  )  const [inline]

References m_coll.

coll_type& ept::debtags::Debtags::tagdb (  )  [inline]

References m_coll.

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(), and Debtags().

const Vocabulary& ept::debtags::Debtags::vocabulary (  )  const [inline]

Access the vocabulary in use.

References m_voc.

Vocabulary& ept::debtags::Debtags::vocabulary (  )  [inline]


Member Data Documentation

tagcoll::coll::Patched< tagcoll::coll::IntDiskIndex > ept::debtags::Debtags::m_coll [protected]

tagcoll::coll::IntDiskIndex ept::debtags::Debtags::m_rocoll [protected]

Referenced by Debtags(), and outputSystem().

Referenced by Debtags(), hasData(), and timestamp().

Referenced by vocabulary().

tagcoll::diskindex::MasterMMap ept::debtags::Debtags::mastermmap [protected]

Referenced by Debtags().

std::string ept::debtags::Debtags::rcdir [protected]

Referenced by Debtags().


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

Generated on Tue Feb 10 11:36:51 2009 for libept by  doxygen 1.5.8