aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/plugin_datastore_mysql.c
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2011-04-03 15:10:41 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2011-04-03 15:10:41 +0000
commit587cab034ab30da9f792a415f1481f309efdc88c (patch)
tree244c947db2921817c15d04b6a88a3f843e33d2a3 /src/datastore/plugin_datastore_mysql.c
parent9b6126f320c3682d71290b0a1bd3b42c2074a0ec (diff)
new plugin API
git-svn-id: https://gnunet.org/svn/gnunet@14833 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datastore/plugin_datastore_mysql.c')
-rw-r--r--src/datastore/plugin_datastore_mysql.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index ac81c90110..fb1b139780 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -1348,6 +1348,7 @@ mysql_plugin_get_size (void *cls)
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param msg set to error message
* @return GNUNET_OK on success
@@ -1360,6 +1361,7 @@ mysql_plugin_put (void *cls,
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
char **msg)
{
@@ -1688,6 +1690,26 @@ mysql_plugin_get (void *cls,
/**
+ * Get a random item for replication. Returns a single, not expired, random item
+ * from those with the highest replication counters. The item's
+ * replication counter is decremented by one IF it was positive before.
+ * Call 'iter' with all values ZERO or NULL if the datastore is empty.
+ *
+ * @param cls closure
+ * @param iter function to call the value (once only).
+ * @param iter_cls closure for iter
+ */
+static void
+mysql_plugin_replication_get (void *cls,
+ PluginIterator iter, void *iter_cls)
+{
+ /* FIXME: not implemented! */
+ iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0,
+ GNUNET_TIME_UNIT_ZERO_ABS, 0);
+}
+
+
+/**
* Update the priority for a particular key in the datastore. If
* the expiration time in value is different than the time found in
* the datastore, the higher value should be kept. For the
@@ -1940,6 +1962,7 @@ libgnunet_plugin_datastore_mysql_init (void *cls)
api->put = &mysql_plugin_put;
api->next_request = &mysql_plugin_next_request;
api->get = &mysql_plugin_get;
+ api->replication_get = &mysql_plugin_replication_get;
api->update = &mysql_plugin_update;
api->iter_low_priority = &mysql_plugin_iter_low_priority;
api->iter_zero_anonymity = &mysql_plugin_iter_zero_anonymity;