aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/plugin_datastore_sqlite.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_sqlite.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_sqlite.c')
-rw-r--r--src/datastore/plugin_datastore_sqlite.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index 0eba474f61..260bd54cc1 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -689,6 +689,7 @@ sqlite_next_request (void *next_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 an error message
* @return GNUNET_OK on success
@@ -701,6 +702,7 @@ sqlite_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)
{
@@ -1532,6 +1534,26 @@ sqlite_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
+sqlite_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);
+}
+
+
+/**
* Drop database.
*
* @param cls our plugin context
@@ -1623,6 +1645,7 @@ libgnunet_plugin_datastore_sqlite_init (void *cls)
api->put = &sqlite_plugin_put;
api->next_request = &sqlite_next_request;
api->get = &sqlite_plugin_get;
+ api->replication_get = &sqlite_plugin_replication_get;
api->update = &sqlite_plugin_update;
api->iter_low_priority = &sqlite_plugin_iter_low_priority;
api->iter_zero_anonymity = &sqlite_plugin_iter_zero_anonymity;