diff options
author | David Barksdale <amatus@amat.us> | 2017-03-19 15:55:32 -0500 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2017-03-19 17:38:36 -0500 |
commit | 2dde0202c5590eeb051c1346f2b66293d83b87ce (patch) | |
tree | 7997191912ee4c70959934d6c9783a0c9f450fec /src/fs/gnunet-service-fs_cadet_server.c | |
parent | d17d833dfd93a81f3540d472d1be4dfb7e9cbd03 (diff) | |
download | gnunet-2dde0202c5590eeb051c1346f2b66293d83b87ce.tar.gz gnunet-2dde0202c5590eeb051c1346f2b66293d83b87ce.zip |
[datastore] Fix #3743
This change adds support for key == NULL to the datastore plugins
and replaces the offset argument with a next_uid and random arguments to
increase performance in the key == NULL case.
With the offset argument a datastore plugin would have to count all
matching keys before fetching the key at the right offset, which would
iterate over the entire database in the case of key == NULL.
The offset argument was used in two ways: to iterate over a set of
matching values and to start iteration at a random matching value. The new API
seperates these into two arguments: if random is true it will return a
random matching value, otherwise next_uid can be set to uid + 1 to return the
next matching value.
The random argument was not added to get_zero_anonymity. This function
is used to periodically insert zero anonymity values into the DHT. I
don't think it's necessary to randomize this.
Diffstat (limited to 'src/fs/gnunet-service-fs_cadet_server.c')
-rw-r--r-- | src/fs/gnunet-service-fs_cadet_server.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c index b1a098175..f8619b812 100644 --- a/src/fs/gnunet-service-fs_cadet_server.c +++ b/src/fs/gnunet-service-fs_cadet_server.c | |||
@@ -345,12 +345,13 @@ handle_request (void *cls, | |||
345 | GNUNET_NO); | 345 | GNUNET_NO); |
346 | refresh_timeout_task (sc); | 346 | refresh_timeout_task (sc); |
347 | sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh, | 347 | sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh, |
348 | 0, | 348 | 0 /* next_uid */, |
349 | &sqm->query, | 349 | false /* random */, |
350 | ntohl (sqm->type), | 350 | &sqm->query, |
351 | 0 /* priority */, | 351 | ntohl (sqm->type), |
352 | GSF_datastore_queue_size, | 352 | 0 /* priority */, |
353 | &handle_datastore_reply, | 353 | GSF_datastore_queue_size, |
354 | &handle_datastore_reply, | ||
354 | sc); | 355 | sc); |
355 | if (NULL == sc->qe) | 356 | if (NULL == sc->qe) |
356 | { | 357 | { |