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.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 18ad77885..c004cd59f 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -587,6 +587,7 @@ postgres_plugin_get_size (void *cls)
587 * @param type type of the content 587 * @param type type of the content
588 * @param priority priority of the content 588 * @param priority priority of the content
589 * @param anonymity anonymity-level for the content 589 * @param anonymity anonymity-level for the content
590 * @param replication replication-level for the content
590 * @param expiration expiration time for the content 591 * @param expiration expiration time for the content
591 * @param msg set to error message 592 * @param msg set to error message
592 * @return GNUNET_OK on success 593 * @return GNUNET_OK on success
@@ -599,6 +600,7 @@ postgres_plugin_put (void *cls,
599 enum GNUNET_BLOCK_Type type, 600 enum GNUNET_BLOCK_Type type,
600 uint32_t priority, 601 uint32_t priority,
601 uint32_t anonymity, 602 uint32_t anonymity,
603 uint32_t replication,
602 struct GNUNET_TIME_Absolute expiration, 604 struct GNUNET_TIME_Absolute expiration,
603 char **msg) 605 char **msg)
604{ 606{
@@ -1198,6 +1200,26 @@ postgres_plugin_get (void *cls,
1198 1200
1199 1201
1200/** 1202/**
1203 * Get a random item for replication. Returns a single, not expired, random item
1204 * from those with the highest replication counters. The item's
1205 * replication counter is decremented by one IF it was positive before.
1206 * Call 'iter' with all values ZERO or NULL if the datastore is empty.
1207 *
1208 * @param cls closure
1209 * @param iter function to call the value (once only).
1210 * @param iter_cls closure for iter
1211 */
1212static void
1213postgres_plugin_replication_get (void *cls,
1214 PluginIterator iter, void *iter_cls)
1215{
1216 /* FIXME: not implemented! */
1217 iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0,
1218 GNUNET_TIME_UNIT_ZERO_ABS, 0);
1219}
1220
1221
1222/**
1201 * Select a subset of the items in the datastore and call 1223 * Select a subset of the items in the datastore and call
1202 * the given iterator for each of them. 1224 * the given iterator for each of them.
1203 * 1225 *
@@ -1333,6 +1355,7 @@ libgnunet_plugin_datastore_postgres_init (void *cls)
1333 api->put = &postgres_plugin_put; 1355 api->put = &postgres_plugin_put;
1334 api->next_request = &postgres_plugin_next_request; 1356 api->next_request = &postgres_plugin_next_request;
1335 api->get = &postgres_plugin_get; 1357 api->get = &postgres_plugin_get;
1358 api->replication_get = &postgres_plugin_replication_get;
1336 api->update = &postgres_plugin_update; 1359 api->update = &postgres_plugin_update;
1337 api->iter_low_priority = &postgres_plugin_iter_low_priority; 1360 api->iter_low_priority = &postgres_plugin_iter_low_priority;
1338 api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity; 1361 api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity;