diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:56:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:56:00 +0000 |
commit | 786745c969589eae2aa069885b40eba0f3989507 (patch) | |
tree | 6f5c8573b021ba628b4f135f3fb964728b3e1724 /src/include/gnunet_datacache_lib.h | |
parent | a49b0f351926cf4376a58937a94e37426e3ae167 (diff) | |
download | gnunet-786745c969589eae2aa069885b40eba0f3989507.tar.gz gnunet-786745c969589eae2aa069885b40eba0f3989507.zip |
implementing 'get_closest' API for sqlite and postgres datacache plugins
Diffstat (limited to 'src/include/gnunet_datacache_lib.h')
-rw-r--r-- | src/include/gnunet_datacache_lib.h | 22 |
1 files changed, 21 insertions, 1 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 */ |