aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/plugin_datastore_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datastore/plugin_datastore_postgres.c')
-rw-r--r--src/datastore/plugin_datastore_postgres.c64
1 files changed, 16 insertions, 48 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index c004cd59f..cdd8e405e 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -1220,51 +1220,20 @@ postgres_plugin_replication_get (void *cls,
1220 1220
1221 1221
1222/** 1222/**
1223 * Select a subset of the items in the datastore and call 1223 * Get a random item for expiration.
1224 * the given iterator for each of them. 1224 * Call 'iter' with all values ZERO or NULL if the datastore is empty.
1225 *
1226 * @param cls our "struct Plugin*"
1227 * @param type entries of which type should be considered?
1228 * Use 0 for any type.
1229 * @param iter function to call on each matching value;
1230 * will be called once with a NULL value at the end
1231 * @param iter_cls closure for iter
1232 */
1233static void
1234postgres_plugin_iter_zero_anonymity (void *cls,
1235 enum GNUNET_BLOCK_Type type,
1236 PluginIterator iter,
1237 void *iter_cls)
1238{
1239 struct Plugin *plugin = cls;
1240
1241 postgres_iterate (plugin,
1242 type, GNUNET_NO, 1,
1243 iter, iter_cls);
1244}
1245
1246
1247/**
1248 * Select a subset of the items in the datastore and call
1249 * the given iterator for each of them.
1250 * 1225 *
1251 * @param cls our "struct Plugin*" 1226 * @param cls closure
1252 * @param type entries of which type should be considered? 1227 * @param iter function to call the value (once only).
1253 * Use 0 for any type.
1254 * @param iter function to call on each matching value;
1255 * will be called once with a NULL value at the end
1256 * @param iter_cls closure for iter 1228 * @param iter_cls closure for iter
1257 */ 1229 */
1258static void 1230static void
1259postgres_plugin_iter_ascending_expiration (void *cls, 1231postgres_plugin_expiration_get (void *cls,
1260 enum GNUNET_BLOCK_Type type, 1232 PluginIterator iter, void *iter_cls)
1261 PluginIterator iter,
1262 void *iter_cls)
1263{ 1233{
1264 struct Plugin *plugin = cls; 1234 /* FIXME: not implemented! */
1265 1235 iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0,
1266 postgres_iterate (plugin, type, GNUNET_YES, 2, 1236 GNUNET_TIME_UNIT_ZERO_ABS, 0);
1267 iter, iter_cls);
1268} 1237}
1269 1238
1270 1239
@@ -1280,14 +1249,15 @@ postgres_plugin_iter_ascending_expiration (void *cls,
1280 * @param iter_cls closure for iter 1249 * @param iter_cls closure for iter
1281 */ 1250 */
1282static void 1251static void
1283postgres_plugin_iter_migration_order (void *cls, 1252postgres_plugin_iter_zero_anonymity (void *cls,
1284 enum GNUNET_BLOCK_Type type, 1253 enum GNUNET_BLOCK_Type type,
1285 PluginIterator iter, 1254 PluginIterator iter,
1286 void *iter_cls) 1255 void *iter_cls)
1287{ 1256{
1288 struct Plugin *plugin = cls; 1257 struct Plugin *plugin = cls;
1289 1258
1290 postgres_iterate (plugin, 0, GNUNET_NO, 3, 1259 postgres_iterate (plugin,
1260 type, GNUNET_NO, 1,
1291 iter, iter_cls); 1261 iter, iter_cls);
1292} 1262}
1293 1263
@@ -1356,11 +1326,9 @@ libgnunet_plugin_datastore_postgres_init (void *cls)
1356 api->next_request = &postgres_plugin_next_request; 1326 api->next_request = &postgres_plugin_next_request;
1357 api->get = &postgres_plugin_get; 1327 api->get = &postgres_plugin_get;
1358 api->replication_get = &postgres_plugin_replication_get; 1328 api->replication_get = &postgres_plugin_replication_get;
1329 api->expiration_get = &postgres_plugin_expiration_get;
1359 api->update = &postgres_plugin_update; 1330 api->update = &postgres_plugin_update;
1360 api->iter_low_priority = &postgres_plugin_iter_low_priority;
1361 api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity; 1331 api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity;
1362 api->iter_ascending_expiration = &postgres_plugin_iter_ascending_expiration;
1363 api->iter_migration_order = &postgres_plugin_iter_migration_order;
1364 api->iter_all_now = &postgres_plugin_iter_all_now; 1332 api->iter_all_now = &postgres_plugin_iter_all_now;
1365 api->drop = &postgres_plugin_drop; 1333 api->drop = &postgres_plugin_drop;
1366 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, 1334 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,