libzypp 17.37.10

Locks.h
Go to the documentation of this file.
1#ifndef ZYPP_LOCKS_H
2#define ZYPP_LOCKS_H
3
4#include <zypp/ResPool.h>
5#include <zypp/Pathname.h>
6#include <zypp/PoolQuery.h>
7#include <zypp/ZConfig.h>
8
9 namespace zypp
10{
13
18 class ZYPP_API Locks
19 {
20 public:
21 using LockList = std::list<PoolQuery>;
22 using const_iterator = LockList::const_iterator;
23 using size_type = LockList::size_type;
24 public:
25 class Impl;
26
31 static Locks& instance();
32
33 const_iterator begin() const;
34 const_iterator end() const;
35 LockList::size_type size() const;
36 bool empty() const;
37
43
47 void addLock( const PoolQuery& query );
48
53 void addLock( const IdString& ident_r );
54
59 void addLock( const ResKind& kind_r, const IdString& name_r );
60
65 void addLock( const ResKind& kind_r, const C_Str& name_r );
66
73 void removeLock( const PoolQuery& query );
74
81 void removeLock( const IdString& ident_r );
82
89 void removeLock( const ResKind& kind_r, const IdString& name_r );
90 void removeLock( const ResKind& kind_r, const C_Str & name_r );
91
97 void readAndApply( const Pathname& file = ZConfig::instance().locksFile() );
98
103 void read( const Pathname& file = ZConfig::instance().locksFile() );
104
108 void apply() const;
109
115 void save( const Pathname& file = ZConfig::instance().locksFile() );
116
122 void merge();
123
129 bool existEmpty() const;
130
137 void removeEmpty();
138
143 void removeDuplicates();
145 private:
146 Locks();
147
148 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
149
150 };
151}
152
153#endif
PoolQuery.h
ResPool.h
ZConfig.h
zypp::C_Str
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition String.h:92
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:44
zypp::Locks::Impl
Definition Locks.cc:60
zypp::Locks::removeEmpty
void removeEmpty()
Call callback for each empty lock.
Definition Locks.cc:320
zypp::Locks::apply
void apply() const
Applies locks in stable list (locks which is not changed during session).
Definition Locks.cc:173
zypp::Locks::merge
void merge()
Merges toAdd and ToRemove list to stable list.
Definition Locks.cc:447
zypp::Locks::save
void save(const Pathname &file=ZConfig::instance().locksFile())
Merges toAdd and ToRemove list to stable list and save that stable list to file.
Definition Locks.cc:466
zypp::Locks::end
const_iterator end() const
Definition Locks.cc:105
zypp::Locks::addLock
void addLock(const PoolQuery &query)
TODO add: toBeAdded{Begin,End,Size,Empty} toBeRemoved{Begin,End,Size,Empty}.
Definition Locks.cc:180
zypp::Locks::LockList
std::list< PoolQuery > LockList
Definition Locks.h:21
zypp::Locks::empty
bool empty() const
Definition Locks.cc:111
zypp::Locks::Locks
Locks()
Definition Locks.cc:100
zypp::Locks::size_type
LockList::size_type size_type
Definition Locks.h:23
zypp::Locks::readAndApply
void readAndApply(const Pathname &file=ZConfig::instance().locksFile())
Optimalized version of read and apply.
Definition Locks.cc:147
zypp::Locks::removeDuplicates
void removeDuplicates()
Delete all query duplicate in loaded locks.
Definition Locks.cc:492
zypp::Locks::begin
const_iterator begin() const
Definition Locks.cc:102
zypp::Locks::size
LockList::size_type size() const
Definition Locks.cc:108
zypp::Locks::removeLock
void removeLock(const PoolQuery &query)
unlocks by result of query and add to toRemove.
Definition Locks.cc:221
zypp::Locks::const_iterator
LockList::const_iterator const_iterator
Definition Locks.h:22
zypp::Locks::existEmpty
bool existEmpty() const
Gets true if some lock doesn't lock any object in pool This can happen e.g.
Definition Locks.cc:263
zypp::Locks::_pimpl
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Definition Locks.h:148
zypp::Locks::instance
static Locks & instance()
Gets instance of this class.
Definition Locks.cc:36
zypp::Locks::read
void read(const Pathname &file=ZConfig::instance().locksFile())
Read locks from file to list of stable locks (locks which is not changed during session)
Definition Locks.cc:162
zypp::PoolQuery
Meta-data query API.
Definition PoolQuery.h:91
zypp::ResKind
Resolvable kinds.
Definition ResKind.h:33
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:940
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
Pathname.h