libzypp 17.37.10

zypp::sat::Transaction Class Reference

Libsolv transaction wrapper. More...

`#include <zypp/sat/Transaction.h>`

Inheritance diagram for zypp::sat::Transaction:

## Classes
struct | FilterAction
struct | Impl
| Transaction implementation. More...
struct | LoadFromPoolType
| Ctor arg type. More...
class | Step
| A single step within a Transaction. More...

## Public Types
enum | StepType { TRANSACTION_IGNORE = 0x00 , TRANSACTION_ERASE = 0x10 , TRANSACTION_INSTALL = 0x20 , TRANSACTION_MULTIINSTALL = 0x30 }
| Type of (rpm) action to perform in a Step. More...
enum | StepStage { STEP_TODO = (1 << 0) , STEP_DONE = (1 << 1) , STEP_ERROR = (1 << 2) }
| Step action result. More...
using | iterator = detail::Transaction_iterator
using | const_iterator = detail::Transaction_const_iterator
Public Types inherited from zypp::sat::SolvIterMixin< Transaction, detail::Transaction_const_iterator >
using | size_type
using | Solvable_iterator
using | PoolItem_iterator
using | Selectable_iterator

## Public Member Functions
| ZYPP_DECLARE_FLAGS (StepStages, StepStage)
| Transaction ()
| Default ctor: empty transaction.
| Transaction (LoadFromPoolType)
| Ctor loading the default pools transaction.
| ~Transaction ()
| Dtor.
bool | valid () const
| Whether transaction actually contains data and also fits the current pools content.
| operator bool () const
| Validate object in a boolean context: valid.
bool | order ()
| Order transaction steps for commit.
bool | empty () const
| Whether the transaction contains any steps.
size_t | size () const
| Number of steps in transaction steps.
const_iterator | begin () const
| Iterator to the first TransactionStep.
iterator | begin ()
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const_iterator | end () const
| Iterator behind the last TransactionStep.
iterator | end ()
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const_iterator | find (const sat::Solvable &solv_r) const
| Return iterator pointing to solv_r or end.
iterator | find (const sat::Solvable &solv_r)
const_iterator | find (const ResObject::constPtr &resolvable_r) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
iterator | find (const ResObject::constPtr &resolvable_r)
const_iterator | find (const PoolItem &pi_r) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
iterator | find (const PoolItem &pi_r)
Public Member Functions inherited from zypp::sat::SolvIterMixin< Transaction, detail::Transaction_const_iterator >
bool | empty () const
| Whether the collection is epmty.
size_type | size () const
| Size of the collection.
bool | contains (const TSolv &solv_r) const
| Whether collection contains a specific Solvable.
Solvable_iterator | solvableBegin () const
Solvable_iterator | solvableEnd () const
Iterable< Solvable_iterator > | solvable () const
PoolItem_iterator | poolItemBegin () const
PoolItem_iterator | poolItemEnd () const
Iterable< PoolItem_iterator > | poolItem () const
Selectable_iterator | selectableBegin () const
Selectable_iterator | selectableEnd () const
Iterable< Selectable_iterator > | selectable () const

## Static Public Attributes
static constexpr LoadFromPoolType | loadFromPool = LoadFromPoolType()

## Friends
std::ostream & | operator<< (std::ostream &str, const Transaction &obj)
std::ostream & | dumpOn (std::ostream &str, const Transaction &obj)
bool | operator== (const Transaction &lhs, const Transaction &rhs)

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const Transaction::Impl &obj)
| Stream output.
std::ostream & | operator<< (std::ostream &str, const Transaction &obj) ZYPP_API
| Stream output.
std::ostream & | dumpOn (std::ostream &str, const Transaction &obj) ZYPP_API
| Verbose stream output.
bool | operator== (const Transaction &lhs, const Transaction &rhs) ZYPP_API
bool | operator!= (const Transaction &lhs, const Transaction &rhs)
std::ostream & | operator<< (std::ostream &str, const Transaction::Step &obj) ZYPP_API
| Stream output.

## Iterate action steps (omit TRANSACTION_IGNORE steps).
All these methods allow to pass an optional OR'd combination of StepStages as filter. Per default all steps are processed/counted. Transaction trans; for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() ) { ... // process all steps not DONE (ERROR and TODO) } zypp::sat::Transaction::Transaction Transaction() Default ctor: empty transaction. Definition Transaction.cc:316 zypp::sat::Transaction::actionBegin action_iterator actionBegin(StepStages filter_r=StepStages()) const Pointer to the 1st action step in [filtered] transaction. Definition Transaction.h:380 zypp::sat::Transaction::actionEnd action_iterator actionEnd() const Pointer behind the last action step in transaction. Definition Transaction.h:383 zypp::sat::Transaction::STEP_DONE @ STEP_DONE [OK] success Definition Transaction.h:74 for_ #define for_(IT, BEG, END) Convenient for-loops using iterator. Definition Easy.h:27
using | action_iterator = filter_iterator<FilterAction, const_iterator>
RW_pointer< Impl > | _pimpl
| Pointer to implementation.
bool | actionEmpty (StepStages filter_r=StepStages()) const
| Whether the [filtered] transaction contains any steps .
size_t | actionSize (StepStages filter_r=StepStages()) const
| Number of steps in [filtered] transaction steps.
action_iterator | actionBegin (StepStages filter_r=StepStages()) const
| Pointer to the 1st action step in [filtered] transaction.
action_iterator | actionEnd () const
| Pointer behind the last action step in transaction.
Iterable< action_iterator > | action (StepStages filter_r=StepStages()) const
| Iterate the [filtered] transaction steps.
int | installedResult (Queue &result_r) const
| Return all packages that would be installed after the transaction is run.
StringQueue | autoInstalled () const
| Return the ident strings of all packages that would be auto-installed after the transaction is run.
void | autoInstalled (const StringQueue &queue_r)
| Set the ident strings of all packages that would be auto-installed after the transaction is run.

## Additional Inherited Members
| SolvIterMixin ()
| ~SolvIterMixin ()
SolvIterMixin & | operator= (const SolvIterMixin &)=default

## Detailed Description

Libsolv transaction wrapper.

Note
  Note that Transaction is derived from sat::SolvIterMixin which makes PoolItem and Selectable iterators automatically available.
  Changing the ResPool content (loading/unloading repositories) invalidates all outstanding transaction data.

See also
  valid.

Note
  .The transaction may inlude steps of type TRANSACTION_IGNORE which do not cause/require any specific action. To skip those informal steps when iterating, use the actionBegin /actionEnd methods.

Definition at line 51 of file Transaction.h.

## Member Typedef Documentation

## ◆ iterator

using zypp::sat::Transaction::iterator = detail::Transaction_iterator

Definition at line 115 of file Transaction.h.

## ◆ const_iterator

using zypp::sat::Transaction::const_iterator = detail::Transaction_const_iterator

Definition at line 116 of file Transaction.h.

## ◆ action_iterator

using zypp::sat::Transaction::action_iterator = filter_iterator<FilterAction, const_iterator>

Definition at line 154 of file Transaction.h.

## Member Enumeration Documentation

## ◆ StepType

enum zypp::sat::Transaction::StepType

Type of (rpm) action to perform in a Step.

Enumerator
TRANSACTION_IGNORE | [ ] Nothing (includes implicit deletes due to obsoletes and non-package actions)
TRANSACTION_ERASE | [-] Delete item
TRANSACTION_INSTALL | [+] Install(update) item
TRANSACTION_MULTIINSTALL | [M] Install(multiversion) item ( See also ZConfig::multiversion)

Definition at line 62 of file Transaction.h.

## ◆ StepStage

enum zypp::sat::Transaction::StepStage

Step action result.

Enumerator
STEP_TODO | [__] unprocessed
STEP_DONE | [OK] success
STEP_ERROR | [**] error

Definition at line 71 of file Transaction.h.

## Constructor & Destructor Documentation

## ◆ Transaction() [1/2]

zypp::sat::Transaction::Transaction | ( |  | ) |

Default ctor: empty transaction.

Definition at line 316 of file Transaction.cc.

## ◆ Transaction() [2/2]

zypp::sat::Transaction::Transaction | ( | LoadFromPoolType |  | ) |

Ctor loading the default pools transaction.

Definition at line 320 of file Transaction.cc.

## ◆ ~Transaction()

zypp::sat::Transaction::~Transaction | ( |  | ) |

Dtor.

Definition at line 324 of file Transaction.cc.

## Member Function Documentation

## ◆ ZYPP_DECLARE_FLAGS()

zypp::sat::Transaction::ZYPP_DECLARE_FLAGS | ( | StepStages | ,
|  | StepStage | )

## ◆ valid()

bool zypp::sat::Transaction::valid | ( |  | ) | const

Whether transaction actually contains data and also fits the current pools content.

Definition at line 327 of file Transaction.cc.

## ◆ operator bool()

zypp::sat::Transaction::operator bool | ( |  | ) | const
| inline explicit

Validate object in a boolean context: valid.

Definition at line 99 of file Transaction.h.

## ◆ order()

bool zypp::sat::Transaction::order | ( |  | ) |

Order transaction steps for commit.

It's cheap to call it for an aleready ordered Transaction. This invalidates outstanding iterators. Returns whether Transaction is valid.

Definition at line 330 of file Transaction.cc.

## ◆ empty()

bool zypp::sat::Transaction::empty | ( |  | ) | const

Whether the transaction contains any steps.

Definition at line 333 of file Transaction.cc.

## ◆ size()

size_t zypp::sat::Transaction::size | ( |  | ) | const

Number of steps in transaction steps.

Definition at line 336 of file Transaction.cc.

## ◆ begin() [1/2]

Transaction::const_iterator zypp::sat::Transaction::begin | ( |  | ) | const

Iterator to the first TransactionStep.

Definition at line 339 of file Transaction.cc.

## ◆ begin() [2/2]

Transaction::iterator zypp::sat::Transaction::begin | ( |  | ) |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 342 of file Transaction.cc.

## ◆ end() [1/2]

Transaction::const_iterator zypp::sat::Transaction::end | ( |  | ) | const

Iterator behind the last TransactionStep.

Definition at line 345 of file Transaction.cc.

## ◆ end() [2/2]

Transaction::iterator zypp::sat::Transaction::end | ( |  | ) |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 348 of file Transaction.cc.

## ◆ find() [1/6]

Transaction::const_iterator zypp::sat::Transaction::find | ( | const sat::Solvable & | solv_r | ) | const

Return iterator pointing to solv_r or end.

Definition at line 351 of file Transaction.cc.

## ◆ find() [2/6]

Transaction::iterator zypp::sat::Transaction::find | ( | const sat::Solvable & | solv_r | ) |

Definition at line 354 of file Transaction.cc.

## ◆ find() [3/6]

Transaction::const_iterator zypp::sat::Transaction::find | ( | const ResObject::constPtr & | resolvable_r | ) | const
| inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 352 of file Transaction.h.

## ◆ find() [4/6]

Transaction::iterator zypp::sat::Transaction::find | ( | const ResObject::constPtr & | resolvable_r | ) |
| inline

Definition at line 355 of file Transaction.h.

## ◆ find() [5/6]

Transaction::const_iterator zypp::sat::Transaction::find | ( | const PoolItem & | pi_r | ) | const
| inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 358 of file Transaction.h.

## ◆ find() [6/6]

Transaction::iterator zypp::sat::Transaction::find | ( | const PoolItem & | pi_r | ) |
| inline

Definition at line 361 of file Transaction.h.

## ◆ actionEmpty()

bool zypp::sat::Transaction::actionEmpty | ( | StepStages | filter_r = StepStages() | ) | const
| inline

Whether the [filtered] transaction contains any steps .

Definition at line 386 of file Transaction.h.

## ◆ actionSize()

size_t zypp::sat::Transaction::actionSize | ( | StepStages | filter_r = StepStages() | ) | const
| inline

Number of steps in [filtered] transaction steps.

Definition at line 389 of file Transaction.h.

## ◆ actionBegin()

Transaction::action_iterator zypp::sat::Transaction::actionBegin | ( | StepStages | filter_r = StepStages() | ) | const
| inline

Pointer to the 1st action step in [filtered] transaction.

Definition at line 380 of file Transaction.h.

## ◆ actionEnd()

Transaction::action_iterator zypp::sat::Transaction::actionEnd | ( |  | ) | const
| inline

Pointer behind the last action step in transaction.

Definition at line 383 of file Transaction.h.

## ◆ action()

Iterable< Transaction::action_iterator > zypp::sat::Transaction::action | ( | StepStages | filter_r = StepStages() | ) | const
| inline

Iterate the [filtered] transaction steps.

Definition at line 397 of file Transaction.h.

## ◆ installedResult()

int zypp::sat::Transaction::installedResult | ( | Queue & | result_r | ) | const

Return all packages that would be installed after the transaction is run.

The new packages are put at the head of the queue, the number of new packages is returned. (wraps libsolv::transaction_installedresult)

Definition at line 357 of file Transaction.cc.

## ◆ autoInstalled() [1/2]

StringQueue zypp::sat::Transaction::autoInstalled | ( |  | ) | const

Return the ident strings of all packages that would be auto-installed after the transaction is run.

Definition at line 360 of file Transaction.cc.

## ◆ autoInstalled() [2/2]

void zypp::sat::Transaction::autoInstalled | ( | const StringQueue & | queue_r | ) |

Set the ident strings of all packages that would be auto-installed after the transaction is run.

Definition at line 363 of file Transaction.cc.

## Friends And Related Symbol Documentation

## ◆ operator<< [1/4]

std::ostream & operator<< | ( | std::ostream & | str,
|  | const Transaction & | obj )
| friend

Definition at line 366 of file Transaction.cc.

## ◆ dumpOn [1/2]

std::ostream & dumpOn | ( | std::ostream & | str,
|  | const Transaction & | obj )
| friend

Definition at line 369 of file Transaction.cc.

## ◆ operator== [1/2]

bool operator== | ( | const Transaction & | lhs,
|  | const Transaction & | rhs )
| friend

Definition at line 378 of file Transaction.cc.

## ◆ operator<<() [2/4]

std::ostream & operator<< | ( | std::ostream & | str,
|  | const Transaction & | obj )
| related

Stream output.

Definition at line 366 of file Transaction.cc.

## ◆ dumpOn() [2/2]

std::ostream & dumpOn | ( | std::ostream & | str,
|  | const Transaction & | obj )
| related

Verbose stream output.

Definition at line 369 of file Transaction.cc.

## ◆ operator==() [2/2]

bool operator== | ( | const Transaction & | lhs,
|  | const Transaction & | rhs )
| related

Definition at line 378 of file Transaction.cc.

## ◆ operator!=()

bool operator!= | ( | const Transaction & | lhs,
|  | const Transaction & | rhs )
| related

Definition at line 204 of file Transaction.h.

## Member Data Documentation

## ◆ loadFromPool

Transaction::LoadFromPoolType zypp::sat::Transaction::loadFromPool = LoadFromPoolType()
| static constexpr

Definition at line 82 of file Transaction.h.

## ◆ _pimpl

RW_pointer<Impl> zypp::sat::Transaction::_pimpl
| private

Pointer to implementation.

Definition at line 189 of file Transaction.h.

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

- zypp/sat/Transaction.h
- zypp/sat/Transaction.cc