# Transaction Element API.

## Files
file | rpmte.h

| Structures used for an "rpmte" transaction element.
## Typedefs
typedef struct tsortInfo_s * | tsortInfo
| Transaction element ordering chain linkage.
typedef struct rpmtsi_s * | rpmtsi
| Transaction element iterator.
typedef enum rpmElementType_e | rpmElementType
| Transaction element type.
## Enumerations
enum | rpmElementType_e { TR_ADDED = (1 << 0), TR_REMOVED = (1 << 1) }
| Transaction element type. More...
## Functions
rpmte | rpmteFree (rpmte te)
| Destroy a transaction element.
rpmte | rpmteNew (const rpmts ts, Header h, rpmElementType type, fnpyKey key, rpmRelocation *relocs, int dboffset)
| Create a transaction element.
Header | rpmteHeader (rpmte te)
| Retrieve header from transaction element.
Header | rpmteSetHeader (rpmte te, Header h)
| Save header into transaction element.
rpmElementType | rpmteType (rpmte te)
| Retrieve type of transaction element.
const char * | rpmteN (rpmte te)
| Retrieve name string of transaction element.
const char * | rpmteE (rpmte te)
| Retrieve epoch string of transaction element.
const char * | rpmteV (rpmte te)
| Retrieve version string of transaction element.
const char * | rpmteR (rpmte te)
| Retrieve release string of transaction element.
const char * | rpmteA (rpmte te)
| Retrieve arch string of transaction element.
const char * | rpmteO (rpmte te)
| Retrieve os string of transaction element.
int | rpmteIsSource (rpmte te)
| Retrieve isSource attribute of transaction element.
rpm_color_t | rpmteColor (rpmte te)
| Retrieve color bits of transaction element.
rpm_color_t | rpmteSetColor (rpmte te, rpm_color_t color)
| Set color bits of transaction element.
unsigned int | rpmteDBInstance (rpmte te)
| Retrieve last instance installed to the database.
void | rpmteSetDBInstance (rpmte te, unsigned int instance)
| Set last instance installed to the database.
rpm_loff_t | rpmtePkgFileSize (rpmte te)
| Retrieve size in bytes of package file.
int | rpmteDepth (rpmte te)
| Retrieve dependency tree depth of transaction element.
int | rpmteSetDepth (rpmte te, int ndepth)
| Set dependency tree depth of transaction element.
int | rpmteBreadth (rpmte te)
| Retrieve dependency tree breadth of transaction element.
int | rpmteSetBreadth (rpmte te, int nbreadth)
| Set dependency tree breadth of transaction element.
int | rpmteNpreds (rpmte te)
| Retrieve tsort no.
int | rpmteSetNpreds (rpmte te, int npreds)
| Set tsort no.
int | rpmteTree (rpmte te)
| Retrieve tree index of transaction element.
int | rpmteSetTree (rpmte te, int ntree)
| Set tree index of transaction element.
rpmte | rpmteParent (rpmte te)
| Retrieve parent transaction element.
rpmte | rpmteSetParent (rpmte te, rpmte pte)
| Set parent transaction element.
int | rpmteDegree (rpmte te)
| Retrieve number of children of transaction element.
int | rpmteSetDegree (rpmte te, int ndegree)
| Set number of children of transaction element.
tsortInfo | rpmteTSI (rpmte te)
| Retrieve tsort info for transaction element.
void | rpmteFreeTSI (rpmte te)
| Destroy tsort info of transaction element.
void | rpmteNewTSI (rpmte te)
| Initialize tsort info of transaction element.
void | rpmteCleanDS (rpmte te)
| Destroy dependency set info of transaction element.
void | rpmteSetDependsOn (rpmte te, rpmte depends)
| Set dependent element of TR_REMOVED transaction element.
rpmte | rpmteDependsOn (rpmte te)
| Retrieve dependent element of TR_REMOVED transaction element.
int | rpmteDBOffset (rpmte te)
| Retrieve rpmdb instance of TR_REMOVED transaction element.
const char * | rpmteEVR (rpmte te)
| Retrieve [epoch:]version-release string from transaction element.
const char * | rpmteNEVR (rpmte te)
| Retrieve name-[epoch:]version-release string from transaction element.
const char * | rpmteNEVRA (rpmte te)
| Retrieve name-[epoch:]version-release.arch string from transaction element.
FD_t | rpmteFd (rpmte te)
| Retrieve file handle from transaction element.
fnpyKey | rpmteKey (rpmte te)
| Retrieve key from transaction element.
int | rpmteFailed (rpmte te)
| Return failed status of transaction element.
rpmds | rpmteDS (rpmte te, rpmTag tag)
| Retrieve dependency tag set from transaction element.
rpmfi | rpmteFI (rpmte te)
| Retrieve file info tag set from transaction element.
void | rpmteColorDS (rpmte te, rpmTag tag)
| Calculate transaction element dependency colors/refs from file info.
int | rpmtsiOc (rpmtsi tsi)
| Return transaction element index.
rpmtsi | rpmtsiFree (rpmtsi tsi)
| Destroy transaction element iterator.
rpmtsi | rpmtsiInit (rpmts ts)
| Create transaction element iterator.
rpmte | rpmtsiNext (rpmtsi tsi, rpmElementType type)
| Return next transaction element of type.

## Typedef Documentation

typedef enum rpmElementType_e rpmElementType

Transaction element type.

typedef struct rpmtsi_s* rpmtsi

Transaction element iterator.

Definition at line 27 of file rpmte.h.

typedef struct tsortInfo_s* tsortInfo

Transaction element ordering chain linkage.

Definition at line 22 of file rpmte.h.

## Enumeration Type Documentation

enum rpmElementType_e

Transaction element type.

Enumerator:

  TR_ADDED | Package will be installed.
  TR_REMOVED | Package will be removed.

Definition at line 32 of file rpmte.h.

## Function Documentation

const char* rpmteA | ( | rpmte | te | ) |

Retrieve arch string of transaction element.

Parameters:

  | te | transaction element

Returns:
  arch string

int rpmteBreadth | ( | rpmte | te | ) |

Retrieve dependency tree breadth of transaction element.

Parameters:

  | te | transaction element

Returns:
  breadth

void rpmteCleanDS | ( | rpmte | te | ) |

Destroy dependency set info of transaction element.

Parameters:

  | te | transaction element

rpm_color_t rpmteColor | ( | rpmte | te | ) |

Retrieve color bits of transaction element.

Parameters:

  | te | transaction element

Returns:
  color bits

void rpmteColorDS | ( | rpmte | te,
|  | rpmTag | tag |
| ) |  |  |

Calculate transaction element dependency colors/refs from file info.

Parameters:

  | te | transaction element
  | tag | dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)

unsigned int rpmteDBInstance | ( | rpmte | te | ) |

Retrieve last instance installed to the database.

Parameters:

  | te | transaction element

Returns:
  last install instance.

int rpmteDBOffset | ( | rpmte | te | ) |

Retrieve rpmdb instance of TR_REMOVED transaction element.

Parameters:

  | te | transaction element

Returns:
  rpmdb instance

int rpmteDegree | ( | rpmte | te | ) |

Retrieve number of children of transaction element.

Parameters:

  | te | transaction element

Returns:
  tree index

rpmte rpmteDependsOn | ( | rpmte | te | ) |

Retrieve dependent element of TR_REMOVED transaction element.

Parameters:

  | te | transaction element

Returns:
  dependent transaction element

int rpmteDepth | ( | rpmte | te | ) |

Retrieve dependency tree depth of transaction element.

Parameters:

  | te | transaction element

Returns:
  depth

rpmds rpmteDS | ( | rpmte | te,
|  | rpmTag | tag |
| ) |  |  |

Retrieve dependency tag set from transaction element.

Parameters:

  | te | transaction element
  | tag | dependency tag

Returns:
  dependency tag set

const char* rpmteE | ( | rpmte | te | ) |

Retrieve epoch string of transaction element.

Parameters:

  | te | transaction element

Returns:
  epoch string

const char* rpmteEVR | ( | rpmte | te | ) |

Retrieve [epoch:]version-release string from transaction element.

Parameters:

  | te | transaction element

Returns:
  [epoch:]version-release string

int rpmteFailed | ( | rpmte | te | ) |

Return failed status of transaction element.

Parameters:

  | te | transaction element

Returns:
  1 if transaction element (or its parents) failed

FD_t rpmteFd | ( | rpmte | te | ) |

Retrieve file handle from transaction element.

Parameters:

  | te | transaction element

Returns:
  file handle

rpmfi rpmteFI | ( | rpmte | te | ) |

Retrieve file info tag set from transaction element.

Parameters:

  | te | transaction element

Returns:
  file info tag set

rpmte rpmteFree | ( | rpmte | te | ) |

Destroy a transaction element.

Parameters:

  | te | transaction element

Returns:
  NULL always

void rpmteFreeTSI | ( | rpmte | te | ) |

Destroy tsort info of transaction element.

Parameters:

  | te | transaction element

Header rpmteHeader | ( | rpmte | te | ) |

Retrieve header from transaction element.

Parameters:

  | te | transaction element

Returns:
  header

int rpmteIsSource | ( | rpmte | te | ) |

Retrieve isSource attribute of transaction element.

Parameters:

  | te | transaction element

Returns:
  isSource attribute

fnpyKey rpmteKey | ( | rpmte | te | ) |

Retrieve key from transaction element.

Parameters:

  | te | transaction element

Returns:
  key

const char* rpmteN | ( | rpmte | te | ) |

Retrieve name string of transaction element.

Parameters:

  | te | transaction element

Returns:
  name string

const char* rpmteNEVR | ( | rpmte | te | ) |

Retrieve name-[epoch:]version-release string from transaction element.

Parameters:

  | te | transaction element

Returns:
  name-[epoch:]version-release string

const char* rpmteNEVRA | ( | rpmte | te | ) |

Retrieve name-[epoch:]version-release.arch string from transaction element.

Parameters:

  | te | transaction element

Returns:
  name-[epoch:]version-release.arch string

rpmte rpmteNew | ( | const rpmts | ts,
|  | Header | h,
|  | rpmElementType | type,
|  | fnpyKey | key,
|  | rpmRelocation * | relocs,
|  | int | dboffset |
| ) |  |  |

Create a transaction element.

Parameters:

  | ts | transaction set
  | h | header
  | type | TR_ADDED/TR_REMOVED
  | key | (TR_ADDED) package retrieval key (e.g. file name)
  | relocs | (TR_ADDED) package file relocations
  | dboffset | unused

Returns:
  new transaction element

void rpmteNewTSI | ( | rpmte | te | ) |

Initialize tsort info of transaction element.

Parameters:

  | te | transaction element

int rpmteNpreds | ( | rpmte | te | ) |

Retrieve tsort no.

of predecessors of transaction element.

Parameters:

  | te | transaction element

Returns:
  no. of predecessors

const char* rpmteO | ( | rpmte | te | ) |

Retrieve os string of transaction element.

Parameters:

  | te | transaction element

Returns:
  os string

rpmte rpmteParent | ( | rpmte | te | ) |

Retrieve parent transaction element.

Parameters:

  | te | transaction element

Returns:
  parent transaction element

rpm_loff_t rpmtePkgFileSize | ( | rpmte | te | ) |

Retrieve size in bytes of package file.

Todo:
  Signature header is estimated at 256b.

Parameters:

  | te | transaction element

Returns:
  size in bytes of package file.

const char* rpmteR | ( | rpmte | te | ) |

Retrieve release string of transaction element.

Parameters:

  | te | transaction element

Returns:
  release string

int rpmteSetBreadth | ( | rpmte | te,
|  | int | nbreadth |
| ) |  |  |

Set dependency tree breadth of transaction element.

Parameters:

  | te | transaction element
  | nbreadth | new breadth

Returns:
  previous breadth

rpm_color_t rpmteSetColor | ( | rpmte | te,
|  | rpm_color_t | color |
| ) |  |  |

Set color bits of transaction element.

Parameters:

  | te | transaction element
  | color | new color bits

Returns:
  previous color bits

void rpmteSetDBInstance | ( | rpmte | te,
|  | unsigned int | instance |
| ) |  |  |

Set last instance installed to the database.

Parameters:

  | te | transaction element
  | instance | Database instance of last install element.

Returns:
  last install instance.

int rpmteSetDegree | ( | rpmte | te,
|  | int | ndegree |
| ) |  |  |

Set number of children of transaction element.

Parameters:

  | te | transaction element
  | ndegree | new number of children

Returns:
  previous number of children

void rpmteSetDependsOn | ( | rpmte | te,
|  | rpmte | depends |
| ) |  |  |

Set dependent element of TR_REMOVED transaction element.

Parameters:

  | te | transaction element
  | depends | dependent transaction element

int rpmteSetDepth | ( | rpmte | te,
|  | int | ndepth |
| ) |  |  |

Set dependency tree depth of transaction element.

Parameters:

  | te | transaction element
  | ndepth | new depth

Returns:
  previous depth

Header rpmteSetHeader | ( | rpmte | te,
|  | Header | h |
| ) |  |  |

Save header into transaction element.

Parameters:

  | te | transaction element
  | h | header

Returns:
  NULL always

int rpmteSetNpreds | ( | rpmte | te,
|  | int | npreds |
| ) |  |  |

Set tsort no.

of predecessors of transaction element.

Parameters:

  | te | transaction element
  | npreds | new no. of predecessors

Returns:
  previous no. of predecessors

rpmte rpmteSetParent | ( | rpmte | te,
|  | rpmte | pte |
| ) |  |  |

Set parent transaction element.

Parameters:

  | te | transaction element
  | pte | new parent transaction element

Returns:
  previous parent transaction element

int rpmteSetTree | ( | rpmte | te,
|  | int | ntree |
| ) |  |  |

Set tree index of transaction element.

Parameters:

  | te | transaction element
  | ntree | new tree index

Returns:
  previous tree index

int rpmteTree | ( | rpmte | te | ) |

Retrieve tree index of transaction element.

Parameters:

  | te | transaction element

Returns:
  tree index

tsortInfo rpmteTSI | ( | rpmte | te | ) |

Retrieve tsort info for transaction element.

Parameters:

  | te | transaction element

Returns:
  tsort info

rpmElementType rpmteType | ( | rpmte | te | ) |

Retrieve type of transaction element.

Parameters:

  | te | transaction element

Returns:
  type

const char* rpmteV | ( | rpmte | te | ) |

Retrieve version string of transaction element.

Parameters:

  | te | transaction element

Returns:
  version string

rpmtsi rpmtsiFree | ( | rpmtsi | tsi | ) |

Destroy transaction element iterator.

Parameters:

  | tsi | transaction element iterator

Returns:
  NULL always

rpmtsi rpmtsiInit | ( | rpmts | ts | ) |

Create transaction element iterator.

Parameters:

  | ts | transaction set

Returns:
  transaction element iterator

rpmte rpmtsiNext | ( | rpmtsi | tsi,
|  | rpmElementType | type |
| ) |  |  |

Return next transaction element of type.

Parameters:

  | tsi | transaction element iterator
  | type | transaction element type selector (0 for any)

Returns:
  next transaction element of type, NULL on termination

int rpmtsiOc | ( | rpmtsi | tsi | ) |

Return transaction element index.

Parameters:

  | tsi | transaction element iterator

Returns:
  transaction element index