diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-29 08:03:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-29 08:03:22 +0000 |
commit | b0a50c0e1fd6e5434c7e53e4b55748368247e839 (patch) | |
tree | 993cb561c9a854f94ce6b5a2c03172f6cb308fad /src/datacache/plugin_datacache_postgres.c | |
parent | 0664750ce887ed3b6be4ab8006165ffdbe16e50e (diff) |
-add counter for #items
Diffstat (limited to 'src/datacache/plugin_datacache_postgres.c')
-rw-r--r-- | src/datacache/plugin_datacache_postgres.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; } |