aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/gnunet-service-datastore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-06 15:24:26 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-06 15:24:26 +0000
commit3d7bae58c4b9b128e6000a2fe1fe65595235bb14 (patch)
treed50cfa569c5d447da5663333e61964c47ac09f73 /src/datastore/gnunet-service-datastore.c
parent6cef8fea0c3b6756870786ebc4db0588373c8f65 (diff)
downloadgnunet-3d7bae58c4b9b128e6000a2fe1fe65595235bb14.tar.gz
gnunet-3d7bae58c4b9b128e6000a2fe1fe65595235bb14.zip
misc fixes
Diffstat (limited to 'src/datastore/gnunet-service-datastore.c')
-rw-r--r--src/datastore/gnunet-service-datastore.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 8f4df3ba7..898b6a9d8 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -37,6 +37,11 @@
37#define MAX_PENDING 1024 37#define MAX_PENDING 1024
38 38
39/** 39/**
40 * Limit size of bloom filter to 2 GB.
41 */
42#define MAX_BF_SIZE ((uint32_t) (1LL << 31))
43
44/**
40 * How long are we at most keeping "expired" content 45 * How long are we at most keeping "expired" content
41 * past the expiration date in the database? 46 * past the expiration date in the database?
42 */ 47 */
@@ -184,7 +189,7 @@ static unsigned long long payload;
184 * Identity of the task that is used to delete 189 * Identity of the task that is used to delete
185 * expired content. 190 * expired content.
186 */ 191 */
187static struct GNUNET_SCHEDULER_Task * expired_kill_task; 192static struct GNUNET_SCHEDULER_Task *expired_kill_task;
188 193
189/** 194/**
190 * Minimum time that content should have to not be discarded instantly 195 * Minimum time that content should have to not be discarded instantly
@@ -537,7 +542,8 @@ transmit_callback (void *cls, size_t size, void *buf)
537 * @param msg message to transmit, will be freed! 542 * @param msg message to transmit, will be freed!
538 */ 543 */
539static void 544static void
540transmit (struct GNUNET_SERVER_Client *client, struct GNUNET_MessageHeader *msg) 545transmit (struct GNUNET_SERVER_Client *client,
546 struct GNUNET_MessageHeader *msg)
541{ 547{
542 struct TransmitCallbackContext *tcc; 548 struct TransmitCallbackContext *tcc;
543 549
@@ -611,14 +617,18 @@ transmit_status (struct GNUNET_SERVER_Client *client, int code, const char *msg)
611 * @param expiration expiration time for the content 617 * @param expiration expiration time for the content
612 * @param uid unique identifier for the datum; 618 * @param uid unique identifier for the datum;
613 * maybe 0 if no unique identifier is available 619 * maybe 0 if no unique identifier is available
614 * 620 * @return #GNUNET_SYSERR to abort the iteration, #GNUNET_OK to continue,
615 * @return GNUNET_SYSERR to abort the iteration, GNUNET_OK to continue, 621 * #GNUNET_NO to delete the item and continue (if supported)
616 * GNUNET_NO to delete the item and continue (if supported)
617 */ 622 */
618static int 623static int
619transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 624transmit_item (void *cls,
620 const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, 625 const struct GNUNET_HashCode *key,
621 uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, 626 uint32_t size,
627 const void *data,
628 enum GNUNET_BLOCK_Type type,
629 uint32_t priority,
630 uint32_t anonymity,
631 struct GNUNET_TIME_Absolute expiration,
622 uint64_t uid) 632 uint64_t uid)
623{ 633{
624 struct GNUNET_SERVER_Client *client = cls; 634 struct GNUNET_SERVER_Client *client = cls;
@@ -1798,12 +1808,17 @@ run (void *cls,
1798 return; 1808 return;
1799 } 1809 }
1800 stats = GNUNET_STATISTICS_create ("datastore", cfg); 1810 stats = GNUNET_STATISTICS_create ("datastore", cfg);
1801 GNUNET_STATISTICS_set (stats, gettext_noop ("# quota"), quota, GNUNET_NO); 1811 GNUNET_STATISTICS_set (stats,
1812 gettext_noop ("# quota"),
1813 quota,
1814 GNUNET_NO);
1802 cache_size = quota / 8; /* Or should we make this an option? */ 1815 cache_size = quota / 8; /* Or should we make this an option? */
1803 GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size, 1816 GNUNET_STATISTICS_set (stats,
1817 gettext_noop ("# cache size"),
1818 cache_size,
1804 GNUNET_NO); 1819 GNUNET_NO);
1805 if (quota / (32 * 1024LL) > (1 << 31)) 1820 if (quota / (32 * 1024LL) > MAX_BF_SIZE)
1806 bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */ 1821 bf_size = MAX_BF_SIZE;
1807 else 1822 else
1808 bf_size = quota / (32 * 1024LL); /* 8 bit per entry, 1 bit per 32 kb in DB */ 1823 bf_size = quota / (32 * 1024LL); /* 8 bit per entry, 1 bit per 32 kb in DB */
1809 fn = NULL; 1824 fn = NULL;