From b0a50c0e1fd6e5434c7e53e4b55748368247e839 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 29 Apr 2015 08:03:22 +0000 Subject: -add counter for #items --- src/datacache/plugin_datacache_postgres.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/datacache/plugin_datacache_postgres.c') diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index 07343a313a..9f3d6beec3 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c @@ -50,6 +50,10 @@ struct Plugin */ PGconn *dbh; + /** + * Number of key-value pairs in the database. + */ + unsigned int num_items; }; @@ -200,6 +204,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, GNUNET_POSTGRES_check_result (plugin->dbh, ret, PGRES_COMMAND_OK, "PQexecPrepared", "put")) return -1; + plugin->num_items++; PQclear (ret); return size + OVERHEAD; } @@ -355,6 +360,7 @@ postgres_plugin_del (void *cls) PQclear (res); if (GNUNET_OK != GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", oid)) return GNUNET_SYSERR; + plugin->num_items--; plugin->env->delete_notify (plugin->env->cls, &key, size + OVERHEAD); return GNUNET_OK; } -- cgit v1.2.3-18-g5258