aboutsummaryrefslogtreecommitdiff
path: root/src/datacache
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-04-29 08:03:22 +0000
committerChristian Grothoff <christian@grothoff.org>2015-04-29 08:03:22 +0000
commitb0a50c0e1fd6e5434c7e53e4b55748368247e839 (patch)
tree993cb561c9a854f94ce6b5a2c03172f6cb308fad /src/datacache
parent0664750ce887ed3b6be4ab8006165ffdbe16e50e (diff)
downloadgnunet-b0a50c0e1fd6e5434c7e53e4b55748368247e839.tar.gz
gnunet-b0a50c0e1fd6e5434c7e53e4b55748368247e839.zip
-add counter for #items
Diffstat (limited to 'src/datacache')
-rw-r--r--src/datacache/plugin_datacache_postgres.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index 07343a313..9f3d6beec 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -50,6 +50,10 @@ struct Plugin
50 */ 50 */
51 PGconn *dbh; 51 PGconn *dbh;
52 52
53 /**
54 * Number of key-value pairs in the database.
55 */
56 unsigned int num_items;
53}; 57};
54 58
55 59
@@ -200,6 +204,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
200 GNUNET_POSTGRES_check_result (plugin->dbh, ret, 204 GNUNET_POSTGRES_check_result (plugin->dbh, ret,
201 PGRES_COMMAND_OK, "PQexecPrepared", "put")) 205 PGRES_COMMAND_OK, "PQexecPrepared", "put"))
202 return -1; 206 return -1;
207 plugin->num_items++;
203 PQclear (ret); 208 PQclear (ret);
204 return size + OVERHEAD; 209 return size + OVERHEAD;
205} 210}
@@ -355,6 +360,7 @@ postgres_plugin_del (void *cls)
355 PQclear (res); 360 PQclear (res);
356 if (GNUNET_OK != GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", oid)) 361 if (GNUNET_OK != GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", oid))
357 return GNUNET_SYSERR; 362 return GNUNET_SYSERR;
363 plugin->num_items--;
358 plugin->env->delete_notify (plugin->env->cls, &key, size + OVERHEAD); 364 plugin->env->delete_notify (plugin->env->cls, &key, size + OVERHEAD);
359 return GNUNET_OK; 365 return GNUNET_OK;
360} 366}