zypp::cache::CacheStore Class Reference

The cache store caches resolvable data. More...

#include <CacheStore.h>

Inheritance diagram for zypp::cache::CacheStore:
[legend]

List of all members.

Public Member Functions

 CacheStore ()
virtual ~CacheStore ()
 CacheStore (const Pathname &dbdir)
 Constructor for the CacheStore.
void commit ()
 Commit the changes.
data::RecordId appendResolvable (const data::RecordId &repository_id, const Resolvable::Kind &kind, const NVRA &nvra, const data::Dependencies &deps)
 Appends a resolvable to the store.
data::RecordId appendResolvable (const data::RecordId &repository_id, const Resolvable::Kind &kind, const NVRA &nvra, const data::Dependencies &deps, const data::RecordId &shared_id)
void appendDependencies (const data::RecordId &resolvable_id, const data::Dependencies &dependencies)
 Adds dependencies to the store.
void appendDependencyList (const data::RecordId &resolvable_id, zypp::Dep deptype, const data::DependencyList &dlist)
 Adds dependencies to the store.
void appendDependency (const data::RecordId &resolvable_id, zypp::Dep deptype, capability::CapabilityImpl::Ptr cap)
 Adds a dependency to the store.
void appendNamedDependency (const data::RecordId &, zypp::Dep, capability::NamedCap::Ptr)
 Adds a Named dependency to the store.
void appendFileDependency (const data::RecordId &, zypp::Dep, capability::FileCap::Ptr)
 Adds a file dependency to the store.
void appendModaliasDependency (const data::RecordId &resolvable_id, zypp::Dep deptype, capability::ModaliasCap::Ptr cap)
 Adds a Modalias dependency to the store.
void appendHalDependency (const data::RecordId &resolvable_id, zypp::Dep deptype, capability::HalCap::Ptr cap)
 Adds a Hal dependency to the store.
void appendFilesystemDependency (const data::RecordId &resolvable_id, zypp::Dep deptype, capability::FilesystemCap::Ptr cap)
 Adds a Filesystem dependency to the store.
void appendSplitDependency (const data::RecordId &resolvable_id, zypp::Dep deptype, capability::SplitCap::Ptr cap)
 Adds a split dependency to the store.
void appendUnknownDependency (const data::RecordId &resolvable_id, zypp::Dep deptype, capability::CapabilityImpl::Ptr cap)
 Adds a unknown dependency to the store.
data::RecordId appendPatchRpm (const data::RecordId &repo_id, const data::PatchRpm_Ptr &prpm)
 Insert patch RPM data into patch_packages table.
data::RecordId appendDeltaRpm (const data::RecordId &repo_id, const data::DeltaRpm_Ptr &drpm)
 Insert delta RPM data into delta_packages table.
data::RecordId lookupOrAppendType (const std::string &klass, const std::string &name)
 Returns the record id of a type.
data::RecordId lookupOrAppendType (const Attribute &attr)
data::RecordId lookupOrAppendRepository (const std::string &alias)
 Returns the record id of a repository (Source).
void setSharedData (const data::RecordId &resolvable_id, const data::RecordId &shared_id)
 Set the resolvable shared data flag pointing to another resolvable.
void appendNumericAttribute (const data::RecordId &resolvable_id, const std::string &klass, const std::string &name, int value)
 Append a numeric attribute to a resolvable.
void appendNumericAttribute (const data::RecordId &resolvable_id, const Attribute &attr, int value)
void appendTranslatedStringAttribute (const data::RecordId &resolvable_id, const std::string &klass, const std::string &name, const TranslatedText &text)
 Append a translated string value to a resolvable.
void appendTranslatedStringAttribute (const data::RecordId &resolvable_id, const Attribute &attr, const TranslatedText &text)
void appendStringAttributeTranslation (const data::RecordId &resolvable_id, const Locale &locale, const std::string &klass, const std::string &name, const std::string &text)
 Append a string value to a resolvable.
void appendStringAttributeTranslation (const data::RecordId &resolvable_id, const Locale &locale, const Attribute &attr, const std::string &text)
void appendStringAttribute (const data::RecordId &resolvable_id, const std::string &klass, const std::string &name, const std::string &value)
 Append a string value to a resolvable.
void appendStringAttribute (const data::RecordId &resolvable_id, const Attribute &attr, const std::string &value)
void appendStringAttribute (const data::RecordId &resolvable_id, const data::RecordId &type_id, const std::string &value)
 Append a string value to a resolvable.
template<class _Iterator>
void appendStringContainerAttribute (const data::RecordId &resolvable_id, const std::string &klass, const std::string &name, _Iterator begin, _Iterator end)
 Append strings from _Iterator to a resolvable.
template<class _Iterator>
void appendStringContainerAttribute (const data::RecordId &resolvable_id, const Attribute &attr, _Iterator begin, _Iterator end)
template<class _Container>
void appendStringContainerAttribute (const data::RecordId &resolvable_id, const std::string &klass, const std::string &name, const _Container &container)
 Append strings from a _Container to a resolvable.
template<class _Container>
void appendStringContainerAttribute (const data::RecordId &resolvable_id, const Attribute &attr, const _Container &container)
void updateRepositoryStatus (const data::RecordId &id, const RepoStatus &status)
 Update a known repository checksum and timestamp.
void cleanRepository (const data::RecordId &id, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
void cleanRepository (const std::string &alias, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
RepoStatus repositoryStatus (const data::RecordId &id)
 get the status of a cached repository
RepoStatus repositoryStatus (const std::string &alias)
 get the status of a cached repository
bool isCached (const std::string &alias)
data::RecordId lookupRepository (const std::string &alias)
data::RecordId lookupOrAppendFile (const Pathname &path)
 Returns the record id of a file entry path.
data::RecordId lookupOrAppendName (const std::string &name)
 Returns the record id of a name entry name.
data::RecordId lookupOrAppendDirName (const std::string &name)
 Returns the record id of a directory name entry name.
data::RecordId lookupOrAppendFileName (const std::string &name)
 Returns the record id of a file name entry name.
Implementation of the \ref ResolvableDataConsumer interface.
virtual data::RecordId consumePackage (const data::RecordId &repository_id, const data::Package_Ptr &package)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumeSourcePackage (const data::RecordId &catalog_id, const data::SrcPackage_Ptr &srcpackage)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumePatch (const data::RecordId &repository_id, const data::Patch_Ptr &patch)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumePackageAtom (const data::RecordId &repository_id, const data::PackageAtom_Ptr &atom)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumeMessage (const data::RecordId &repository_id, const data::Message_Ptr &message)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumeScript (const data::RecordId &repository_id, const data::Script_Ptr &script)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumePattern (const data::RecordId &repository_id, const data::Pattern_Ptr &pattern)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumeProduct (const data::RecordId &repository_id, const data::Product_Ptr &product)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumeChangelog (const data::RecordId &resolvable_id, const Changelog &changelog)
 Implementation of the ResolvableDataConsumer interface.
virtual data::RecordId consumeFilelist (const data::RecordId &resolvable_id, const data::Filenames &filenames)
 Implementation of the ResolvableDataConsumer interface.
virtual void consumeDiskUsage (const data::RecordId &resolvable_id, const DiskUsage &disk)
 Implementation of the ResolvableDataConsumer interface.
virtual void updatePackageLang (const data::RecordId &resolvable_id, const data::Packagebase_Ptr &data_r)
 Implementation of the ResolvableDataConsumer interface.

Protected Member Functions

void appendStringAttribute (const data::RecordId &resolvable_id, const data::RecordId &lang_id, const data::RecordId &type_id, const std::string &value)
 Internally used function that appends a entry in the capabilities table for a specific capability entry.
void appendNumericAttribute (const data::RecordId &resolvable_id, const data::RecordId &type_id, int value)
 Append a numeric attribute to a resolvable.
void appendBooleanAttribute (const data::RecordId &resolvable_id, const std::string &klass, const std::string &name, bool value)
 Append a bool attribute to a resolvable.
void appendBooleanAttribute (const data::RecordId &resolvable_id, const Attribute &attr, bool value)
Detail Attributes Inserters
These functions are used by ResolvableConsumer interface functions to avoid some duplication across types.

void appendResObjectAttributes (const data::RecordId &rid, const data::ResObject_Ptr &res)
void appendPackageBaseAttributes (const data::RecordId &pkgid, const data::Packagebase_Ptr &package)

Private Attributes

RW_pointer< Impl_pimpl
 Pointer to implementation.

Classes

struct  Impl


Detailed Description

The cache store caches resolvable data.

 CacheStore store("/path");
 RecordId repository_id =
   store.lookupOrAppendRepository("some-alias");
 store.consumePackage( repository_id, package_ptr );
 store.commit();

Note:
Data will not be commited until you explicitely commit.

Definition at line 53 of file CacheStore.h.


Constructor & Destructor Documentation

zypp::cache::CacheStore::CacheStore (  ) 

Definition at line 223 of file CacheStore.cc.

zypp::cache::CacheStore::~CacheStore (  )  [virtual]

Definition at line 229 of file CacheStore.cc.

zypp::cache::CacheStore::CacheStore ( const Pathname &  dbdir  ) 

Constructor for the CacheStore.

Note:
a transaction will be started from the moment the CacheStore is instanciated.
The data will be saved in the directory specified in dbdir. dbdir must exist.

Definition at line 217 of file CacheStore.cc.


Member Function Documentation

void zypp::cache::CacheStore::commit (  ) 

Commit the changes.

Definition at line 234 of file CacheStore.cc.

References _pimpl.

Referenced by zypp::RepoManager::buildCache(), and zypp::RepoManager::cleanCache().

virtual data::RecordId zypp::cache::CacheStore::consumePackage ( const data::RecordId repository_id,
const data::Package_Ptr &  package 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a package, inserting it in the cache, under

Parameters:
repository_id ownership.
package Package data

Implements zypp::data::ResolvableDataConsumer.

RecordId zypp::cache::CacheStore::consumeSourcePackage ( const data::RecordId catalog_id,
const data::SrcPackage_Ptr &  srcpackage 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a source package, inserting it in the cache, under

Parameters:
catalog_id ownership.
srcpackage Source package data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 291 of file CacheStore.cc.

References appendOnMediaLocation, appendResObjectAttributes(), and appendResolvable().

RecordId zypp::cache::CacheStore::consumePatch ( const data::RecordId repository_id,
const data::Patch_Ptr &  patch 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a patch, inserting it in the cache, under

Parameters:
repository_id ownership.
patch Patch data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 302 of file CacheStore.cc.

References appendBooleanAttribute(), appendNumericAttribute(), appendResObjectAttributes(), appendResolvable(), appendStringAttribute(), zypp::cache::attrPatchCategory(), zypp::cache::attrPatchId(), zypp::cache::attrPatchRebootNeeded(), zypp::cache::attrPatchTimestamp(), consumeMessage(), consumePackageAtom(), consumeScript(), DBG, and ERR.

RecordId zypp::cache::CacheStore::consumePackageAtom ( const data::RecordId repository_id,
const data::PackageAtom_Ptr &  atom 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a package atom, inserting it in the cache, under repository_id ownership.

Parameters:
repository_id record id of repository to which to append the resolvable.
atom package atom data
Note:
this is somewhat specific to current YUM patch metadata design and may change (to consumeAtom(data::RecordId,data::Atom)).

Implements zypp::data::ResolvableDataConsumer.

Definition at line 357 of file CacheStore.cc.

References appendDeltaRpm(), appendPackageBaseAttributes(), appendPatchRpm(), appendResObjectAttributes(), and appendResolvable().

Referenced by consumePatch().

RecordId zypp::cache::CacheStore::consumeMessage ( const data::RecordId repository_id,
const data::Message_Ptr &  message 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a message, inserting it in the cache, under

Parameters:
repository_id ownership.
message Message data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 375 of file CacheStore.cc.

References appendResObjectAttributes(), appendResolvable(), appendTranslatedStringAttribute(), and zypp::cache::attrMessageText().

Referenced by consumePatch().

RecordId zypp::cache::CacheStore::consumeScript ( const data::RecordId repository_id,
const data::Script_Ptr &  script 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a script, inserting it in the cache, under

Parameters:
repository_id ownership.
script Script data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 386 of file CacheStore.cc.

References appendOnMediaLocation, appendResObjectAttributes(), appendResolvable(), appendStringAttribute(), and zypp::cache::attrScriptDoScript().

Referenced by consumePatch().

RecordId zypp::cache::CacheStore::consumePattern ( const data::RecordId repository_id,
const data::Pattern_Ptr &  pattern 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a pattern, inserting it in the cache, under

Parameters:
repository_id ownership.
pattern Pattern data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 400 of file CacheStore.cc.

References appendBooleanAttribute(), appendResObjectAttributes(), appendResolvable(), appendStringAttribute(), appendStringContainerAttribute(), appendTranslatedStringAttribute(), zypp::cache::attrPatternCategory(), zypp::cache::attrPatternIcon(), zypp::cache::attrPatternIsDefault(), zypp::cache::attrPatternOrder(), zypp::cache::attrPatternUiExtends(), zypp::cache::attrPatternUiIncludes(), and zypp::cache::attrPatternUserVisible().

RecordId zypp::cache::CacheStore::consumeProduct ( const data::RecordId repository_id,
const data::Product_Ptr &  product 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume a product, inserting it in the cache, under

Parameters:
repository_id ownership.
pattern Pattern data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 421 of file CacheStore.cc.

References appendResObjectAttributes(), appendResolvable(), appendStringAttribute(), appendStringContainerAttribute(), appendTranslatedStringAttribute(), zypp::cache::attrProductDistributionEdition(), zypp::cache::attrProductDistributionName(), zypp::cache::attrProductExtraUrls(), zypp::cache::attrProductFlags(), zypp::cache::attrProductLongName(), zypp::cache::attrProductOptionalUrls(), zypp::cache::attrProductReleasenotesUrl(), zypp::cache::attrProductShortName(), zypp::cache::attrProductType(), and zypp::cache::attrProductUpdateUrls().

RecordId zypp::cache::CacheStore::consumeChangelog ( const data::RecordId resolvable_id,
const Changelog changelog 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume changelog of a resolvable, inserting it in the cache.

Parameters:
repository_id ownership.
resolvable resolvable for which the changelog data are to be saved
changelog the changelog
Todo:
see implementation

Todo:
maybe appendChangelog(const data::RecordId & resolvable_id, Changelog changelog) will be needed for inserting the changelog using in-memory record id of corresponding resolvable. (first, we'll see how fast is the inserting without remembering those ids)

Implements zypp::data::ResolvableDataConsumer.

Definition at line 441 of file CacheStore.cc.

References zypp::data::noRecordId.

RecordId zypp::cache::CacheStore::consumeFilelist ( const data::RecordId resolvable_id,
const data::Filenames filenames 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume filelist of a resolvable, inserting it in the cache.

Parameters:
repository_id ownership.
resolvable resolvable for which the filelist is to be saved
filenames list of filenames the resolvable contains
Todo:
see implementation

Todo:
maybe consumeFilelist(const data::RecordId & resolvable_id, data::Filenames &) will be needed

Implements zypp::data::ResolvableDataConsumer.

Definition at line 450 of file CacheStore.cc.

References zypp::data::noRecordId.

void zypp::cache::CacheStore::consumeDiskUsage ( const data::RecordId resolvable_id,
const DiskUsage disk 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Consume disk usage of a resolvable, inserting it in the cache.

Repeated entries are updated (replaced)

Parameters:
repository_id ownership.
resolvable resolvable for which the filelist is to be saved
disk Disk usage object
Todo:
see implementation

Implements zypp::data::ResolvableDataConsumer.

Definition at line 457 of file CacheStore.cc.

References _pimpl, zypp::DiskUsage::begin(), zypp::DiskUsage::end(), lookupOrAppendDirName(), and ZYPP_RETHROW.

void zypp::cache::CacheStore::updatePackageLang ( const data::RecordId resolvable_id,
const data::Packagebase_Ptr &  data_r 
) [virtual]

Implementation of the ResolvableDataConsumer interface.

Update a packages language specific data (summary, description, EULA, ins/delnotify).

Parameters:
resolvable_id resolvable to be updated
data_r Package data

Implements zypp::data::ResolvableDataConsumer.

Definition at line 482 of file CacheStore.cc.

References appendTranslatedStringAttribute(), zypp::cache::attrResObjectDelnotify(), zypp::cache::attrResObjectDescription(), zypp::cache::attrResObjectInsnotify(), zypp::cache::attrResObjectLicenseToConfirm(), and zypp::cache::attrResObjectSummary().

data::RecordId zypp::cache::CacheStore::appendResolvable ( const data::RecordId repository_id,
const Resolvable::Kind kind,
const NVRA nvra,
const data::Dependencies deps 
)

Appends a resolvable to the store.

You have to specify with kind of resolvable are you inserting and its NVRA (name version release and architecture ). Optionaly you can pass a list of CapabilityImpl::Ptr as dependencies for the resolvable.

You have to specify the RecordId for the repository owning this resolvable. Yuu can obtain it with lookupOrAppendRepository

You can create those deps using capability::parse functions, or the build methods to create specific types of capabilities: capability::buildVersioned for VersionedCap capability::buildNamed for NamedCap etc.

Once the resolvable is inserted, you will get back the id if it in the store. Which you can use for later adding other properties.

Referenced by consumeMessage(), consumePackageAtom(), consumePatch(), consumePattern(), consumeProduct(), consumeScript(), and consumeSourcePackage().

data::RecordId zypp::cache::CacheStore::appendResolvable ( const data::RecordId repository_id,
const Resolvable::Kind kind,
const NVRA nvra,
const data::Dependencies deps,
const data::RecordId shared_id 
)

Appends a resolvable, and sets shared data with another one

See also:
appendResolvable
Parameters:
shared_id Resolvable that provides data in case this one does not provide an attribute
Note:
Not all attributes can be shared. shared_id is just a hint for the queries.

void zypp::cache::CacheStore::appendDependencies ( const data::RecordId resolvable_id,
const data::Dependencies dependencies 
)

Adds dependencies to the store.

A map of dependency lists has to be specified. The map contains list of capablities for each dependency type zypp::Dep

resolvable_id is the resolvable Id in the CacheStore that will own those capabilities.

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendDependencyList ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
const data::DependencyList dlist 
)

Adds dependencies to the store.

A lists of dependencies dlist to be specified. Among which type of dependencies zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own those capabilities.

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendDependency ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
capability::CapabilityImpl::Ptr  cap 
)

Adds a dependency to the store.

A CapabilityImpl::Ptr argument cap has to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendNamedDependency ( const data::RecordId ,
zypp::Dep  ,
capability::NamedCap::Ptr   
)

Adds a Named dependency to the store.

A NamedCap::Ptr dlist to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the named capability using either capability::parse or capability::buildNamed

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendFileDependency ( const data::RecordId ,
zypp::Dep  ,
capability::FileCap::Ptr   
)

Adds a file dependency to the store.

A FileCap::Ptr dlist to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the file capability using either capability::parse or capability::buildFile

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendModaliasDependency ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
capability::ModaliasCap::Ptr  cap 
)

Adds a Modalias dependency to the store.

A ModaliasCap::Ptr cap to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the modalias capability using either capability::parse or capability::buildModalias

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendHalDependency ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
capability::HalCap::Ptr  cap 
)

Adds a Hal dependency to the store.

A HalCap::Ptr cap to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the modalias capability using either capability::parse or capability::buildHal

FIXME should it

Exceptions:
if the resolvable does not exist?

void zypp::cache::CacheStore::appendFilesystemDependency ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
capability::FilesystemCap::Ptr  cap 
)

Adds a Filesystem dependency to the store.

A FilesystemCap::Ptr cap to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the filesystem capability using either capability::parse or capability::buildFilesystem

FIXME should it

Exceptions:
if the resolvable does not exist?

Definition at line 681 of file CacheStore.cc.

References _pimpl, zypp::Dep::asString(), lookupOrAppendName(), lookupOrAppendType(), and ZYPP_THROW.

void zypp::cache::CacheStore::appendSplitDependency ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
capability::SplitCap::Ptr  cap 
)

Adds a split dependency to the store.

A SplitCap::Ptr cap to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the filesystem capability using either capability::parse or capability::buildSplit

FIXME should it

Exceptions:
if the resolvable does not exist?

Definition at line 702 of file CacheStore.cc.

References _pimpl, zypp::Dep::asString(), lookupOrAppendFile(), lookupOrAppendName(), lookupOrAppendType(), and ZYPP_THROW.

void zypp::cache::CacheStore::appendUnknownDependency ( const data::RecordId resolvable_id,
zypp::Dep  deptype,
capability::CapabilityImpl::Ptr  cap 
)

Adds a unknown dependency to the store.

A Capability::Ptr cap to be specified. Among which type of dependency zypp::Dep it is as the deptype argument.

resolvable_id is the resolvable Id in the CacheStore that will own the capability

You can create the capability using either capability::parse

FIXME should it

Exceptions:
if the resolvable does not exist?

RecordId zypp::cache::CacheStore::appendPatchRpm ( const data::RecordId repo_id,
const data::PatchRpm_Ptr &  prpm 
)

Insert patch RPM data into patch_packages table.

Parameters:
prpm The patch RPM object to insert.
Returns:
Record ID of the newly inserted record.
Todo:
lookupOrAppend ?

Definition at line 742 of file CacheStore.cc.

References _pimpl, and lookupOrAppendType().

Referenced by consumePackageAtom().

RecordId zypp::cache::CacheStore::appendDeltaRpm ( const data::RecordId repo_id,
const data::DeltaRpm_Ptr &  drpm 
)

Insert delta RPM data into delta_packages table.

Parameters:
drpm The delta RPM object to insert.
Returns:
Record ID of the newly inserted record.
Todo:
lookupOrAppend ?

Definition at line 779 of file CacheStore.cc.

References _pimpl, and lookupOrAppendType().

Referenced by consumePackageAtom().

data::RecordId zypp::cache::CacheStore::lookupOrAppendType ( const std::string &  klass,
const std::string &  name 
)

Returns the record id of a type.

Types are mostly used internally. To give concepts a record id to associate with. Examples could be arch::i386, lang::en_US Packages::summary, rel:>, kind::Package

Note:
If the type entry does not exist, it will be created and the new inserted entry's id will be returned.

Referenced by appendBooleanAttribute(), appendDeltaRpm(), appendFilesystemDependency(), appendNumericAttribute(), appendPatchRpm(), appendSplitDependency(), appendStringAttribute(), appendStringAttributeTranslation(), and lookupOrAppendType().

data::RecordId zypp::cache::CacheStore::lookupOrAppendType ( const Attribute attr  )  [inline]

Definition at line 471 of file CacheStore.h.

References zypp::cache::Attribute::klass, lookupOrAppendType(), and zypp::cache::Attribute::name.

data::RecordId zypp::cache::CacheStore::lookupOrAppendRepository ( const std::string &  alias  ) 

Returns the record id of a repository (Source).

Parameters:
alias Unique alias for this repo
Note:
If the repository entry does not exist, it will be created and the new inserted entry's id will be returned.

Referenced by zypp::RepoManager::buildCache().

void zypp::cache::CacheStore::setSharedData ( const data::RecordId resolvable_id,
const data::RecordId shared_id 
)

Set the resolvable shared data flag pointing to another resolvable.

This is a hint for cache readers. If any attribute of a resolvable is empty, is because it is shared with another resolvable.

Parameters:
resolvable_id Id of the resolvable. Must exists
shared_id The resolvable providing the data This one is a weak reference, the reader should just try to look the data there as a hint. use data::noRecordId to reset the value.

Definition at line 1111 of file CacheStore.cc.

References _pimpl, and zypp::data::noRecordId.

void zypp::cache::CacheStore::appendNumericAttribute ( const data::RecordId resolvable_id,
const std::string &  klass,
const std::string &  name,
int  value 
)

Append a numeric attribute to a resolvable.

Parameters:
resolvable_id Resovable Id, owner of the attribute
klass Type class i.e "Package" "lang" "kind"
name Type name i.e : "size" "media_number"
value numeric value

Definition at line 1133 of file CacheStore.cc.

References lookupOrAppendType().

Referenced by appendBooleanAttribute(), appendNumericAttribute(), appendResObjectAttributes(), and consumePatch().

void zypp::cache::CacheStore::appendNumericAttribute ( const data::RecordId resolvable_id,
const Attribute attr,
int  value 
) [inline]

Definition at line 515 of file CacheStore.h.

References appendNumericAttribute(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

void zypp::cache::CacheStore::appendTranslatedStringAttribute ( const data::RecordId resolvable_id,
const std::string &  klass,
const std::string &  name,
const TranslatedText text 
)

Append a translated string value to a resolvable.

Parameters:
resolvable_id Resovable Id, owner of the attribute
klass Type class i.e "Package" "lang" "kind"
name Type name i.e : "summary" "none" "Script"
text Translated text

Definition at line 1156 of file CacheStore.cc.

References appendStringAttributeTranslation(), zypp::TranslatedText::locales(), and zypp::TranslatedText::text().

Referenced by appendResObjectAttributes(), appendTranslatedStringAttribute(), consumeMessage(), consumePattern(), consumeProduct(), and updatePackageLang().

void zypp::cache::CacheStore::appendTranslatedStringAttribute ( const data::RecordId resolvable_id,
const Attribute attr,
const TranslatedText text 
) [inline]

Definition at line 532 of file CacheStore.h.

References appendTranslatedStringAttribute(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

void zypp::cache::CacheStore::appendStringAttributeTranslation ( const data::RecordId resolvable_id,
const Locale locale,
const std::string &  klass,
const std::string &  name,
const std::string &  text 
)

Append a string value to a resolvable.

Parameters:
resolvable_id Resovable Id, owner of the attribute
locale locale of the text language
klass Type class i.e "Package" "lang" "kind"
name Type name i.e : "summary" "none" "Script"
text text

Definition at line 1169 of file CacheStore.cc.

References appendStringAttribute(), zypp::Locale::code(), and lookupOrAppendType().

Referenced by appendStringAttributeTranslation(), and appendTranslatedStringAttribute().

void zypp::cache::CacheStore::appendStringAttributeTranslation ( const data::RecordId resolvable_id,
const Locale locale,
const Attribute attr,
const std::string &  text 
) [inline]

Definition at line 551 of file CacheStore.h.

References appendStringAttributeTranslation(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

void zypp::cache::CacheStore::appendStringAttribute ( const data::RecordId resolvable_id,
const std::string &  klass,
const std::string &  name,
const std::string &  value 
)

Append a string value to a resolvable.

Parameters:
resolvable_id Resovable Id, owner of the attribute
klass Type class i.e "Package" "lang" "kind"
name Type name i.e : "summary" "none" "Script"
value string value

Definition at line 1183 of file CacheStore.cc.

References lookupOrAppendType().

Referenced by appendResObjectAttributes(), appendStringAttribute(), appendStringAttributeTranslation(), appendStringContainerAttribute(), consumePatch(), consumePattern(), consumeProduct(), and consumeScript().

void zypp::cache::CacheStore::appendStringAttribute ( const data::RecordId resolvable_id,
const Attribute attr,
const std::string &  value 
) [inline]

Definition at line 569 of file CacheStore.h.

References appendStringAttribute(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

void zypp::cache::CacheStore::appendStringAttribute ( const data::RecordId resolvable_id,
const data::RecordId type_id,
const std::string &  value 
)

Append a string value to a resolvable.

Parameters:
resolvable_id Resovable Id, owner of the attribute
type_id Type id,
See also:
lookupOrAppendType
Parameters:
value string value

template<class _Iterator>
void zypp::cache::CacheStore::appendStringContainerAttribute ( const data::RecordId resolvable_id,
const std::string &  klass,
const std::string &  name,
_Iterator  begin,
_Iterator  end 
) [inline]

Append strings from _Iterator to a resolvable.

Uses zypp::str::split(_Iterator,_Iterator, std::string) with ZConfig::cacheDBSplitJoinSeparator() as the second argument (a separator string) of split().

Any container of any class providing asString() can be used.

Parameters:
resolvable_id Resovable Id, owner of the attribute
klass Type class i.e "Package" "lang" "kind"
name Type name i.e : "summary" "none" "Script"
begin begin Iterator to the container
end end Iterator to the container

Definition at line 600 of file CacheStore.h.

References appendStringAttribute(), zypp::ZConfig::instance(), and zypp::url::join().

Referenced by appendStringContainerAttribute(), consumePattern(), and consumeProduct().

template<class _Iterator>
void zypp::cache::CacheStore::appendStringContainerAttribute ( const data::RecordId resolvable_id,
const Attribute attr,
_Iterator  begin,
_Iterator  end 
) [inline]

Definition at line 611 of file CacheStore.h.

References appendStringContainerAttribute(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

template<class _Container>
void zypp::cache::CacheStore::appendStringContainerAttribute ( const data::RecordId resolvable_id,
const std::string &  klass,
const std::string &  name,
const _Container &  container 
) [inline]

Append strings from a _Container to a resolvable.

Convenience method taking the container instead of it's begin/end iterators as argument.

See also:
appendStringContainerAttribute

Definition at line 626 of file CacheStore.h.

References appendStringContainerAttribute().

template<class _Container>
void zypp::cache::CacheStore::appendStringContainerAttribute ( const data::RecordId resolvable_id,
const Attribute attr,
const _Container &  container 
) [inline]

Definition at line 633 of file CacheStore.h.

References appendStringContainerAttribute(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

void zypp::cache::CacheStore::updateRepositoryStatus ( const data::RecordId id,
const RepoStatus status 
)

Update a known repository checksum and timestamp.

Note:
If you don't provide timestamp it defaults to now.
It is responsability of the caller to operate with a valid record id. You can get one Using lookupOrAppendRepository

If the repository does not exists, nothing will happen

Referenced by zypp::RepoManager::buildCache().

void zypp::cache::CacheStore::cleanRepository ( const data::RecordId id,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Clean repository from cache

Parameters:
id repository identifier in cache You can check existence using isCached
Exceptions:
CacheRecordNotFoundException if the repository id does not refer to a valid repository.

Definition at line 885 of file CacheStore.cc.

References _pimpl, sqlite3x::sqlite3_command::bind(), sqlite3x::sqlite3_command::executenonquery(), zypp::Exception::remember(), ZYPP_CAUGHT, and ZYPP_THROW.

Referenced by zypp::cleanCacheInternal(), and cleanRepository().

void zypp::cache::CacheStore::cleanRepository ( const std::string &  alias,
const ProgressData::ReceiverFnc progressrcv = ProgressData::ReceiverFnc() 
)

Clean repository from cache

Parameters:
alias Repository unique alias You can check existence using isCached
Exceptions:
CacheRecordNotFoundException if the repository alias does not refer to a valid repository.

Definition at line 907 of file CacheStore.cc.

References cleanRepository(), and lookupRepository().

RepoStatus zypp::cache::CacheStore::repositoryStatus ( const data::RecordId id  ) 

get the status of a cached repository

It is responsability of the caller to operate with a valid record id. You can get one Using lookupOrAppendRepository

You can check existence using isCached

Exceptions:
CacheRecordNotFoundException if the repository id does not refer to a valid repository.

Definition at line 913 of file CacheStore.cc.

References _pimpl, sqlite3x::sqlite3_command::bind(), sqlite3x::sqlite3_command::executereader(), sqlite3x::sqlite3_reader::getstring(), sqlite3x::sqlite3_reader::read(), zypp::RepoStatus::setChecksum(), zypp::RepoStatus::setTimestamp(), ZYPP_RETHROW, and ZYPP_THROW.

Referenced by zypp::RepoManager::buildCache(), and zypp::RepoManager::cacheStatus().

RepoStatus zypp::cache::CacheStore::repositoryStatus ( const std::string &  alias  ) 

get the status of a cached repository

It is responsability of the caller to operate with a valid alias. You can insert one Using lookupOrAppendRepository

You can check existence using isCached

Exceptions:
CacheRecordNotFoundException if the repository alias is unknown

bool zypp::cache::CacheStore::isCached ( const std::string &  alias  ) 

Does a repository exists in cache? True if the repository is cached

Referenced by zypp::RepoManager::buildCache(), zypp::cleanCacheInternal(), zypp::RepoManager::createFromCache(), and zypp::RepoManager::isCached().

data::RecordId zypp::cache::CacheStore::lookupRepository ( const std::string &  alias  ) 

looks the id for a repository in cache

Parameters:
alias Repository unique alias
Exceptions:
CacheRecordNotFoundException if the repository alias is unknown

Referenced by zypp::RepoManager::buildCache(), zypp::RepoManager::cacheStatus(), zypp::cleanCacheInternal(), cleanRepository(), and zypp::RepoManager::createFromCache().

RecordId zypp::cache::CacheStore::lookupOrAppendFile ( const Pathname &  path  ) 

Returns the record id of a file entry path.

Note:
If the file entry does not exist, it will be created and the new inserted entry's id will be returned.

Definition at line 813 of file CacheStore.cc.

References _pimpl, sqlite3x::sqlite3_reader::getint64(), lookupOrAppendDirName(), lookupOrAppendFileName(), sqlite3x::sqlite3_reader::read(), and ZYPP_RETHROW.

Referenced by appendSplitDependency().

data::RecordId zypp::cache::CacheStore::lookupOrAppendName ( const std::string &  name  ) 

Returns the record id of a name entry name.

Note:
If the name entry does not exist, it will be created and the new inserted entry's id will be returned.

Referenced by appendFilesystemDependency(), and appendSplitDependency().

data::RecordId zypp::cache::CacheStore::lookupOrAppendDirName ( const std::string &  name  ) 

Returns the record id of a directory name entry name.

Note:
If the directory name entry does not exist, it will be created and the new inserted entry's id will be returned.

Referenced by consumeDiskUsage(), and lookupOrAppendFile().

data::RecordId zypp::cache::CacheStore::lookupOrAppendFileName ( const std::string &  name  ) 

Returns the record id of a file name entry name.

Note:
If the file name entry does not exist, it will be created and the new inserted entry's id will be returned.

Referenced by lookupOrAppendFile().

void zypp::cache::CacheStore::appendStringAttribute ( const data::RecordId resolvable_id,
const data::RecordId lang_id,
const data::RecordId type_id,
const std::string &  value 
) [protected]

Internally used function that appends a entry in the capabilities table for a specific capability entry.

void zypp::cache::CacheStore::appendNumericAttribute ( const data::RecordId resolvable_id,
const data::RecordId type_id,
int  value 
) [protected]

Append a numeric attribute to a resolvable.

Parameters:
resolvable_id Resovable Id, owner of the attribute
type_id attribute id
value numeric value

void zypp::cache::CacheStore::appendBooleanAttribute ( const data::RecordId resolvable_id,
const std::string &  klass,
const std::string &  name,
bool  value 
) [protected]

Append a bool attribute to a resolvable.

Will be stored as numeric 1 or 0.

Parameters:
resolvable_id Resovable Id, owner of the attribute
type_id attribute id
value bool value

Definition at line 1124 of file CacheStore.cc.

References appendNumericAttribute(), and lookupOrAppendType().

Referenced by appendBooleanAttribute(), appendResObjectAttributes(), consumePatch(), and consumePattern().

void zypp::cache::CacheStore::appendBooleanAttribute ( const data::RecordId resolvable_id,
const Attribute attr,
bool  value 
) [inline, protected]

Definition at line 798 of file CacheStore.h.

References appendBooleanAttribute(), zypp::cache::Attribute::klass, and zypp::cache::Attribute::name.

void zypp::cache::CacheStore::appendResObjectAttributes ( const data::RecordId rid,
const data::ResObject_Ptr &  res 
) [protected]

Definition at line 239 of file CacheStore.cc.

References appendBooleanAttribute(), appendNumericAttribute(), appendStringAttribute(), appendTranslatedStringAttribute(), zypp::cache::attrResObjectBuildTime(), zypp::cache::attrResObjectDelnotify(), zypp::cache::attrResObjectDescription(), zypp::cache::attrResObjectInsnotify(), zypp::cache::attrResObjectInstalledSize(), zypp::cache::attrResObjectInstallOnly(), zypp::cache::attrResObjectLicenseToConfirm(), zypp::cache::attrResObjectSummary(), and zypp::cache::attrResObjectVendor().

Referenced by consumeMessage(), consumePackageAtom(), consumePatch(), consumePattern(), consumeProduct(), consumeScript(), and consumeSourcePackage().

void zypp::cache::CacheStore::appendPackageBaseAttributes ( const data::RecordId pkgid,
const data::Packagebase_Ptr &  package 
) [protected]

Referenced by consumePackageAtom().


Member Data Documentation

RW_pointer<Impl> zypp::cache::CacheStore::_pimpl [private]

Pointer to implementation.

Definition at line 819 of file CacheStore.h.

Referenced by appendDeltaRpm(), appendFilesystemDependency(), appendPatchRpm(), appendSplitDependency(), cleanRepository(), commit(), consumeDiskUsage(), lookupOrAppendFile(), repositoryStatus(), and setSharedData().


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 19:23:18 2007 for libzypp by  doxygen 1.5.3