-
#ifndef ZYPP_LOCKS_H
#define ZYPP_LOCKS_H
#include "zypp/PoolQuery.h"
#include "zypp/ZConfig.h"
#include "zypp/ui/Selectable.h"
-
+
namespace zypp
{
- namespace locks
+ class Locks
{
- class Locks
- {
- public:
- class Impl;
+ public:
+ class Impl;
- static Locks& instance();
+ static Locks& instance();
- /**
- * locks all solvables which is result of query
- */
- void addLock( const PoolQuery& query );
+ /**
+ * locks all solvables which is result of query
+ */
+ void addLock( const PoolQuery& query );
- /**
- * locks selectable
- */
- void addLock( const ui::Selectable& selectable );
+ /**
+ * locks selectable
+ */
+ void addLock( const ui::Selectable& selectable );
- /**
- * unlocks all solvables which is result of query.
- * Can call callback
- */
- void unlock( const PoolQuery& query );
+ /**
+ * unlocks all solvables which is result of query.
+ * Can call callback
+ */
+ void unlock( const PoolQuery& query );
- void unlock( const ui::Selectable& selectable );
+ void unlock( const ui::Selectable& selectable );
- void loadLocks( const Pathname& file = ZConfig::instance().locksFile() );
+ void loadLocks( const Pathname& file = ZConfig::instance().locksFile() );
- void saveLocks( const Pathname& file = ZConfig::instance().locksFile() );
+ void saveLocks( const Pathname& file = ZConfig::instance().locksFile() );
- bool existEmptyLocks();
+ bool existEmptyLocks();
- void removeEmptyLocks();
+ void removeEmptyLocks();
- private:
- Locks();
-
- RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
+ private:
+ Locks();
+
+ RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
- };
- }
+ };
}
#endif
-
} // namespace target
///////////////////////////////////////////////////////////////////
-class PoolQuery;
- ///////////////////////////////////////////////////////////////////
- namespace locks
- {
- struct CleanEmptyLocksReport : public callback::ReportBase
- {
- enum Action {
- ABORT, // abort and return error
- DELETE, // delete empty lock
- IGNORE // skip empty lock
- };
+ class PoolQuery;
- enum Error {
- NO_ERROR,
- ABORTED // cleaning aborted
- };
+ struct CleanEmptyLocksReport : public callback::ReportBase
+ {
+ enum Action {
+ ABORT, // abort and return error
+ DELETE, // delete empty lock
+ IGNORE // skip empty lock
+ };
- virtual void start(
- ) {}
+ enum Error {
+ NO_ERROR,
+ ABORTED // cleaning aborted
+ };
- virtual bool progress(int /*value*/)
- { return true; }
+ virtual void start(
+ ) {}
- /**
- * When find empty lock ask what to do with it
- */
- virtual Action execute(
- const PoolQuery& /*error*/
- ) { return DELETE; }
+ virtual bool progress(int /*value*/)
+ { return true; }
- virtual void finish(
- Error /*error*/
- ) {}
+ /**
+ * When find empty lock ask what to do with it
+ */
+ virtual Action execute(
+ const PoolQuery& /*error*/
+ ) { return DELETE; }
- };
+ virtual void finish(
+ Error /*error*/
+ ) {}
- struct SavingLocksReport : public callback::ReportBase
- {
- enum Action {
- ABORT, // abort and return error
- DELETE, // delete conflicted lock
- IGNORE // skip conflict lock
- };
+ };
- enum Error {
- NO_ERROR,
- ABORTED // cleaning aborted
- };
+ struct SavingLocksReport : public callback::ReportBase
+ {
+ enum Action {
+ ABORT, // abort and return error
+ DELETE, // delete conflicted lock
+ IGNORE // skip conflict lock
+ };
- enum ConflictState{
- SAME_RESULTS,
- INTERSECT
- };
+ enum Error {
+ NO_ERROR,
+ ABORTED // cleaning aborted
+ };
- virtual void start() {}
+ enum ConflictState{
+ SAME_RESULTS,
+ INTERSECT
+ };
- virtual bool progress() /*still alive*/
- { return true; }
+ virtual void start() {}
- /**
- * When user unlock something which is locked by non-identical query
- */
- virtual Action conflict(
- const PoolQuery&, /*problematic query*/
- ConflictState
- ) { return DELETE; }
+ virtual bool progress() /*still alive*/
+ { return true; }
- virtual void finish(
- Error /*error*/
- ) {}
+ /**
+ * When user unlock something which is locked by non-identical query
+ */
+ virtual Action conflict(
+ const PoolQuery&, /*problematic query*/
+ ConflictState
+ ) { return DELETE; }
- };
- /////////////////////////////////////////////////////////////////
- } // namespace locks
- ///////////////////////////////////////////////////////////////////
+ virtual void finish(
+ Error /*error*/
+ ) {}
+ };
/////////////////////////////////////////////////////////////////