- make out parameters last in function calls
[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 struct _TransactionOrderdata;
26
27 typedef struct _Transaction {
28   struct _Pool *pool;           /* back pointer to pool */
29
30   Queue steps;                  /* the transaction steps */
31
32   Queue transaction_info;
33   Id *transaction_installed;
34   Map transactsmap;
35   Map noobsmap;
36
37   struct _TransactionOrderdata *orderdata;
38
39 } Transaction;
40
41
42 /* step types */
43 #define SOLVER_TRANSACTION_IGNORE               0x00
44
45 #define SOLVER_TRANSACTION_ERASE                0x10
46 #define SOLVER_TRANSACTION_REINSTALLED          0x11
47 #define SOLVER_TRANSACTION_DOWNGRADED           0x12
48 #define SOLVER_TRANSACTION_CHANGED              0x13
49 #define SOLVER_TRANSACTION_UPGRADED             0x14
50 #define SOLVER_TRANSACTION_OBSOLETED            0x15
51
52 #define SOLVER_TRANSACTION_INSTALL              0x20
53 #define SOLVER_TRANSACTION_REINSTALL            0x21
54 #define SOLVER_TRANSACTION_DOWNGRADE            0x22
55 #define SOLVER_TRANSACTION_CHANGE               0x23
56 #define SOLVER_TRANSACTION_UPGRADE              0x24
57 #define SOLVER_TRANSACTION_OBSOLETES            0x25
58
59 #define SOLVER_TRANSACTION_MULTIINSTALL         0x30
60 #define SOLVER_TRANSACTION_MULTIREINSTALL       0x31
61
62 #define SOLVER_TRANSACTION_MAXTYPE              0x3f
63
64 /* modes */
65 #define SOLVER_TRANSACTION_SHOW_ACTIVE          (1 << 0)
66 #define SOLVER_TRANSACTION_SHOW_ALL             (1 << 1)
67 #define SOLVER_TRANSACTION_SHOW_OBSOLETES       (1 << 2)
68 #define SOLVER_TRANSACTION_SHOW_MULTIINSTALL    (1 << 3)
69 #define SOLVER_TRANSACTION_CHANGE_IS_REINSTALL  (1 << 4)
70 #define SOLVER_TRANSACTION_MERGE_VENDORCHANGES  (1 << 5)
71 #define SOLVER_TRANSACTION_MERGE_ARCHCHANGES    (1 << 6)
72
73 #define SOLVER_TRANSACTION_RPM_ONLY             (1 << 7)
74
75 /* extra classifications */
76 #define SOLVER_TRANSACTION_ARCHCHANGE           0x100
77 #define SOLVER_TRANSACTION_VENDORCHANGE         0x101
78
79 /* order flags */
80 #define SOLVER_TRANSACTION_KEEP_ORDERDATA       (1 << 0)
81
82 extern void transaction_init(Transaction *trans, struct _Pool *pool);
83 extern void transaction_free(Transaction *trans);
84 extern void transaction_calculate(Transaction *trans, Queue *decisionq, Map *noobsmap);
85
86 /* if p is installed, returns with pkg(s) obsolete p */
87 /* if p is not installed, returns with pkg(s) we obsolete */
88 extern Id   transaction_obs_pkg(Transaction *trans, Id p);
89 extern void transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs);
90
91 /* return step type of a transaction element */
92 extern Id   transaction_type(Transaction *trans, Id p, int mode);
93
94 /* return sorted collection of all step types */
95 /* classify_pkgs can be used to return all packages of a type */
96 extern void transaction_classify(Transaction *trans, int mode, Queue *classes);
97 extern void transaction_classify_pkgs(Transaction *trans, int mode, Id type, Id from, Id to, Queue *pkgs);
98
99 /* order a transaction */
100 extern void transaction_order(Transaction *trans, int flags);
101
102 /* roll your own order funcion: 
103  * add pkgs free for installation to queue choices after chosen was
104  * installed. start with chosen = 0
105  * needs an ordered transaction created with SOLVER_TRANSACTION_KEEP_ORDERDATA */
106 extern int  transaction_order_add_choices(Transaction *trans, Id chosen, Queue *choices);
107
108 /* debug function, report problems found in the order */
109 extern void transaction_check_order(Transaction *trans);
110
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif