gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35664 - gnunet/src/datacache


From: gnunet
Subject: [GNUnet-SVN] r35664 - gnunet/src/datacache
Date: Wed, 29 Apr 2015 09:41:48 +0200

Author: grothoff
Date: 2015-04-29 09:41:48 +0200 (Wed, 29 Apr 2015)
New Revision: 35664

Modified:
   gnunet/src/datacache/plugin_datacache_sqlite.c
Log:
-add counter for #items

Modified: gnunet/src/datacache/plugin_datacache_sqlite.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_sqlite.c      2015-04-28 22:45:47 UTC 
(rev 35663)
+++ gnunet/src/datacache/plugin_datacache_sqlite.c      2015-04-29 07:41:48 UTC 
(rev 35664)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     Copyright (C) 2006, 2009 Christian Grothoff (and other contributing 
authors)
+     Copyright (C) 2006, 2009, 2015 Christian Grothoff (and other contributing 
authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -58,6 +58,11 @@
    * Filename used for the DB.
    */
   char *fn;
+
+  /**
+   * Number of key-value pairs in the database.
+   */
+  unsigned int num_items;
 };
 
 
@@ -95,7 +100,7 @@
  * @param data data to store
  * @param type type of the value
  * @param discard_time when to discard the value in any case
- * @param path_info_len number of entries in 'path_info'
+ * @param path_info_len number of entries in @a path_info
  * @param path_info array of peers that have processed the request
  * @return 0 if duplicate, -1 on error, number of bytes used otherwise
  */
@@ -154,6 +159,7 @@
     sqlite3_finalize (stmt);
     return -1;
   }
+  plugin->num_items++;
   if (SQLITE_OK != sqlite3_finalize (stmt))
     LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
                 "sqlite3_finalize");
@@ -365,6 +371,7 @@
     (void) sqlite3_finalize (dstmt);
     return GNUNET_SYSERR;
   }
+  plugin->num_items--;
   plugin->env->delete_notify (plugin->env->cls, &hc, dsize + OVERHEAD);
   if (SQLITE_OK != sqlite3_finalize (dstmt))
     LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]