wip
[oweals/gnunet.git] / src / include / gnunet_datastore_plugin.h
index 34a6591636481088873ac8e9f6f79c8caf6ba748..a5c548146674c8af4cdab154721188bcfba2ce40 100644 (file)
@@ -149,8 +149,7 @@ typedef unsigned long long (*PluginGetSize) (void *cls);
  * @param replication replication-level for the content
  * @param expiration expiration time for the content
  * @param msg set to an error message (on failure)
- * @return GNUNET_OK on success, GNUNET_NO if the content
- *         was already present (and may have been updated);
+ * @return GNUNET_OK on success,
  *         GNUNET_SYSERR on failure
  */
 typedef int (*PluginPut) (void *cls,
@@ -170,7 +169,7 @@ typedef int (*PluginPut) (void *cls,
  * in the datastore.
  *
  * @param cls closure
- * @param key maybe NULL (to match all entries)
+ * @param key key to match, never NULL
  * @param vhash hash of the value, maybe NULL (to
  *        match all values that have the right key).
  *        Note that for DBlocks there is no difference
@@ -246,7 +245,7 @@ typedef int (*PluginUpdate) (void *cls,
  *
  * @param cls closure
  * @param type entries of which type should be considered?
- *        Use 0 for any type.
+ *        Myst not be zero (ANY).
  * @param iter function to call on each matching value; however,
  *        after the first call to "iter", the plugin must wait
  *        until "NextRequest" was called before giving the iterator
@@ -294,6 +293,16 @@ struct GNUNET_DATASTORE_PluginFunctions
    */
   PluginPut put;
 
+  /**
+   * 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
+   * anonymity level, the lower value is to be used.  The specified
+   * priority should be added to the existing priority, ignoring the
+   * priority in value.
+   */
+  PluginUpdate update;
+
   /**
    * Function called by iterators whenever they want the next value;
    * note that unlike all of the other callbacks, this one does get a
@@ -308,12 +317,17 @@ struct GNUNET_DATASTORE_PluginFunctions
    */
   PluginGet get;
 
+  /**
+   * Iterate over content with anonymity level zero.
+   */
+  PluginSelector iter_zero_anonymity;
+
   /**
    * Function to get a random item with high replication score from
    * the database, lowering the item's replication score.  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.
+   * single random item from those with the highest replication
+   * counters.  The item's replication counter is decremented by one
+   * IF it was positive before.
    */
   PluginRandomGet replication_get;
 
@@ -323,29 +337,6 @@ struct GNUNET_DATASTORE_PluginFunctions
    */
   PluginRandomGet expiration_get;
 
-  /**
-   * 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
-   * anonymity level, the lower value is to be used.  The specified
-   * priority should be added to the existing priority, ignoring the
-   * priority in value.
-   */
-  PluginUpdate update;
-
-  /**
-   * Iterate over content with anonymity level zero.
-   */
-  PluginSelector iter_zero_anonymity;
-
-  /**
-   * Iterate over all the items in the datastore
-   * as fast as possible in a single transaction
-   * (can lock datastore while this happens, focus
-   * is on doing it fast).
-   */
-  PluginSelector iter_all_now;
-
   /**
    * Delete the database.  The next operation is
    * guaranteed to be unloading of the module.