Merge branch 'master' of git@git.opensuse.org:projects/zypp/sat-solver
[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
36   struct _TransactionOrderdata *orderdata;
37
38 } Transaction;
39
40
41 /* step types */
42 #define SOLVER_TRANSACTION_ERASE                0x10
43 #define SOLVER_TRANSACTION_REINSTALLED          0x11
44 #define SOLVER_TRANSACTION_DOWNGRADED           0x12
45 #define SOLVER_TRANSACTION_CHANGED              0x13
46 #define SOLVER_TRANSACTION_UPGRADED             0x14
47 #define SOLVER_TRANSACTION_REPLACED             0x15
48
49 #define SOLVER_TRANSACTION_INSTALL              0x20
50 #define SOLVER_TRANSACTION_REINSTALL            0x21
51 #define SOLVER_TRANSACTION_DOWNGRADE            0x22
52 #define SOLVER_TRANSACTION_CHANGE               0x23
53 #define SOLVER_TRANSACTION_UPGRADE              0x24
54 #define SOLVER_TRANSACTION_REPLACE              0x25
55
56 #define SOLVER_TRANSACTION_MULTIINSTALL         0x30
57 #define SOLVER_TRANSACTION_MULTIREINSTALL       0x31
58
59 /* show modes */
60 #define SOLVER_TRANSACTION_SHOW_ACTIVE          (1 << 0)
61 #define SOLVER_TRANSACTION_SHOW_ALL             (1 << 1)
62 #define SOLVER_TRANSACTION_SHOW_REPLACES        (1 << 2)
63
64 extern void transaction_init(Transaction *trans, struct _Pool *pool);
65 extern void transaction_free(Transaction *trans);
66 extern void transaction_calculate(Transaction *trans, Queue *decisionq, Map *noobsmap);
67 extern void solver_transaction_all_pkgs(Transaction *trans, Id p, Queue *pkgs);
68 extern Id   solver_transaction_pkg(Transaction *trans, Id p);
69 extern Id   solver_transaction_show(Transaction *trans, Id type, Id p, int mode);
70 extern void transaction_order(Transaction *trans, int flags);
71 extern void transaction_check(Transaction *trans);
72 extern int  transaction_add_choices(Transaction *trans, Queue *choices, Id chosen);
73
74 /* order flags */
75 #define SOLVER_TRANSACTION_KEEP_ORDERDATA       (1 << 0)
76
77 #ifdef __cplusplus
78 }
79 #endif
80
81 #endif