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/datastore/test_plugin_datastore.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/datastore/test_plugin_datastore.c')
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index 9b85d57da..94d93aac6 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c | |||
@@ -64,7 +64,6 @@ struct CpsRunContext | |||
64 | enum RunPhase phase; | 64 | enum RunPhase phase; |
65 | unsigned int cnt; | 65 | unsigned int cnt; |
66 | unsigned int i; | 66 | unsigned int i; |
67 | uint64_t offset; | ||
68 | }; | 67 | }; |
69 | 68 | ||
70 | 69 | ||
@@ -308,7 +307,8 @@ test (void *cls) | |||
308 | "Looking for %s\n", | 307 | "Looking for %s\n", |
309 | GNUNET_h2s (&key)); | 308 | GNUNET_h2s (&key)); |
310 | crc->api->get_key (crc->api->cls, | 309 | crc->api->get_key (crc->api->cls, |
311 | crc->offset++, | 310 | 0, |
311 | false, | ||
312 | &key, | 312 | &key, |
313 | NULL, | 313 | NULL, |
314 | GNUNET_BLOCK_TYPE_ANY, | 314 | GNUNET_BLOCK_TYPE_ANY, |