0.9.0pre3: [2'11]
+* DATASTORE:
+ - get_random seems to not just return a SINGLE value, but an entire
+ sequence of values... => migration queue overflows!
* NAT/UPNP: [Milan / Ayush / MW]
- [#1609] code clean up
- testing
}
+
+/**
+ * Get a random item for expiration.
+ * 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_expiration_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
}
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- * Use 0 for any type.
- * @param iter function to call on each matching value;
- * will be called once with a NULL value at the end
- * @param iter_cls closure for iter
- */
-static void
-mysql_plugin_iter_ascending_expiration (void *cls,
- enum GNUNET_BLOCK_Type type,
- PluginIterator iter,
- void *iter_cls)
-{
- struct Plugin *plugin = cls;
- iterateHelper (plugin, type, GNUNET_YES, 2, iter, iter_cls);
-}
-
-
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- * Use 0 for any type.
- * @param iter function to call on each matching value;
- * will be called once with a NULL value at the end
- * @param iter_cls closure for iter
- */
-static void
-mysql_plugin_iter_migration_order (void *cls,
- enum GNUNET_BLOCK_Type type,
- PluginIterator iter,
- void *iter_cls)
-{
- struct Plugin *plugin = cls;
- iterateHelper (plugin, 0, GNUNET_NO, 3, iter, iter_cls);
-}
-
-
/**
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
api->next_request = &mysql_plugin_next_request;
api->get = &mysql_plugin_get;
api->replication_get = &mysql_plugin_replication_get;
+ api->expiration_get = &mysql_plugin_expiration_get;
api->update = &mysql_plugin_update;
- api->iter_low_priority = &mysql_plugin_iter_low_priority;
api->iter_zero_anonymity = &mysql_plugin_iter_zero_anonymity;
- api->iter_ascending_expiration = &mysql_plugin_iter_ascending_expiration;
- api->iter_migration_order = &mysql_plugin_iter_migration_order;
api->iter_all_now = &mysql_plugin_iter_all_now;
api->drop = &mysql_plugin_drop;
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- * Use 0 for any type.
- * @param iter function to call on each matching value;
- * will be called once with a NULL value at the end
- * @param iter_cls closure for iter
- */
-static void
-postgres_plugin_iter_zero_anonymity (void *cls,
- enum GNUNET_BLOCK_Type type,
- PluginIterator iter,
- void *iter_cls)
-{
- struct Plugin *plugin = cls;
-
- postgres_iterate (plugin,
- type, GNUNET_NO, 1,
- iter, iter_cls);
-}
-
-
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
+ * Get a random item for expiration.
+ * Call 'iter' with all values ZERO or NULL if the datastore is empty.
*
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- * Use 0 for any type.
- * @param iter function to call on each matching value;
- * will be called once with a NULL value at the end
+ * @param cls closure
+ * @param iter function to call the value (once only).
* @param iter_cls closure for iter
*/
static void
-postgres_plugin_iter_ascending_expiration (void *cls,
- enum GNUNET_BLOCK_Type type,
- PluginIterator iter,
- void *iter_cls)
+postgres_plugin_expiration_get (void *cls,
+ PluginIterator iter, void *iter_cls)
{
- struct Plugin *plugin = cls;
-
- postgres_iterate (plugin, type, GNUNET_YES, 2,
- iter, iter_cls);
+ /* FIXME: not implemented! */
+ iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0,
+ GNUNET_TIME_UNIT_ZERO_ABS, 0);
}
* @param iter_cls closure for iter
*/
static void
-postgres_plugin_iter_migration_order (void *cls,
- enum GNUNET_BLOCK_Type type,
- PluginIterator iter,
- void *iter_cls)
+postgres_plugin_iter_zero_anonymity (void *cls,
+ enum GNUNET_BLOCK_Type type,
+ PluginIterator iter,
+ void *iter_cls)
{
struct Plugin *plugin = cls;
- postgres_iterate (plugin, 0, GNUNET_NO, 3,
+ postgres_iterate (plugin,
+ type, GNUNET_NO, 1,
iter, iter_cls);
}
api->next_request = &postgres_plugin_next_request;
api->get = &postgres_plugin_get;
api->replication_get = &postgres_plugin_replication_get;
+ api->expiration_get = &postgres_plugin_expiration_get;
api->update = &postgres_plugin_update;
- api->iter_low_priority = &postgres_plugin_iter_low_priority;
api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity;
- api->iter_ascending_expiration = &postgres_plugin_iter_ascending_expiration;
- api->iter_migration_order = &postgres_plugin_iter_migration_order;
api->iter_all_now = &postgres_plugin_iter_all_now;
api->drop = &postgres_plugin_drop;
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
* @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,
* operation.
*
* @param cls closure
- * @param success GNUNET_SYSERR on failure,
- * GNUNET_NO on timeout/queue drop
+ * @param success GNUNET_SYSERR on failure (including timeout/queue drop)
+ * GNUNET_NO if content was already there
* GNUNET_YES (or other positive value) on success
* @param msg NULL on success, otherwise an error message
*/