static void init_tables (GModule module) { ht_storage[module].module = module; ht_storage[module].metrics = new_ht_metrics (); /* Initialize metrics hash tables */ ht_storage[module].metrics->keymap = tc_adb_create (get_dbname (DB_KEYMAP, module)); ht_storage[module].metrics->datamap = tc_adb_create (get_dbname (DB_DATAMAP, module)); ht_storage[module].metrics->rootmap = tc_adb_create (get_dbname (DB_ROOTMAP, module)); ht_storage[module].metrics->uniqmap = tc_adb_create (get_dbname (DB_UNIQMAP, module)); ht_storage[module].metrics->hits = tc_adb_create (get_dbname (DB_HITS, module)); ht_storage[module].metrics->visitors = tc_adb_create (get_dbname (DB_VISITORS, module)); ht_storage[module].metrics->bw = tc_adb_create (get_dbname (DB_BW, module)); ht_storage[module].metrics->time_served = tc_adb_create (get_dbname (DB_AVGTS, module)); ht_storage[module].metrics->methods = tc_adb_create (get_dbname (DB_METHODS, module)); ht_storage[module].metrics->protocols = tc_adb_create (get_dbname (DB_PROTOCOLS, module)); #ifdef TCB_MEMHASH ht_storage[module].metrics->agents = tc_adb_create (get_dbname (DB_AGENTS, module)); #endif #ifdef TCB_BTREE /* allow for duplicate keys */ ht_storage[module].metrics->agents = tc_bdb_create (DB_AGENTS, module); #endif }
/* Initialize map & metric hashes */ static void init_tables (GModule module) { GTCStorageMetric mtrc; int n = 0, i; /* *INDENT-OFF* */ GTCStorageMetric metrics[] = { {MTRC_KEYMAP , DB_KEYMAP , NULL} , {MTRC_ROOTMAP , DB_ROOTMAP , NULL} , {MTRC_DATAMAP , DB_DATAMAP , NULL} , {MTRC_UNIQMAP , DB_UNIQMAP , NULL} , {MTRC_ROOT , DB_ROOT , NULL} , {MTRC_HITS , DB_HITS , NULL} , {MTRC_VISITORS , DB_VISITORS , NULL} , {MTRC_BW , DB_BW , NULL} , {MTRC_CUMTS , DB_CUMTS , NULL} , {MTRC_MAXTS , DB_MAXTS , NULL} , {MTRC_METHODS , DB_METHODS , NULL} , {MTRC_PROTOCOLS , DB_PROTOCOLS , NULL} , {MTRC_AGENTS , DB_AGENTS , NULL} , {MTRC_METADATA , DB_METADATA , NULL} , }; /* *INDENT-ON* */ n = ARRAY_SIZE (metrics); for (i = 0; i < n; i++) { mtrc = metrics[i]; #ifdef TCB_MEMHASH mtrc.store = tc_adb_create (get_dbname (mtrc.dbname, module)); #endif #ifdef TCB_BTREE /* allow for duplicate keys */ if (mtrc.metric == MTRC_AGENTS) mtrc.store = tc_bdb_create (DB_AGENTS, module); else mtrc.store = tc_adb_create (get_dbname (mtrc.dbname, module)); #endif tc_storage[module].metrics[i] = mtrc; } }