diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-04-04 16:33:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-04-04 16:33:35 +0000 |
commit | 70ec14559f335b5d433fb39ebefcbefdb659194a (patch) | |
tree | f37ac3df0333ebe310cccbeaa9ab1d82ebed2329 /src/datastore | |
parent | ba37451c0580423a829e30bf8567d23a4b8bef09 (diff) | |
download | gnunet-70ec14559f335b5d433fb39ebefcbefdb659194a.tar.gz gnunet-70ec14559f335b5d433fb39ebefcbefdb659194a.zip |
removing dead API calls
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/perf_plugin_datastore.c | 11 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 23 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 26 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 136 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_template.c | 22 |
5 files changed, 2 insertions, 216 deletions
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 676fa8d9d..c21d9551b 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -61,8 +61,7 @@ enum RunPhase | |||
61 | RP_PUT, | 61 | RP_PUT, |
62 | RP_LP_GET, | 62 | RP_LP_GET, |
63 | RP_AE_GET, | 63 | RP_AE_GET, |
64 | RP_ZA_GET, | 64 | RP_ZA_GET |
65 | RP_AN_GET | ||
66 | }; | 65 | }; |
67 | 66 | ||
68 | 67 | ||
@@ -171,7 +170,7 @@ iterateDummy (void *cls, | |||
171 | crc->i, | 170 | crc->i, |
172 | (unsigned long long) (crc->end.abs_value - crc->start.abs_value), | 171 | (unsigned long long) (crc->end.abs_value - crc->start.abs_value), |
173 | crc->cnt); | 172 | crc->cnt); |
174 | if (crc->phase != RP_AN_GET) | 173 | if (crc->phase != RP_ZA_GET) |
175 | { | 174 | { |
176 | crc->phase++; | 175 | crc->phase++; |
177 | } | 176 | } |
@@ -324,12 +323,6 @@ test (void *cls, | |||
324 | &iterateDummy, | 323 | &iterateDummy, |
325 | crc); | 324 | crc); |
326 | break; | 325 | break; |
327 | case RP_AN_GET: | ||
328 | crc->msg = "%3u all now iteration took %20llums for %u\n"; | ||
329 | crc->api->iter_all_now (crc->api->cls, 0, | ||
330 | &iterateDummy, | ||
331 | crc); | ||
332 | break; | ||
333 | case RP_DONE: | 326 | case RP_DONE: |
334 | crc->api->drop (crc->api->cls); | 327 | crc->api->drop (crc->api->cls); |
335 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, | 328 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, |
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index b56e142fb..773a40ba3 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -1818,28 +1818,6 @@ mysql_plugin_iter_zero_anonymity (void *cls, | |||
1818 | 1818 | ||
1819 | 1819 | ||
1820 | /** | 1820 | /** |
1821 | * Select a subset of the items in the datastore and call | ||
1822 | * the given iterator for each of them. | ||
1823 | * | ||
1824 | * @param cls our "struct Plugin*" | ||
1825 | * @param type entries of which type should be considered? | ||
1826 | * Use 0 for any type. | ||
1827 | * @param iter function to call on each matching value; | ||
1828 | * will be called once with a NULL value at the end | ||
1829 | * @param iter_cls closure for iter | ||
1830 | */ | ||
1831 | static void | ||
1832 | mysql_plugin_iter_all_now (void *cls, | ||
1833 | enum GNUNET_BLOCK_Type type, | ||
1834 | PluginIterator iter, | ||
1835 | void *iter_cls) | ||
1836 | { | ||
1837 | struct Plugin *plugin = cls; | ||
1838 | iterateHelper (plugin, 0, GNUNET_YES, 0, iter, iter_cls); | ||
1839 | } | ||
1840 | |||
1841 | |||
1842 | /** | ||
1843 | * Drop database. | 1821 | * Drop database. |
1844 | */ | 1822 | */ |
1845 | static void | 1823 | static void |
@@ -1941,7 +1919,6 @@ libgnunet_plugin_datastore_mysql_init (void *cls) | |||
1941 | api->expiration_get = &mysql_plugin_expiration_get; | 1919 | api->expiration_get = &mysql_plugin_expiration_get; |
1942 | api->update = &mysql_plugin_update; | 1920 | api->update = &mysql_plugin_update; |
1943 | api->iter_zero_anonymity = &mysql_plugin_iter_zero_anonymity; | 1921 | api->iter_zero_anonymity = &mysql_plugin_iter_zero_anonymity; |
1944 | api->iter_all_now = &mysql_plugin_iter_all_now; | ||
1945 | api->drop = &mysql_plugin_drop; | 1922 | api->drop = &mysql_plugin_drop; |
1946 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | 1923 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, |
1947 | "mysql", _("Mysql database running\n")); | 1924 | "mysql", _("Mysql database running\n")); |
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index cdd8e405e..1ff56da31 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -1263,31 +1263,6 @@ postgres_plugin_iter_zero_anonymity (void *cls, | |||
1263 | 1263 | ||
1264 | 1264 | ||
1265 | /** | 1265 | /** |
1266 | * Select a subset of the items in the datastore and call | ||
1267 | * the given iterator for each of them. | ||
1268 | * | ||
1269 | * @param cls our "struct Plugin*" | ||
1270 | * @param type entries of which type should be considered? | ||
1271 | * Use 0 for any type. | ||
1272 | * @param iter function to call on each matching value; | ||
1273 | * will be called once with a NULL value at the end | ||
1274 | * @param iter_cls closure for iter | ||
1275 | */ | ||
1276 | static void | ||
1277 | postgres_plugin_iter_all_now (void *cls, | ||
1278 | enum GNUNET_BLOCK_Type type, | ||
1279 | PluginIterator iter, | ||
1280 | void *iter_cls) | ||
1281 | { | ||
1282 | struct Plugin *plugin = cls; | ||
1283 | |||
1284 | postgres_iterate (plugin, | ||
1285 | 0, GNUNET_YES, 0, | ||
1286 | iter, iter_cls); | ||
1287 | } | ||
1288 | |||
1289 | |||
1290 | /** | ||
1291 | * Drop database. | 1266 | * Drop database. |
1292 | */ | 1267 | */ |
1293 | static void | 1268 | static void |
@@ -1329,7 +1304,6 @@ libgnunet_plugin_datastore_postgres_init (void *cls) | |||
1329 | api->expiration_get = &postgres_plugin_expiration_get; | 1304 | api->expiration_get = &postgres_plugin_expiration_get; |
1330 | api->update = &postgres_plugin_update; | 1305 | api->update = &postgres_plugin_update; |
1331 | api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity; | 1306 | api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity; |
1332 | api->iter_all_now = &postgres_plugin_iter_all_now; | ||
1333 | api->drop = &postgres_plugin_drop; | 1307 | api->drop = &postgres_plugin_drop; |
1334 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | 1308 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, |
1335 | "datastore-postgres", | 1309 | "datastore-postgres", |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index f14855219..501c9f292 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -1079,141 +1079,6 @@ sqlite_plugin_iter_zero_anonymity (void *cls, | |||
1079 | 1079 | ||
1080 | 1080 | ||
1081 | /** | 1081 | /** |
1082 | * Closure for 'all_next_prepare'. | ||
1083 | */ | ||
1084 | struct IterateAllContext | ||
1085 | { | ||
1086 | |||
1087 | /** | ||
1088 | * Offset for the current result. | ||
1089 | */ | ||
1090 | unsigned int off; | ||
1091 | |||
1092 | /** | ||
1093 | * Requested block type. | ||
1094 | */ | ||
1095 | enum GNUNET_BLOCK_Type type; | ||
1096 | |||
1097 | /** | ||
1098 | * Our prepared statement. | ||
1099 | */ | ||
1100 | sqlite3_stmt *stmt; | ||
1101 | }; | ||
1102 | |||
1103 | |||
1104 | /** | ||
1105 | * Call sqlite using the already prepared query to get | ||
1106 | * the next result. | ||
1107 | * | ||
1108 | * @param cls context with the prepared query (of type 'struct IterateAllContext') | ||
1109 | * @param nc generic context with the prepared query | ||
1110 | * @return GNUNET_OK on success, GNUNET_SYSERR on error, GNUNET_NO if | ||
1111 | * there are no more results | ||
1112 | */ | ||
1113 | static int | ||
1114 | all_next_prepare (void *cls, | ||
1115 | struct NextContext *nc) | ||
1116 | { | ||
1117 | struct IterateAllContext *iac = cls; | ||
1118 | struct Plugin *plugin; | ||
1119 | int ret; | ||
1120 | unsigned int sqoff; | ||
1121 | |||
1122 | if (nc == NULL) | ||
1123 | { | ||
1124 | #if DEBUG_SQLITE | ||
1125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1126 | "Asked to clean up iterator state.\n"); | ||
1127 | #endif | ||
1128 | if (NULL != iac->stmt) | ||
1129 | { | ||
1130 | sqlite3_finalize (iac->stmt); | ||
1131 | iac->stmt = NULL; | ||
1132 | } | ||
1133 | return GNUNET_SYSERR; | ||
1134 | } | ||
1135 | plugin = nc->plugin; | ||
1136 | sqoff = 1; | ||
1137 | ret = SQLITE_OK; | ||
1138 | if (iac->type != 0) | ||
1139 | ret = sqlite3_bind_int (nc->stmt, sqoff++, iac->type); | ||
1140 | if (SQLITE_OK == ret) | ||
1141 | ret = sqlite3_bind_int64 (nc->stmt, sqoff++, iac->off++); | ||
1142 | if (ret != SQLITE_OK) | ||
1143 | { | ||
1144 | LOG_SQLITE (plugin, NULL, | ||
1145 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); | ||
1146 | return GNUNET_SYSERR; | ||
1147 | } | ||
1148 | ret = sqlite3_step (nc->stmt); | ||
1149 | switch (ret) | ||
1150 | { | ||
1151 | case SQLITE_ROW: | ||
1152 | return GNUNET_OK; | ||
1153 | case SQLITE_DONE: | ||
1154 | return GNUNET_NO; | ||
1155 | default: | ||
1156 | LOG_SQLITE (plugin, NULL, | ||
1157 | GNUNET_ERROR_TYPE_ERROR | | ||
1158 | GNUNET_ERROR_TYPE_BULK, | ||
1159 | "sqlite3_step"); | ||
1160 | return GNUNET_SYSERR; | ||
1161 | } | ||
1162 | } | ||
1163 | |||
1164 | |||
1165 | /** | ||
1166 | * Select a subset of the items in the datastore and call | ||
1167 | * the given iterator for each of them. | ||
1168 | * | ||
1169 | * @param cls our plugin context | ||
1170 | * @param type entries of which type should be considered? | ||
1171 | * Use 0 for any type. | ||
1172 | * @param iter function to call on each matching value; | ||
1173 | * will be called once with a NULL value at the end | ||
1174 | * @param iter_cls closure for iter | ||
1175 | */ | ||
1176 | static void | ||
1177 | sqlite_plugin_iter_all_now (void *cls, | ||
1178 | enum GNUNET_BLOCK_Type type, | ||
1179 | PluginIterator iter, | ||
1180 | void *iter_cls) | ||
1181 | { | ||
1182 | struct Plugin *plugin = cls; | ||
1183 | struct NextContext *nc; | ||
1184 | struct IterateAllContext *iac; | ||
1185 | sqlite3_stmt *stmt; | ||
1186 | const char *q; | ||
1187 | |||
1188 | if (type == 0) | ||
1189 | q = "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn090 ORDER BY _ROWID_ ASC LIMIT 1 OFFSET ?"; | ||
1190 | else | ||
1191 | q = "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn090 WHERE type=? ORDER BY _ROWID_ ASC LIMIT 1 OFFSET ?"; | ||
1192 | if (sq_prepare (plugin->dbh, q, &stmt) != SQLITE_OK) | ||
1193 | { | ||
1194 | LOG_SQLITE (plugin, NULL, | ||
1195 | GNUNET_ERROR_TYPE_ERROR | | ||
1196 | GNUNET_ERROR_TYPE_BULK, "sqlite3_prepare_v2"); | ||
1197 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | ||
1198 | return; | ||
1199 | } | ||
1200 | nc = GNUNET_malloc (sizeof(struct NextContext) + | ||
1201 | sizeof(struct IterateAllContext)); | ||
1202 | iac = (struct IterateAllContext*) &nc[1]; | ||
1203 | nc->plugin = plugin; | ||
1204 | nc->iter = iter; | ||
1205 | nc->iter_cls = iter_cls; | ||
1206 | nc->stmt = stmt; | ||
1207 | nc->prep = &all_next_prepare; | ||
1208 | nc->prep_cls = iac; | ||
1209 | iac->off = 0; | ||
1210 | iac->type = type; | ||
1211 | iac->stmt = stmt; /* alias used for freeing at the end */ | ||
1212 | sqlite_next_request (nc, GNUNET_NO); | ||
1213 | } | ||
1214 | |||
1215 | |||
1216 | /** | ||
1217 | * Context for get_next_prepare. | 1082 | * Context for get_next_prepare. |
1218 | */ | 1083 | */ |
1219 | struct GetNextContext | 1084 | struct GetNextContext |
@@ -1732,7 +1597,6 @@ libgnunet_plugin_datastore_sqlite_init (void *cls) | |||
1732 | api->expiration_get = &sqlite_plugin_expiration_get; | 1597 | api->expiration_get = &sqlite_plugin_expiration_get; |
1733 | api->update = &sqlite_plugin_update; | 1598 | api->update = &sqlite_plugin_update; |
1734 | api->iter_zero_anonymity = &sqlite_plugin_iter_zero_anonymity; | 1599 | api->iter_zero_anonymity = &sqlite_plugin_iter_zero_anonymity; |
1735 | api->iter_all_now = &sqlite_plugin_iter_all_now; | ||
1736 | api->drop = &sqlite_plugin_drop; | 1600 | api->drop = &sqlite_plugin_drop; |
1737 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | 1601 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, |
1738 | "sqlite", _("Sqlite database running\n")); | 1602 | "sqlite", _("Sqlite database running\n")); |
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c index 41d92a117..40b191538 100644 --- a/src/datastore/plugin_datastore_template.c +++ b/src/datastore/plugin_datastore_template.c | |||
@@ -227,27 +227,6 @@ template_plugin_iter_zero_anonymity (void *cls, | |||
227 | 227 | ||
228 | 228 | ||
229 | /** | 229 | /** |
230 | * Select a subset of the items in the datastore and call | ||
231 | * the given iterator for each of them. | ||
232 | * | ||
233 | * @param cls our "struct Plugin*" | ||
234 | * @param type entries of which type should be considered? | ||
235 | * Use 0 for any type. | ||
236 | * @param iter function to call on each matching value; | ||
237 | * will be called once with a NULL value at the end | ||
238 | * @param iter_cls closure for iter | ||
239 | */ | ||
240 | static void | ||
241 | template_plugin_iter_all_now (void *cls, | ||
242 | enum GNUNET_BLOCK_Type type, | ||
243 | PluginIterator iter, | ||
244 | void *iter_cls) | ||
245 | { | ||
246 | GNUNET_break (0); | ||
247 | } | ||
248 | |||
249 | |||
250 | /** | ||
251 | * Drop database. | 230 | * Drop database. |
252 | */ | 231 | */ |
253 | static void | 232 | static void |
@@ -282,7 +261,6 @@ libgnunet_plugin_datastore_template_init (void *cls) | |||
282 | api->expiration_get = &template_plugin_expiration_get; | 261 | api->expiration_get = &template_plugin_expiration_get; |
283 | api->update = &template_plugin_update; | 262 | api->update = &template_plugin_update; |
284 | api->iter_zero_anonymity = &template_plugin_iter_zero_anonymity; | 263 | api->iter_zero_anonymity = &template_plugin_iter_zero_anonymity; |
285 | api->iter_all_now = &template_plugin_iter_all_now; | ||
286 | api->drop = &template_plugin_drop; | 264 | api->drop = &template_plugin_drop; |
287 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | 265 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, |
288 | "template", _("Template database running\n")); | 266 | "template", _("Template database running\n")); |