summaryrefslogtreecommitdiff
path: root/lib/idtx.h
blob: e25b28ce2df2fb5e16231a24b9c9cb480764ad44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef H_RPMIDTX
#define H_RPMIDTX

#include <rpm/rpmtypes.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  * A rollback transaction id element.
 *   */
typedef struct IDT_s {
    unsigned int instance;      /*!< installed package transaction id. */
    const char * key;           /*! removed package file name. */
    Header h;                   /*!< removed package header. */
    union {
        uint32_t u32;            /*!< install/remove transaction id */
    } val;
} * IDT;

/**
 * A rollback transaction id index.
 */
typedef struct IDTindex_s {
    int delta;			/*!< no. elements to realloc as a chunk. */
    int size;			/*!< size of id index element. */
    int alloced;		/*!< current number of elements allocated. */
    int nidt;			/*!< current number of elements initialized. */
    IDT idt;			/*!< id index elements. */
} * IDTX;

/**
 * Destroy id index.
 * @param idtx		id index
 * @return		NULL always
 */
IDTX IDTXfree(IDTX idtx);

/**
 * Create id index.
 * @return		new id index
 */
IDTX IDTXnew(void);

/**
 * Insure that index has room for "need" elements.
 * @param idtx		id index
 * @param need		additional no. of elements needed
 * @return 		id index (with room for "need" elements)
 */
IDTX IDTXgrow(IDTX idtx, int need);

/**
 * Sort tag (instance,value) pairs.
 * @param idtx		id index
 * @return 		id index
 */
IDTX IDTXsort(IDTX idtx);

/**
 * Load tag (instance,value) pairs from rpm databse, and return sorted id index.
 * @param ts		transaction set
 * @param tag		rpm tag
 * @return 		id index
 */
IDTX IDTXload(rpmts ts, rpm_tag_t tag);

/**
 * Load tag (instance,value) pairs from packages, and return sorted id index.
 * @param ts		transaction set
 * @param globstr	glob expression
 * @param tag		rpm tag
 * @return 		id index
 */
IDTX IDTXglob(rpmts ts, const char * globstr, rpm_tag_t tag);

#ifdef __cplusplus
}   
#endif

#endif /* H_RPMIDTX */