libzypp  17.5.0
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

◆ LockList

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

Definition at line 21 of file Locks.h.

◆ const_iterator

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

Definition at line 22 of file Locks.h.

◆ size_type

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

Definition at line 23 of file Locks.h.

Constructor & Destructor Documentation

◆ Locks()

zypp::Locks::Locks ( )
private

Definition at line 101 of file Locks.cc.

Member Function Documentation

◆ instance()

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

Gets instance of this class.

Singleton method.

Definition at line 37 of file Locks.cc.

◆ begin()

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

Definition at line 103 of file Locks.cc.

◆ end()

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

Definition at line 106 of file Locks.cc.

◆ size()

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

Definition at line 109 of file Locks.cc.

◆ empty()

bool zypp::Locks::empty ( ) const

Definition at line 112 of file Locks.cc.

◆ addLock() [1/4]

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 181 of file Locks.cc.

◆ addLock() [2/4]

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 200 of file Locks.cc.

◆ addLock() [3/4]

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 211 of file Locks.cc.

◆ addLock() [4/4]

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 206 of file Locks.cc.

◆ removeLock() [1/4]

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 222 of file Locks.cc.

◆ removeLock() [2/4]

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 242 of file Locks.cc.

◆ removeLock() [3/4]

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 253 of file Locks.cc.

◆ removeLock() [4/4]

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

Definition at line 248 of file Locks.cc.

◆ readAndApply()

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

Optimalized version of read and apply.

See also
read
apply

Definition at line 148 of file Locks.cc.

◆ read()

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 163 of file Locks.cc.

◆ apply()

void zypp::Locks::apply ( ) const

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

Definition at line 174 of file Locks.cc.

◆ save()

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 464 of file Locks.cc.

◆ merge()

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 445 of file Locks.cc.

◆ existEmpty()

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 265 of file Locks.cc.

◆ removeEmpty()

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 322 of file Locks.cc.

◆ removeDuplicates()

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 490 of file Locks.cc.

Member Data Documentation

◆ _pimpl

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: