aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/datacache.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-11-12 11:00:20 +0000
committerChristian Grothoff <christian@grothoff.org>2012-11-12 11:00:20 +0000
commitc83da8c6bf5e80cd1b8597b30ba17a312718e4cc (patch)
tree519caa183917783d800d87118973ca5ef4e65230 /src/datacache/datacache.c
parent8282abfff7909f8034c63188d982c5c602246f91 (diff)
downloadgnunet-c83da8c6bf5e80cd1b8597b30ba17a312718e4cc.tar.gz
gnunet-c83da8c6bf5e80cd1b8597b30ba17a312718e4cc.zip
support running purely in-memory
Diffstat (limited to 'src/datacache/datacache.c')
-rw-r--r--src/datacache/datacache.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c
index 80ce1a677..1af4a148f 100644
--- a/src/datacache/datacache.c
+++ b/src/datacache/datacache.c
@@ -154,12 +154,19 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
154 bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ 154 bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
155 155
156 ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle)); 156 ret = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_Handle));
157 ret->bloom_name = GNUNET_DISK_mktemp ("gnunet-datacachebloom"); 157
158 if (GNUNET_YES !=
159 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF_RC"))
160 {
161 fprintf (stderr, "Using RC!\n");
162 ret->bloom_name = GNUNET_DISK_mktemp ("gnunet-datacachebloom");
163 }
158 if (NULL != ret->bloom_name) 164 if (NULL != ret->bloom_name)
159 { 165 {
160 ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */ 166 ret->filter = GNUNET_CONTAINER_bloomfilter_load (ret->bloom_name, quota / 1024, /* 8 bit per entry in DB, expect 1k entries */
161 5); 167 5);
162 } 168 }
169
163 if (NULL == ret->filter) 170 if (NULL == ret->filter)
164 { 171 {
165 ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */ 172 ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, bf_size, 5); /* approx. 3% false positives at max use */