diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_datacache_lib.h | 22 | ||||
-rw-r--r-- | src/include/gnunet_datacache_plugin.h | 21 |
2 files changed, 41 insertions, 2 deletions
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h index f3761bd89..edbba7de4 100644 --- a/src/include/gnunet_datacache_lib.h +++ b/src/include/gnunet_datacache_lib.h | |||
@@ -133,7 +133,8 @@ unsigned int | |||
133 | GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | 133 | GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, |
134 | const struct GNUNET_HashCode *key, | 134 | const struct GNUNET_HashCode *key, |
135 | enum GNUNET_BLOCK_Type type, | 135 | enum GNUNET_BLOCK_Type type, |
136 | GNUNET_DATACACHE_Iterator iter, void *iter_cls); | 136 | GNUNET_DATACACHE_Iterator iter, |
137 | void *iter_cls); | ||
137 | 138 | ||
138 | 139 | ||
139 | /** | 140 | /** |
@@ -150,6 +151,25 @@ GNUNET_DATACACHE_get_random (struct GNUNET_DATACACHE_Handle *h, | |||
150 | void *iter_cls); | 151 | void *iter_cls); |
151 | 152 | ||
152 | 153 | ||
154 | /** | ||
155 | * Iterate over the results that are "close" to a particular key in | ||
156 | * the datacache. "close" is defined as numerically larger than @a | ||
157 | * key (when interpreted as a circular address space), with small | ||
158 | * distance. | ||
159 | * | ||
160 | * @param h handle to the datacache | ||
161 | * @param key area of the keyspace to look into | ||
162 | * @param num_results number of results that should be returned to @a iter | ||
163 | * @param iter maybe NULL (to just count) | ||
164 | * @param iter_cls closure for @a iter | ||
165 | * @return the number of results found | ||
166 | */ | ||
167 | unsigned int | ||
168 | GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h, | ||
169 | const struct GNUNET_HashCode *key, | ||
170 | unsigned int num_results, | ||
171 | GNUNET_DATACACHE_Iterator iter, | ||
172 | void *iter_cls); | ||
153 | 173 | ||
154 | 174 | ||
155 | #if 0 /* keep Emacsens' auto-indent happy */ | 175 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h index 0810a41d9..bd915bdc0 100644 --- a/src/include/gnunet_datacache_plugin.h +++ b/src/include/gnunet_datacache_plugin.h | |||
@@ -133,7 +133,7 @@ struct GNUNET_DATACACHE_PluginFunctions | |||
133 | * @return the number of results found | 133 | * @return the number of results found |
134 | */ | 134 | */ |
135 | unsigned int (*get) (void *cls, | 135 | unsigned int (*get) (void *cls, |
136 | const struct GNUNET_HashCode * key, | 136 | const struct GNUNET_HashCode *key, |
137 | enum GNUNET_BLOCK_Type type, | 137 | enum GNUNET_BLOCK_Type type, |
138 | GNUNET_DATACACHE_Iterator iter, | 138 | GNUNET_DATACACHE_Iterator iter, |
139 | void *iter_cls); | 139 | void *iter_cls); |
@@ -160,6 +160,25 @@ struct GNUNET_DATACACHE_PluginFunctions | |||
160 | void *iter_cls); | 160 | void *iter_cls); |
161 | 161 | ||
162 | 162 | ||
163 | /** | ||
164 | * Iterate over the results that are "close" to a particular key in | ||
165 | * the datacache. "close" is defined as numerically larger than @a | ||
166 | * key (when interpreted as a circular address space), with small | ||
167 | * distance. | ||
168 | * | ||
169 | * @param cls closure (internal context for the plugin) | ||
170 | * @param key area of the keyspace to look into | ||
171 | * @param num_results number of results that should be returned to @a iter | ||
172 | * @param iter maybe NULL (to just count) | ||
173 | * @param iter_cls closure for @a iter | ||
174 | * @return the number of results found | ||
175 | */ | ||
176 | unsigned int (*get_closest) (void *cls, | ||
177 | const struct GNUNET_HashCode *key, | ||
178 | unsigned int num_results, | ||
179 | GNUNET_DATACACHE_Iterator iter, | ||
180 | void *iter_cls); | ||
181 | |||
163 | }; | 182 | }; |
164 | 183 | ||
165 | 184 | ||