[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9042 - gnunet/src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9042 - gnunet/src/datastore |
Date: |
Tue, 29 Sep 2009 14:29:26 -0600 |
Author: grothoff
Date: 2009-09-29 14:29:26 -0600 (Tue, 29 Sep 2009)
New Revision: 9042
Modified:
gnunet/src/datastore/datastore_api.c
gnunet/src/datastore/gnunet-service-datastore.c
gnunet/src/datastore/plugin_datastore.h
gnunet/src/datastore/plugin_datastore_sqlite.c
gnunet/src/datastore/plugin_datastore_template.c
Log:
fixing comments and minor bugs
Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c 2009-09-29 19:36:50 UTC (rev
9041)
+++ gnunet/src/datastore/datastore_api.c 2009-09-29 20:29:26 UTC (rev
9042)
@@ -585,16 +585,18 @@
void *buf)
{
struct GNUNET_DATASTORE_Handle *h = cls;
- GNUNET_DATASTORE_ContinuationWithStatus cont = h->response_proc;
+ GNUNET_DATASTORE_Iterator cont = h->response_proc;
uint16_t msize;
if (buf == NULL)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Error transmitting message to datastore service.\n"));
h->response_proc = NULL;
h->message_size = 0;
cont (h->response_proc_cls,
- GNUNET_SYSERR,
- gettext_noop ("Error transmitting message to datastore
service.\n"));
+ NULL, 0, NULL, 0, 0, 0,
+ GNUNET_TIME_UNIT_ZERO_ABS, 0);
return 0;
}
msize = h->message_size;
Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c 2009-09-29 19:36:50 UTC
(rev 9041)
+++ gnunet/src/datastore/gnunet-service-datastore.c 2009-09-29 20:29:26 UTC
(rev 9042)
@@ -1069,7 +1069,6 @@
GNUNET_CRYPTO_hash (&dm[1],
ntohl(dm->size),
&vhash);
- GNUNET_SERVER_client_keep (client);
plugin->api->get (plugin->api->cls,
&dm->key,
&vhash,
Modified: gnunet/src/datastore/plugin_datastore.h
===================================================================
--- gnunet/src/datastore/plugin_datastore.h 2009-09-29 19:36:50 UTC (rev
9041)
+++ gnunet/src/datastore/plugin_datastore.h 2009-09-29 20:29:26 UTC (rev
9042)
@@ -112,6 +112,8 @@
/**
* Get an estimate of how much space the database is
* currently using.
+ *
+ * @param cls closure
* @return number of bytes used on disk
*/
typedef unsigned long long (*PluginGetSize) (void *cls);
@@ -185,6 +187,7 @@
* Note that it is possible for multiple values to match this put.
* In that case, all of the respective values are updated.
*
+ * @param cls closure
* @param uid unique identifier of the datum
* @param delta by how much should the priority
* change? If priority + delta < 0 the
@@ -206,6 +209,7 @@
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
*
+ * @param cls closure
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter function to call on each matching value; however,
@@ -223,6 +227,8 @@
/**
* Drop database.
+ *
+ * @param cls closure
*/
typedef void (*PluginDrop) (void *cls);
Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c 2009-09-29 19:36:50 UTC
(rev 9041)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c 2009-09-29 20:29:26 UTC
(rev 9042)
@@ -149,7 +149,10 @@
/**
* @brief Prepare a SQL statement
*
+ * @param dbh handle to the database
* @param zSql SQL statement, UTF-8 encoded
+ * @param ppStmt set to the prepared statement
+ * @return 0 on success
*/
static int
sq_prepare (sqlite3 * dbh, const char *zSql,
@@ -164,6 +167,8 @@
/**
* Create our database indices.
+ *
+ * @param dbh handle to the database
*/
static void
create_indices (sqlite3 * dbh)
@@ -205,6 +210,8 @@
* data structures (create tables and indices
* as needed as well).
*
+ * @param cfg our configuration
+ * @param plugin the plugin context (state for this module)
* @return GNUNET_OK on success
*/
static int
@@ -335,6 +342,7 @@
/**
* Synchronize our utilization statistics with the
* statistics service.
+ * @param plugin the plugin context (state for this module)
*/
static void
sync_stats (struct Plugin *plugin)
@@ -350,6 +358,7 @@
/**
* Shutdown database connection and associate data
* structures.
+ * @param plugin the plugin context (state for this module)
*/
static void
database_shutdown (struct Plugin *plugin)
@@ -368,6 +377,8 @@
/**
* Get an estimate of how much space the database is
* currently using.
+ *
+ * @param cls our plugin context
* @return number of bytes used on disk
*/
static unsigned long long sqlite_plugin_get_size (void *cls)
@@ -380,6 +391,9 @@
/**
* Delete the database entry with the given
* row identifier.
+ *
+ * @param plugin the plugin context (state for this module)
+ * @param rid the ID of the row to delete
*/
static int
delete_by_rowid (struct Plugin* plugin,
@@ -502,6 +516,7 @@
* Continuation of "sqlite_next_request".
*
* @param cls the next context
+ * @param tc the task context (unused)
*/
static void
sqlite_next_request_cont (void *cls,
@@ -743,6 +758,7 @@
* Note that it is possible for multiple values to match this put.
* In that case, all of the respective values are updated.
*
+ * @param cls the plugin context (state for this module)
* @param uid unique identifier of the datum
* @param delta by how much should the priority
* change? If priority + delta < 0 the
@@ -785,18 +801,57 @@
}
+/**
+ * Internal context for an iteration.
+ */
struct IterContext
{
+ /**
+ * FIXME.
+ */
sqlite3_stmt *stmt_1;
+
+ /**
+ * FIXME.
+ */
sqlite3_stmt *stmt_2;
+
+ /**
+ * FIXME.
+ */
int is_asc;
+
+ /**
+ * FIXME.
+ */
int is_prio;
+
+ /**
+ * FIXME.
+ */
int is_migr;
+
+ /**
+ * FIXME.
+ */
int limit_nonanonymous;
+
+ /**
+ * Desired type for blocks returned by this iterator.
+ */
uint32_t type;
};
+/**
+ * Prepare our SQL query to obtain the next record from the database.
+ *
+ * @param cls our "struct IterContext"
+ * @param nc NULL to terminate the iteration, otherwise our context for
+ * getting the next result.
+ * @return GNUNET_OK on success, GNUNET_NO if there are no more results,
+ * GNUNET_SYSERR on error (or end of iteration)
+ */
static int
iter_next_prepare (void *cls,
struct NextContext *nc)
@@ -903,12 +958,18 @@
* Call a method for each key in the database and
* call the callback method on it.
*
+ * @param plugin our plugin context
* @param type entries of which type should be considered?
+ * @param is_asc are we iterating in ascending order?
+ * @param is_prio are we iterating by priority (otherwise by expiration)
+ * @param is_migr are we iterating in migration order?
+ * @param limit_nonanonymous are we restricting results to those with anonymity
+ * level zero?
+ * @param stmt_str_1 first SQL statement to execute
+ * @param stmt_str_2 SQL statement to execute to get "more" results (inner
iteration)
* @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
- * @return the number of results processed,
- * GNUNET_SYSERR on error
*/
static void
basic_iter (struct Plugin *plugin,
@@ -987,6 +1048,7 @@
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
*
+ * @param cls our plugin context
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter function to call on each matching value;
@@ -1013,6 +1075,7 @@
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
*
+ * @param cls our plugin context
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter function to call on each matching value;
@@ -1051,6 +1114,7 @@
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
*
+ * @param cls our plugin context
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter function to call on each matching value;
@@ -1087,6 +1151,7 @@
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
*
+ * @param cls our plugin context
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter function to call on each matching value;
@@ -1116,6 +1181,15 @@
}
+/**
+ * Call sqlite using the already prepared query to get
+ * the next result.
+ *
+ * @param cls not used
+ * @param nc context with the prepared query
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error, GNUNET_NO if
+ * there are no more results
+ */
static int
all_next_prepare (void *cls,
struct NextContext *nc)
@@ -1152,6 +1226,7 @@
* Select a subset of the items in the datastore and call
* the given iterator for each of them.
*
+ * @param cls our plugin context
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter function to call on each matching value;
@@ -1189,18 +1264,59 @@
}
+/**
+ * FIXME.
+ */
struct GetNextContext
{
+
+ /**
+ * FIXME.
+ */
int total;
+
+ /**
+ * FIXME.
+ */
int off;
+
+ /**
+ * FIXME.
+ */
int have_vhash;
+
+ /**
+ * FIXME.
+ */
unsigned int type;
+
+ /**
+ * FIXME.
+ */
sqlite3_stmt *stmt;
+
+ /**
+ * FIXME.
+ */
GNUNET_HashCode key;
+
+ /**
+ * FIXME.
+ */
GNUNET_HashCode vhash;
};
+
+/**
+ * FIXME.
+ *
+ * @param cls our "struct GetNextContext*"
+ * @param nc FIXME
+ * @return GNUNET_YES if there are more results,
+ * GNUNET_NO if there are no more results,
+ * GNUNET_SYSERR on internal error
+ */
static int
get_next_prepare (void *cls,
struct NextContext *nc)
@@ -1381,6 +1497,8 @@
/**
* Drop database.
+ *
+ * @param cls our plugin context
*/
static void
sqlite_plugin_drop (void *cls)
@@ -1415,6 +1533,9 @@
/**
* Entry point for the plugin.
+ *
+ * @param cls the "struct GNUNET_DATASTORE_PluginEnvironment*"
+ * @return NULL on error, othrewise the plugin context
*/
void *
libgnunet_plugin_datastore_sqlite_init (void *cls)
@@ -1464,6 +1585,9 @@
/**
* Exit point from the plugin.
+ *
+ * @param cls the plugin context (as returned by "init")
+ * @return always NULL
*/
void *
libgnunet_plugin_datastore_sqlite_done (void *cls)
Modified: gnunet/src/datastore/plugin_datastore_template.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_template.c 2009-09-29 19:36:50 UTC
(rev 9041)
+++ gnunet/src/datastore/plugin_datastore_template.c 2009-09-29 20:29:26 UTC
(rev 9042)
@@ -43,6 +43,8 @@
/**
* Get an estimate of how much space the database is
* currently using.
+ *
+ * @param cls our "struct Plugin*"
* @return number of bytes used on disk
*/
static unsigned long long template_plugin_get_size (void *cls)
@@ -142,6 +144,7 @@
* Note that it is possible for multiple values to match this put.
* In that case, all of the respective values are updated.
*
+ * @param cls our "struct Plugin*"
* @param uid unique identifier of the datum
* @param delta by how much should the priority
* change? If priority + delta < 0 the
@@ -169,6 +172,7 @@
* 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;
@@ -211,6 +215,7 @@
* 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;
@@ -232,6 +237,7 @@
* 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;
@@ -253,6 +259,7 @@
* 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;
@@ -281,6 +288,9 @@
/**
* Entry point for the plugin.
+ *
+ * @param cls the "struct GNUNET_DATASTORE_PluginEnvironment*"
+ * @return our "struct Plugin*"
*/
void *
libgnunet_plugin_datastore_template_init (void *cls)
@@ -312,6 +322,8 @@
/**
* Exit point from the plugin.
+ * @param cls our "struct Plugin*"
+ * @return always NULL
*/
void *
libgnunet_plugin_datastore_template_done (void *cls)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9042 - gnunet/src/datastore,
gnunet <=