diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-11 11:18:34 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-11 11:18:34 +0000 |
commit | 9e921c69007ba709fee460751d7f20237dd56ed7 (patch) | |
tree | 27077c143c90585bdce863f19135e4db17c4a0d6 /src/include/gnunet_dht_service.h | |
parent | 1b18069ef2567ffe0994c799d1d179329d629ca9 (diff) | |
download | gnunet-9e921c69007ba709fee460751d7f20237dd56ed7.tar.gz gnunet-9e921c69007ba709fee460751d7f20237dd56ed7.zip |
Adding replication parameter for initiating GET and PUT requests to the DHT.
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r-- | src/include/gnunet_dht_service.h | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 7ab818de7..18eab8a9f 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -52,6 +52,20 @@ extern "C" | |||
52 | #define GNUNET_DHT_GET_BLOOMFILTER_K 16 | 52 | #define GNUNET_DHT_GET_BLOOMFILTER_K 16 |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Non-intelligent default DHT GET replication. | ||
56 | * Should be chosen by application if anything about | ||
57 | * the network is known. | ||
58 | */ | ||
59 | #define DEFAULT_GET_REPLICATION 5 | ||
60 | |||
61 | /** | ||
62 | * Non-intelligent default DHT PUT replication. | ||
63 | * Should be chosen by application if anything about | ||
64 | * the network is known. | ||
65 | */ | ||
66 | #define DEFAULT_PUT_REPLICATION 8 | ||
67 | |||
68 | /** | ||
55 | * Connection to the DHT service. | 69 | * Connection to the DHT service. |
56 | */ | 70 | */ |
57 | struct GNUNET_DHT_Handle; | 71 | struct GNUNET_DHT_Handle; |
@@ -121,33 +135,34 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | |||
121 | /* *************** Standard API: get and put ******************* */ | 135 | /* *************** Standard API: get and put ******************* */ |
122 | 136 | ||
123 | /** | 137 | /** |
124 | * Perform a PUT operation on the DHT identified by 'table' storing | 138 | * Perform a PUT operation storing data in the DHT. |
125 | * a binding of 'key' to 'value'. The peer does not have to be part | ||
126 | * of the table (if so, we will attempt to locate a peer that is!) | ||
127 | * | 139 | * |
128 | * @param handle handle to DHT service | 140 | * @param handle handle to DHT service |
129 | * @param key the key to store data under | 141 | * @param key the key to store under |
142 | * @param desired_replication_level estimate of how many | ||
143 | * nearest peers this request should reach | ||
130 | * @param options routing options for this message | 144 | * @param options routing options for this message |
131 | * @param type type of the value | 145 | * @param type type of the value |
132 | * @param size number of bytes in data; must be less than 64k | 146 | * @param size number of bytes in data; must be less than 64k |
133 | * @param data the data to store | 147 | * @param data the data to store |
134 | * @param exp desired expiration time for the data | 148 | * @param exp desired expiration time for the value |
135 | * @param timeout when to abort if we fail to transmit the request | 149 | * @param timeout how long to wait for transmission of this request |
136 | * for the PUT to the local DHT service | ||
137 | * @param cont continuation to call when done (transmitting request to service) | 150 | * @param cont continuation to call when done (transmitting request to service) |
138 | * @param cont_cls closure for cont | 151 | * @param cont_cls closure for cont |
152 | * @return GNUNET_YES if put message is queued for transmission | ||
139 | */ | 153 | */ |
140 | void | 154 | void |
141 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | 155 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, |
142 | const GNUNET_HashCode * key, | 156 | const GNUNET_HashCode * key, |
143 | enum GNUNET_DHT_RouteOption options, | 157 | uint32_t desired_replication_level, |
158 | enum GNUNET_DHT_RouteOption options, | ||
144 | enum GNUNET_BLOCK_Type type, | 159 | enum GNUNET_BLOCK_Type type, |
145 | size_t size, | 160 | size_t size, |
146 | const char *data, | 161 | const char *data, |
147 | struct GNUNET_TIME_Absolute exp, | 162 | struct GNUNET_TIME_Absolute exp, |
148 | struct GNUNET_TIME_Relative timeout, | 163 | struct GNUNET_TIME_Relative timeout, |
149 | GNUNET_SCHEDULER_Task cont, | 164 | GNUNET_SCHEDULER_Task cont, |
150 | void *cont_cls); | 165 | void *cont_cls); |
151 | 166 | ||
152 | 167 | ||
153 | /** | 168 | /** |
@@ -177,33 +192,36 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls, | |||
177 | 192 | ||
178 | 193 | ||
179 | /** | 194 | /** |
180 | * Perform an asynchronous GET operation on the DHT. See | 195 | * Perform an asynchronous GET operation on the DHT identified. See |
181 | * also "GNUNET_BLOCK_evaluate". | 196 | * also "GNUNET_BLOCK_evaluate". |
182 | * | 197 | * |
183 | * @param handle handle to the DHT service | 198 | * @param handle handle to the DHT service |
184 | * @param timeout timeout for this request to be sent to the | 199 | * @param timeout how long to wait for transmission of this request to the service |
185 | * service (this is NOT a timeout for receiving responses) | 200 | * @param type expected type of the response object |
186 | * @param type expected type of the response object (GNUNET_BLOCK_TYPE_FS_*) | ||
187 | * @param key the key to look up | 201 | * @param key the key to look up |
202 | * @param desired_replication_level estimate of how many | ||
203 | nearest peers this request should reach | ||
188 | * @param options routing options for this message | 204 | * @param options routing options for this message |
189 | * @param bf bloom filter associated with query (can be NULL) | 205 | * @param bf bloom filter associated with query (can be NULL) |
190 | * @param bf_mutator mutation value for bf | 206 | * @param bf_mutator mutation value for bf |
191 | * @param xquery extrended query data (can be NULL, depending on type) | 207 | * @param xquery extended query data (can be NULL, depending on type) |
192 | * @param xquery_size number of bytes in xquery | 208 | * @param xquery_size number of bytes in xquery |
193 | * @param iter function to call on each result | 209 | * @param iter function to call on each result |
194 | * @param iter_cls closure for iter | 210 | * @param iter_cls closure for iter |
195 | * @return handle to stop the async get, NULL on error | 211 | * |
212 | * @return handle to stop the async get | ||
196 | */ | 213 | */ |
197 | struct GNUNET_DHT_GetHandle * | 214 | struct GNUNET_DHT_GetHandle * |
198 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | 215 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, |
199 | struct GNUNET_TIME_Relative timeout, | 216 | struct GNUNET_TIME_Relative timeout, |
200 | enum GNUNET_BLOCK_Type type, | 217 | enum GNUNET_BLOCK_Type type, |
201 | const GNUNET_HashCode * key, | 218 | const GNUNET_HashCode * key, |
202 | enum GNUNET_DHT_RouteOption options, | 219 | uint32_t desired_replication_level, |
203 | const struct GNUNET_CONTAINER_BloomFilter *bf, | 220 | enum GNUNET_DHT_RouteOption options, |
204 | int32_t bf_mutator, | 221 | const struct GNUNET_CONTAINER_BloomFilter *bf, |
205 | const void *xquery, | 222 | int32_t bf_mutator, |
206 | size_t xquery_size, | 223 | const void *xquery, |
224 | size_t xquery_size, | ||
207 | GNUNET_DHT_GetIterator iter, | 225 | GNUNET_DHT_GetIterator iter, |
208 | void *iter_cls); | 226 | void *iter_cls); |
209 | 227 | ||
@@ -212,6 +230,9 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |||
212 | * Stop async DHT-get. Frees associated resources. | 230 | * Stop async DHT-get. Frees associated resources. |
213 | * | 231 | * |
214 | * @param get_handle GET operation to stop. | 232 | * @param get_handle GET operation to stop. |
233 | * | ||
234 | * On return get_handle will no longer be valid, caller | ||
235 | * must not use again!!! | ||
215 | */ | 236 | */ |
216 | void | 237 | void |
217 | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | 238 | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); |