aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-02 20:24:02 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-02 20:24:02 +0100
commite3ff017054eb35dedd95ae4fe66c82b88e3bbdc3 (patch)
treeabb821d63f09d0982d6f6802ec1c55234dcc0f5c /src/include
parent329f0458fa1fce45ce1c31e86771ffefb22e941e (diff)
downloadgnunet-e3ff017054eb35dedd95ae4fe66c82b88e3bbdc3.tar.gz
gnunet-e3ff017054eb35dedd95ae4fe66c82b88e3bbdc3.zip
-non-trivial refactoring/cleanup of the DHT code
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_datacache_plugin.h60
1 files changed, 27 insertions, 33 deletions
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h
index d7fa8fde0..5d5cac12c 100644
--- a/src/include/gnunet_datacache_plugin.h
+++ b/src/include/gnunet_datacache_plugin.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2006, 2009, 2015 GNUnet e.V. 3 Copyright (C) 2006, 2009, 2015, 2022 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -115,15 +115,17 @@ struct GNUNET_DATACACHE_PluginFunctions
115 * @param path_info a path through the network 115 * @param path_info a path through the network
116 * @return 0 if duplicate, -1 on error, number of bytes used otherwise 116 * @return 0 if duplicate, -1 on error, number of bytes used otherwise
117 */ 117 */
118 ssize_t (*put) (void *cls, 118 ssize_t
119 const struct GNUNET_HashCode *key, 119 (*put) (void *cls,
120 uint32_t xor_distance, 120 const struct GNUNET_HashCode *key,
121 size_t size, 121 uint32_t xor_distance,
122 const char *data, 122 size_t size,
123 enum GNUNET_BLOCK_Type type, 123 const char *data,
124 struct GNUNET_TIME_Absolute discard_time, 124 enum GNUNET_BLOCK_Type type,
125 unsigned int path_info_len, 125 struct GNUNET_TIME_Absolute discard_time,
126 const struct GNUNET_PeerIdentity *path_info); 126 unsigned int path_info_len,
127 const struct GNUNET_PeerIdentity *path_info);
128
127 129
128 /** 130 /**
129 * Iterate over the results for a particular key 131 * Iterate over the results for a particular key
@@ -136,11 +138,13 @@ struct GNUNET_DATACACHE_PluginFunctions
136 * @param iter_cls closure for @a iter 138 * @param iter_cls closure for @a iter
137 * @return the number of results found 139 * @return the number of results found
138 */ 140 */
139 unsigned int (*get) (void *cls, 141 unsigned int
140 const struct GNUNET_HashCode *key, 142 (*get) (void *cls,
141 enum GNUNET_BLOCK_Type type, 143 const struct GNUNET_HashCode *key,
142 GNUNET_DATACACHE_Iterator iter, 144 enum GNUNET_BLOCK_Type type,
143 void *iter_cls); 145 GNUNET_DATACACHE_Iterator iter,
146 void *iter_cls);
147
144 148
145 /** 149 /**
146 * Delete the entry with the lowest expiration value 150 * Delete the entry with the lowest expiration value
@@ -149,19 +153,8 @@ struct GNUNET_DATACACHE_PluginFunctions
149 * @param cls closure (internal context for the plugin) 153 * @param cls closure (internal context for the plugin)
150 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 154 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
151 */ 155 */
152 int (*del) (void *cls); 156 enum GNUNET_GenericReturnValue
153 157 (*del)(void *cls);
154 /**
155 * Return a random value from the datastore.
156 *
157 * @param cls closure (internal context for the plugin)
158 * @param iter maybe NULL (to just count)
159 * @param iter_cls closure for @a iter
160 * @return the number of results found (zero or one)
161 */
162 unsigned int (*get_random) (void *cls,
163 GNUNET_DATACACHE_Iterator iter,
164 void *iter_cls);
165 158
166 159
167 /** 160 /**
@@ -177,11 +170,12 @@ struct GNUNET_DATACACHE_PluginFunctions
177 * @param iter_cls closure for @a iter 170 * @param iter_cls closure for @a iter
178 * @return the number of results found 171 * @return the number of results found
179 */ 172 */
180 unsigned int (*get_closest) (void *cls, 173 unsigned int
181 const struct GNUNET_HashCode *key, 174 (*get_closest) (void *cls,
182 unsigned int num_results, 175 const struct GNUNET_HashCode *key,
183 GNUNET_DATACACHE_Iterator iter, 176 unsigned int num_results,
184 void *iter_cls); 177 GNUNET_DATACACHE_Iterator iter,
178 void *iter_cls);
185}; 179};
186 180
187 181