diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:56:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:56:54 +0000 |
commit | a2e148e05518211035b0d992a214a14b3fb14d0a (patch) | |
tree | 64a1e2778107604f59a2ac4a249474c25161fde5 /src/datacache | |
parent | 786745c969589eae2aa069885b40eba0f3989507 (diff) | |
download | gnunet-a2e148e05518211035b0d992a214a14b3fb14d0a.tar.gz gnunet-a2e148e05518211035b0d992a214a14b3fb14d0a.zip |
implementing 'get_closest' API for template
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/plugin_datacache_template.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/datacache/plugin_datacache_template.c b/src/datacache/plugin_datacache_template.c index 16d018995..2b7327fec 100644 --- a/src/datacache/plugin_datacache_template.c +++ b/src/datacache/plugin_datacache_template.c | |||
@@ -124,6 +124,32 @@ template_plugin_get_random (void *cls, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | |||
128 | /** | ||
129 | * Iterate over the results that are "close" to a particular key in | ||
130 | * the datacache. "close" is defined as numerically larger than @a | ||
131 | * key (when interpreted as a circular address space), with small | ||
132 | * distance. | ||
133 | * | ||
134 | * @param cls closure (internal context for the plugin) | ||
135 | * @param key area of the keyspace to look into | ||
136 | * @param num_results number of results that should be returned to @a iter | ||
137 | * @param iter maybe NULL (to just count) | ||
138 | * @param iter_cls closure for @a iter | ||
139 | * @return the number of results found | ||
140 | */ | ||
141 | static unsigned int | ||
142 | template_plugin_get_closest (void *cls, | ||
143 | const struct GNUNET_HashCode *key, | ||
144 | unsigned int num_results, | ||
145 | GNUNET_DATACACHE_Iterator iter, | ||
146 | void *iter_cls) | ||
147 | { | ||
148 | GNUNET_break (0); | ||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | |||
127 | /** | 153 | /** |
128 | * Entry point for the plugin. | 154 | * Entry point for the plugin. |
129 | * | 155 | * |
@@ -145,6 +171,7 @@ libgnunet_plugin_datacache_template_init (void *cls) | |||
145 | api->put = &template_plugin_put; | 171 | api->put = &template_plugin_put; |
146 | api->del = &template_plugin_del; | 172 | api->del = &template_plugin_del; |
147 | api->get_random = &template_plugin_get_random; | 173 | api->get_random = &template_plugin_get_random; |
174 | api->get_closest = &template_plugin_get_closest; | ||
148 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, | 175 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, |
149 | "template", | 176 | "template", |
150 | "Template datacache running\n"); | 177 | "Template datacache running\n"); |