transaction.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007-2009, Novell Inc.
00003  *
00004  * This program is licensed under the BSD license, read LICENSE.BSD
00005  * for further information
00006  */
00007 
00008 /*
00009  * transaction.h
00010  *
00011  */
00012 
00013 #ifndef SATSOLVER_TRANSACTION_H
00014 #define SATSOLVER_TRANSACTION_H
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 #include "pooltypes.h"
00021 #include "queue.h"
00022 #include "bitmap.h"
00023 
00024 struct _Pool;
00025 struct _DUChanges;
00026 struct _TransactionOrderdata;
00027 
00028 typedef struct _Transaction {
00029   struct _Pool *pool;           /* back pointer to pool */
00030 
00031   Queue steps;                  /* the transaction steps */
00032 
00033   Queue transaction_info;
00034   Id *transaction_installed;
00035   Map transactsmap;
00036   Map noobsmap;
00037 
00038   struct _TransactionOrderdata *orderdata;
00039 
00040 } Transaction;
00041 
00042 
00043 /* step types */
00044 #define SOLVER_TRANSACTION_IGNORE               0x00
00045 
00046 #define SOLVER_TRANSACTION_ERASE                0x10
00047 #define SOLVER_TRANSACTION_REINSTALLED          0x11
00048 #define SOLVER_TRANSACTION_DOWNGRADED           0x12
00049 #define SOLVER_TRANSACTION_CHANGED              0x13
00050 #define SOLVER_TRANSACTION_UPGRADED             0x14
00051 #define SOLVER_TRANSACTION_OBSOLETED            0x15
00052 
00053 #define SOLVER_TRANSACTION_INSTALL              0x20
00054 #define SOLVER_TRANSACTION_REINSTALL            0x21
00055 #define SOLVER_TRANSACTION_DOWNGRADE            0x22
00056 #define SOLVER_TRANSACTION_CHANGE               0x23
00057 #define SOLVER_TRANSACTION_UPGRADE              0x24
00058 #define SOLVER_TRANSACTION_OBSOLETES            0x25
00059 
00060 #define SOLVER_TRANSACTION_MULTIINSTALL         0x30
00061 #define SOLVER_TRANSACTION_MULTIREINSTALL       0x31
00062 
00063 #define SOLVER_TRANSACTION_MAXTYPE              0x3f
00064 
00065 /* modes */
00066 #define SOLVER_TRANSACTION_SHOW_ACTIVE          (1 << 0)
00067 #define SOLVER_TRANSACTION_SHOW_ALL             (1 << 1)
00068 #define SOLVER_TRANSACTION_SHOW_OBSOLETES       (1 << 2)
00069 #define SOLVER_TRANSACTION_SHOW_MULTIINSTALL    (1 << 3)
00070 #define SOLVER_TRANSACTION_CHANGE_IS_REINSTALL  (1 << 4)
00071 #define SOLVER_TRANSACTION_MERGE_VENDORCHANGES  (1 << 5)
00072 #define SOLVER_TRANSACTION_MERGE_ARCHCHANGES    (1 << 6)
00073 
00074 #define SOLVER_TRANSACTION_RPM_ONLY             (1 << 7)
00075 
00076 /* extra classifications */
00077 #define SOLVER_TRANSACTION_ARCHCHANGE           0x100
00078 #define SOLVER_TRANSACTION_VENDORCHANGE         0x101
00079 
00080 /* order flags */
00081 #define SOLVER_TRANSACTION_KEEP_ORDERDATA       (1 << 0)
00082 
00083 extern void transaction_init(Transaction *trans, struct _Pool *pool);
00084 extern void transaction_init_clone(Transaction *trans, Transaction *srctrans);
00085 extern void transaction_free(Transaction *trans);
00086 extern void transaction_free_orderdata(Transaction *trans);
00087 extern void transaction_calculate(Transaction *trans, Queue *decisionq, Map *noobsmap);
00088 
00089 /* if p is installed, returns with pkg(s) obsolete p */
00090 /* if p is not installed, returns with pkg(s) we obsolete */
00091 extern Id   transaction_obs_pkg(Transaction *trans, Id p);
00092 extern void transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs);
00093 
00094 /* return step type of a transaction element */
00095 extern Id   transaction_type(Transaction *trans, Id p, int mode);
00096 
00097 /* return sorted collection of all step types */
00098 /* classify_pkgs can be used to return all packages of a type */
00099 extern void transaction_classify(Transaction *trans, int mode, Queue *classes);
00100 extern void transaction_classify_pkgs(Transaction *trans, int mode, Id type, Id from, Id to, Queue *pkgs);
00101 
00102 /* return all packages that will be installed after the transaction is run*/
00103 /* The new packages are put at the head of the queue, the number of new
00104    packages is returned */
00105 extern int transaction_installedresult(Transaction *trans, Queue *installedq);
00106 
00107 int transaction_calc_installsizechange(Transaction *trans);
00108 void transaction_calc_duchanges(Transaction *trans, struct _DUChanges *mps, int nmps);
00109 
00110 /* order a transaction */
00111 extern void transaction_order(Transaction *trans, int flags);
00112 
00113 /* roll your own order funcion: 
00114  * add pkgs free for installation to queue choices after chosen was
00115  * installed. start with chosen = 0
00116  * needs an ordered transaction created with SOLVER_TRANSACTION_KEEP_ORDERDATA */
00117 extern int  transaction_order_add_choices(Transaction *trans, Id chosen, Queue *choices);
00118 /* add obsoleted packages into transaction steps */
00119 extern void transaction_add_obsoleted(Transaction *trans);
00120 
00121 /* debug function, report problems found in the order */
00122 extern void transaction_check_order(Transaction *trans);
00123 
00124 
00125 #ifdef __cplusplus
00126 }
00127 #endif
00128 
00129 #endif

doxygen