libept  0.5.25
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ept::debtags::Debtags Class Reference

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

#include <debtags.h>

Inheritance diagram for ept::debtags::Debtags:
Inheritance graph
[legend]
Collaboration diagram for ept::debtags::Debtags:
Collaboration graph
[legend]

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_typetagdb ()
 
const coll_typetagdb () const
 
tagcoll::PatchList< std::string, Tagchanges () 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. More...
 
const Vocabularyvocabulary () const
 Access the vocabulary in use. More...
 
PkgIdpkgid ()
 Access the PkgId in use. More...
 
const PkgIdpkgid () 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
 

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
editableSpecifies 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

Member Function Documentation

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

Referenced by TestDebtags::_4().

const_iterator ept::debtags::Debtags::begin ( ) const
inline
tagcoll::PatchList< std::string, Tag > ept::debtags::Debtags::changes ( ) const
const_iterator ept::debtags::Debtags::end ( ) const
inline
std::set<Tag> ept::debtags::Debtags::getAllTags ( ) const
inline

Referenced by TestDebtags::_5().

int ept::debtags::Debtags::getCardinality ( const Tag tag) const
inline
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

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

Referenced by TestDebtags::_5().

bool ept::debtags::Debtags::hasData ( ) const
inline

Return true if this data source has data, false if it's empty.

Referenced by TestDebtags::_5().

bool ept::debtags::Debtags::hasTag ( const Tag tag) const
inline
int ept::debtags::Debtags::idByPackage ( const std::string &  pkg) const
inlineprotected
template<typename PKGS >
std::set<int> ept::debtags::Debtags::idsByPackages ( const PKGS &  pkgs) const
inlineprotected
template<typename OUT >
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>

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::outputPatched ( const std::string &  filename,
const OUT &  out 
)

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::outputSystem ( const OUT &  cons)

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

template<typename OUT >
void ept::debtags::Debtags::outputSystem ( const std::string &  filename,
const OUT &  out 
)

Output the given tag file to a consumer of <std::string, Tag>

Note
The collection is sent to 'cons' without merging repeated items
std::string ept::debtags::Debtags::packageByID ( int  id) const
inlineprotected
template<typename IDS >
std::set<std::string> ept::debtags::Debtags::packagesById ( const IDS &  ids) const
inlineprotected
PkgId& ept::debtags::Debtags::pkgid ( )
inline

Access the PkgId in use.

Note
Future implementations may not rely on a PkgId
const PkgId& ept::debtags::Debtags::pkgid ( ) const
inline

Access the PkgId in use.

Note
Future implementations may not rely on a PkgId
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().

coll_type& ept::debtags::Debtags::tagdb ( )
inline
const coll_type& ept::debtags::Debtags::tagdb ( ) const
inline
time_t ept::debtags::Debtags::timestamp ( ) const
inline

Get the timestamp of when the index was last updated.

Referenced by TestDebtags::_5().

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

Access the vocabulary in use.

Member Data Documentation

tagcoll::coll::Patched< tagcoll::coll::IntDiskIndex > ept::debtags::Debtags::m_coll
protected
PkgId ept::debtags::Debtags::m_pkgid
protected
tagcoll::coll::IntDiskIndex ept::debtags::Debtags::m_rocoll
protected

Referenced by Debtags(), and outputSystem().

time_t ept::debtags::Debtags::m_timestamp
protected

Referenced by Debtags().

Vocabulary ept::debtags::Debtags::m_voc
protected
tagcoll::diskindex::MasterMMap ept::debtags::Debtags::mastermmap
protected

Referenced by Debtags().

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

Referenced by Debtags(), and savePatch().


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