libzypp  13.10.6
zypp::Locks Class Reference

Singleton class which manipulate with locks file and apply locks on pool. More...

#include <Locks.h>

Classes

class  Impl
 

Public Types

typedef std::list< PoolQueryLockList
 
typedef LockList::const_iterator const_iterator
 
typedef LockList::size_type size_type
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
LockList::size_type size () const
 
bool empty () const
 
void addLock (const PoolQuery &query)
 TODO add: toBeAdded{Begin,End,Size,Empty} toBeRemoved{Begin,End,Size,Empty}. More...
 
void addLock (const IdString &ident_r)
 add lock by identifier (e.g. More...
 
void addLock (const ResKind &kind_r, const IdString &name_r)
 add lock by name and kind and add this lock as toAdd More...
 
void addLock (const ResKind &kind_r, const C_Str &name_r)
 add lock by name and kind and add this lock as toAdd More...
 
void removeLock (const PoolQuery &query)
 unlocks by result of query and add to toRemove. More...
 
void removeLock (const IdString &ident_r)
 remove lock by identifier (e.g. More...
 
void removeLock (const ResKind &kind_r, const IdString &name_r)
 remove lock by name and kind More...
 
void removeLock (const ResKind &kind_r, const C_Str &name_r)
 
void readAndApply (const Pathname &file=ZConfig::instance().locksFile())
 Optimalized version of read and apply. More...
 
void read (const Pathname &file=ZConfig::instance().locksFile())
 Read locks from file to list of stable locks (locks which is not changed during session) More...
 
void apply () const
 Applies locks in stable list (locks which is not changed during session). More...
 
void save (const Pathname &file=ZConfig::instance().locksFile())
 Merges toAdd and ToRemove list to stable list and save that stable list to file. More...
 
void merge ()
 Merges toAdd and ToRemove list to stable list. More...
 
bool existEmpty () const
 Gets true if some lock doesn't lock any object in pool This can happen e.g. More...
 
void removeEmpty ()
 Call callback for each empty lock. More...
 
void removeDuplicates ()
 Delete all query duplicate in loaded locks. More...
 

Static Public Member Functions

static Locksinstance ()
 Gets instance of this class. More...
 

Private Member Functions

 Locks ()
 

Private Attributes

RW_pointer< Impl,
rw_pointer::Scoped< Impl > > 
_pimpl
 

Detailed Description

Singleton class which manipulate with locks file and apply locks on pool.

for user information about locksfile and its format see http://en.opensuse.org/Libzypp/Locksfile

Definition at line 18 of file Locks.h.

Member Typedef Documentation

typedef std::list<PoolQuery> zypp::Locks::LockList

Definition at line 21 of file Locks.h.

typedef LockList::const_iterator zypp::Locks::const_iterator

Definition at line 22 of file Locks.h.

typedef LockList::size_type zypp::Locks::size_type

Definition at line 23 of file Locks.h.

Constructor & Destructor Documentation

zypp::Locks::Locks ( )
private

Definition at line 58 of file Locks.cc.

Member Function Documentation

Locks & zypp::Locks::instance ( )
static

Gets instance of this class.

Singleton method.

Definition at line 39 of file Locks.cc.

Locks::const_iterator zypp::Locks::begin ( ) const

Definition at line 60 of file Locks.cc.

Locks::const_iterator zypp::Locks::end ( ) const

Definition at line 63 of file Locks.cc.

Locks::LockList::size_type zypp::Locks::size ( ) const

Definition at line 66 of file Locks.cc.

bool zypp::Locks::empty ( ) const

Definition at line 69 of file Locks.cc.

void zypp::Locks::addLock ( const PoolQuery query)

TODO add: toBeAdded{Begin,End,Size,Empty} toBeRemoved{Begin,End,Size,Empty}.

locks result of query and add this lock as toAdd

Definition at line 141 of file Locks.cc.

void zypp::Locks::addLock ( const IdString ident_r)

add lock by identifier (e.g.

Selectable->ident() and add this lock as toAdd

Definition at line 163 of file Locks.cc.

void zypp::Locks::addLock ( const ResKind kind_r,
const IdString name_r 
)

add lock by name and kind and add this lock as toAdd

Definition at line 174 of file Locks.cc.

void zypp::Locks::addLock ( const ResKind kind_r,
const C_Str name_r 
)

add lock by name and kind and add this lock as toAdd

Definition at line 169 of file Locks.cc.

void zypp::Locks::removeLock ( const PoolQuery query)

unlocks by result of query and add to toRemove.

If unlock non-saved lock (so he is in toAdd list) then both is deleted and nathing happen during save

Definition at line 185 of file Locks.cc.

void zypp::Locks::removeLock ( const IdString ident_r)

remove lock by identifier (e.g.

Selectable->ident()

If unlock non-saved lock (so he is in toAdd list) then both is deleted and nathing happen during save

Definition at line 208 of file Locks.cc.

void zypp::Locks::removeLock ( const ResKind kind_r,
const IdString name_r 
)

remove lock by name and kind

If unlock non-saved lock (so he is in toAdd list) then both is deleted and nathing happen during save

Definition at line 219 of file Locks.cc.

void zypp::Locks::removeLock ( const ResKind kind_r,
const C_Str name_r 
)

Definition at line 214 of file Locks.cc.

void zypp::Locks::readAndApply ( const Pathname &  file = ZConfig::instance().locksFile())

Optimalized version of read and apply.

See Also
read
apply

Definition at line 106 of file Locks.cc.

void zypp::Locks::read ( const Pathname &  file = ZConfig::instance().locksFile())

Read locks from file to list of stable locks (locks which is not changed during session)

Definition at line 122 of file Locks.cc.

void zypp::Locks::apply ( ) const

Applies locks in stable list (locks which is not changed during session).

Definition at line 134 of file Locks.cc.

void zypp::Locks::save ( const Pathname &  file = ZConfig::instance().locksFile())

Merges toAdd and ToRemove list to stable list and save that stable list to file.

See Also
SavingLocksReport

Definition at line 435 of file Locks.cc.

void zypp::Locks::merge ( )

Merges toAdd and ToRemove list to stable list.

Note
Can call callback if problem during merging occure
See Also
SavingLocksReport

Definition at line 416 of file Locks.cc.

bool zypp::Locks::existEmpty ( ) const

Gets true if some lock doesn't lock any object in pool This can happen e.g.

if package is removed or due to user bad definition of lock

Definition at line 231 of file Locks.cc.

void zypp::Locks::removeEmpty ( )

Call callback for each empty lock.

See Also
existEmpty
CleanEmptyLocksReport
Note
you must call save to write cleaned locks to file

Definition at line 289 of file Locks.cc.

void zypp::Locks::removeDuplicates ( )

Delete all query duplicate in loaded locks.

Note
you must call save to write cleaned locks to file

Definition at line 461 of file Locks.cc.

Member Data Documentation

RW_pointer<Impl, rw_pointer::Scoped<Impl> > zypp::Locks::_pimpl
private

Definition at line 148 of file Locks.h.


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