libzypp: zypp::Locks Class Reference

libzypp 17.38.11

zypp::Locks Class Reference

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

`#include <zypp/Locks.h>`

## Classes
class | Impl

## Public Types
using | LockList = std::list<PoolQuery>
using | const_iterator = LockList::const_iterator
using | size_type = LockList::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}.
void | addLock (const IdString &ident_r)
| add lock by identifier (e.g.
void | addLock (const ResKind &kind_r, const IdString &name_r)
| add lock by name and kind and add this lock as toAdd
void | addLock (const ResKind &kind_r, const C_Str &name_r)
| add lock by name and kind and add this lock as toAdd
void | removeLock (const PoolQuery &query)
| unlocks by result of query and add to toRemove.
void | removeLock (const IdString &ident_r)
| remove lock by identifier (e.g.
void | removeLock (const ResKind &kind_r, const IdString &name_r)
| remove lock by name and kind
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.
void | read (const Pathname &file=ZConfig::instance().locksFile())
| Read locks from file to list of stable locks (locks which is not changed during session).
void | apply () const
| Applies locks in stable list (locks which is not changed during session).
void | save (const Pathname &file=ZConfig::instance().locksFile())
| Merges toAdd and ToRemove list to stable list and save that stable list to file.
void | merge ()
| Merges toAdd and ToRemove list to stable list.
bool | existEmpty () const
| Gets true if some lock doesn't lock any object in pool This can happen e.g.
void | removeEmpty ()
| Call callback for each empty lock.
void | removeDuplicates ()
| Delete all query duplicate in loaded locks.

## Static Public Member Functions
static Locks & | instance ()
| Gets instance of this class.

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

using zypp::Locks::LockList = std::list<PoolQuery>

Definition at line 21 of file Locks.h.

## ◆ const_iterator

using zypp::Locks::const_iterator = LockList::const_iterator

Definition at line 22 of file Locks.h.

## ◆ size_type

using zypp::Locks::size_type = LockList::size_type

Definition at line 23 of file Locks.h.

## Constructor & Destructor Documentation

## ◆ Locks()

zypp::Locks::Locks | ( |  | ) |
| private

Definition at line 100 of file Locks.cc.

## Member Function Documentation

## ◆ instance()

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

Gets instance of this class.

Singleton method.

Definition at line 36 of file Locks.cc.

## ◆ begin()

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

Definition at line 102 of file Locks.cc.

## ◆ end()

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

Definition at line 105 of file Locks.cc.

## ◆ size()

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

Definition at line 108 of file Locks.cc.

## ◆ empty()

bool zypp::Locks::empty | ( |  | ) | const

Definition at line 111 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 180 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 199 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 210 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 205 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 it is in toAdd list) then both is deleted and nothing happens during save

Definition at line 221 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 it is in toAdd list) then both is deleted and nothing happens during save

Definition at line 241 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 it is in toAdd list) then both is deleted and nothing happens during save

Definition at line 252 of file Locks.cc.

## ◆ removeLock() [4/4]

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

Definition at line 247 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 147 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 162 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 173 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 466 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 447 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 263 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 320 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 492 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:

- zypp/Locks.h
- zypp/Locks.cc