00001
00010 #ifndef _TXC_CONFIG_H
00011 #define _TXC_CONFIG_H
00012
00013 #include <misc/result.h>
00014 #include <misc/generic_types.h>
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #define VALIDVAL0 {}
00025 #define VALIDVAL2(val1, val2) {val1, val2}
00026
00028 #define FOREACH_RUNTIME_CONFIG_OPTION(ACTION) \
00029 ACTION(debug_all, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00030 VALIDVAL2("enable", "disable"), 2) \
00031 ACTION(debug_koa, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00032 VALIDVAL2("enable", "disable"), 2) \
00033 ACTION(debug_pool, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00034 VALIDVAL2("enable", "disable"), 2) \
00035 ACTION(debug_sentinel, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00036 VALIDVAL2("enable", "disable"), 2) \
00037 ACTION(debug_tx, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00038 VALIDVAL2("enable", "disable"), 2) \
00039 ACTION(debug_xcall, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00040 VALIDVAL2("enable", "disable"), 2) \
00041 ACTION(printconf, boolean, txc_bool_t, char *, TXC_BOOL_FALSE, \
00042 VALIDVAL2("enable", "disable"), 2) \
00043 ACTION(statistics, boolean, txc_bool_t, char *, TXC_BOOL_TRUE, \
00044 VALIDVAL2("enable", "disable"), 2) \
00045 ACTION(statistics_file, string, char *, char *, "txc.stats", \
00046 VALIDVAL0, 0) \
00047 ACTION(sentinel_max_spin_retries, integer, int, int, 0, \
00048 VALIDVAL2(0, 1000), 2) \
00049 ACTION(sentinel_max_backoff_time, integer, int, int, 0, \
00050 VALIDVAL2(0, 1000), 2)
00051
00052
00053 #define CONFIG_OPTION_ENTRY(name, \
00054 type_name, \
00055 store_type, \
00056 parse_type, \
00057 defvalue, \
00058 validvalues, \
00059 num_validvalues) \
00060 store_type name;
00061
00062 typedef struct txc_runtime_settings_s txc_runtime_settings_t;
00063
00064 struct txc_runtime_settings_s {
00065 FOREACH_RUNTIME_CONFIG_OPTION(CONFIG_OPTION_ENTRY)
00066 };
00067
00068 extern txc_runtime_settings_t txc_runtime_settings;
00069
00070
00071
00072 txc_result_t txc_config_init ();
00073 txc_result_t txc_config_set_option(char *option, char *value);
00074
00075
00076
00077
00078
00079
00080
00081
00082
00084 #define TXC_MAX_NUM_THREADS 32
00085
00087 #define TXC_ACTION_LIST_SIZE 32
00088
00090 #define TXC_SENTINEL_NUM 512
00091
00093 #define TXC_KOA_NUM 512
00094
00096 #define TXC_STATS_THREADSTAT_HASHTABLE_SIZE 512
00097
00099 #define TXC_SENTINEL_LIST_SIZE 32
00100
00102 #define TXC_KOA_MAP_SIZE 1024
00103
00105 #define TXC_KOA_CACHE_HASHTBL_SIZE 256
00106
00108 #define TXC_MAX_NUM_FDREFS_PER_KOA 8
00109
00111 #define TXC_MAX_LEN_PATHNAME 128
00112
00113
00115 #define TXC_TX_REGULAR_COMMIT_ACTION_ORDER 0
00116 #define TXC_TX_REGULAR_UNDO_ACTION_ORDER 0
00117 #define TXC_KOA_CREATE_COMMIT_ACTION_ORDER 0
00118 #define TXC_KOA_CREATE_UNDO_ACTION_ORDER 0
00119 #define TXC_KOA_DESTROY_COMMIT_ACTION_ORDER 1
00120 #define TXC_KOA_DESTROY_UNDO_ACTION_ORDER 1
00121 #define TXC_SENTINELMGR_COMMIT_ACTION_ORDER 2
00122 #define TXC_SENTINELMGR_UNDO_ACTION_ORDER 2
00123 #define TXC_STATSMGR_COMMIT_ACTION_ORDER 3
00124 #define TXC_STATSMGR_UNDO_ACTION_ORDER 3
00125
00126 #endif