- update transaction ordering code
[platform/upstream/libsolv.git] / src / transaction.h
1 /*
2  * Copyright (c) 2007-2009, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7
8 /*
9  * transaction.h
10  *
11  */
12
13 #ifndef SATSOLVER_TRANSACTION_H
14 #define SATSOLVER_TRANSACTION_H
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 #include "pooltypes.h"
21 #include "queue.h"
22 #include "bitmap.h"
23
24 struct _Pool;
25
26 /* internal */
27 struct _TransactionElement {
28   Id p;                 /* solvable id */
29   Id type;              /* installation type */
30   Id edges;
31   Id mark;
32 };
33
34 typedef struct _Transaction {
35   struct _Pool *pool;           /* back pointer to pool */
36
37   Queue steps;                  /* the transaction steps */
38
39   Queue transaction_info;
40   Id *transaction_installed;
41   Map transactsmap;
42
43   struct _TransactionElement *tes;
44   int ntes;
45   Id *invedgedata;
46
47 } Transaction;
48
49
50 /* step types */
51 #define SOLVER_TRANSACTION_ERASE                0x10
52 #define SOLVER_TRANSACTION_REINSTALLED          0x11
53 #define SOLVER_TRANSACTION_DOWNGRADED           0x12
54 #define SOLVER_TRANSACTION_CHANGED              0x13
55 #define SOLVER_TRANSACTION_UPGRADED             0x14
56 #define SOLVER_TRANSACTION_REPLACED             0x15
57
58 #define SOLVER_TRANSACTION_INSTALL              0x20
59 #define SOLVER_TRANSACTION_REINSTALL            0x21
60 #define SOLVER_TRANSACTION_DOWNGRADE            0x22
61 #define SOLVER_TRANSACTION_CHANGE               0x23
62 #define SOLVER_TRANSACTION_UPGRADE              0x24
63 #define SOLVER_TRANSACTION_REPLACE              0x25
64
65 #define SOLVER_TRANSACTION_MULTIINSTALL         0x30
66 #define SOLVER_TRANSACTION_MULTIREINSTALL       0x31
67
68 /* show modes */
69 #define SOLVER_TRANSACTION_SHOW_ACTIVE          (1 << 0)
70 #define SOLVER_TRANSACTION_SHOW_ALL             (1 << 1)
71 #define SOLVER_TRANSACTION_SHOW_REPLACES        (1 << 2)
72
73 extern void transaction_init(Transaction *trans, struct _Pool *pool);
74 extern void transaction_free(Transaction *trans);
75 extern void transaction_calculate(Transaction *trans, Queue *decisionq, Map *noobsmap);
76 extern void solver_transaction_all_pkgs(Transaction *trans, Id p, Queue *pkgs);
77 extern Id   solver_transaction_pkg(Transaction *trans, Id p);
78 extern Id   solver_transaction_show(Transaction *trans, Id type, Id p, int mode);
79 extern void transaction_order(Transaction *trans);
80 extern void transaction_check(Transaction *trans);
81
82 #ifdef __cplusplus
83 }
84 #endif
85
86 #endif