diff options
author | Gabor X Toth <*@tg-x.net> | 2013-08-29 15:14:17 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-08-29 15:14:17 +0000 |
commit | 81eaa5a9d5ebe1e61790069a2777178abd1b6a2c (patch) | |
tree | 2b24561b930dca7ede2d27590e1c434fe19ed365 /src/include/gnunet_psycstore_service.h | |
parent | b1ed5b9a472bd56796646a70068eb48da0db3e2f (diff) | |
download | gnunet-81eaa5a9d5ebe1e61790069a2777178abd1b6a2c.tar.gz gnunet-81eaa5a9d5ebe1e61790069a2777178abd1b6a2c.zip |
psycstore: sqlite plugin
Diffstat (limited to 'src/include/gnunet_psycstore_service.h')
-rw-r--r-- | src/include/gnunet_psycstore_service.h | 137 |
1 files changed, 97 insertions, 40 deletions
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h index e3c7876a0..bbf5a7d19 100644 --- a/src/include/gnunet_psycstore_service.h +++ b/src/include/gnunet_psycstore_service.h | |||
@@ -78,43 +78,6 @@ struct GNUNET_PSYCSTORE_OperationHandle; | |||
78 | 78 | ||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Callback used to return the latest value of counters of a channel. | ||
82 | * | ||
83 | * @see GNUNET_PSYCSTORE_counters_get() | ||
84 | * | ||
85 | * @param *cls Closure. | ||
86 | * @param fragment_id Latest message fragment ID, used by multicast. | ||
87 | * @param message_id Latest message ID, used by PSYC. | ||
88 | * @param group_generation Latest group generation, used by PSYC. | ||
89 | */ | ||
90 | typedef void | ||
91 | (*GNUNET_PSYCSTORE_CountersCallback) (void *cls, | ||
92 | uint64_t fragment_id, | ||
93 | uint64_t message_id, | ||
94 | uint64_t group_generation); | ||
95 | |||
96 | |||
97 | /** | ||
98 | * Retrieve latest values of counters for a channel. | ||
99 | * | ||
100 | * The current value of counters are needed when a channel master is restarted, | ||
101 | * so that it can continue incrementing the counters from their last value. | ||
102 | * | ||
103 | * @param h Handle for the PSYCstore. | ||
104 | * @param channel_key Public key that identifies the channel. | ||
105 | * @param cb Callback to call with the result. | ||
106 | * @param cb_cls Closure for the callback. | ||
107 | * | ||
108 | * @return | ||
109 | */ | ||
110 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
111 | GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, | ||
112 | struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
113 | GNUNET_PSYCSTORE_CountersCallback *cb, | ||
114 | void *cb_cls); | ||
115 | |||
116 | |||
117 | /** | ||
118 | * Function called with the result of an asynchronous operation. | 81 | * Function called with the result of an asynchronous operation. |
119 | * | 82 | * |
120 | * @param result #GNUNET_SYSERR on error, | 83 | * @param result #GNUNET_SYSERR on error, |
@@ -159,9 +122,12 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
159 | 122 | ||
160 | 123 | ||
161 | /** | 124 | /** |
162 | * Test if a peer was a member of the channel during the given period specified by the group generation. | 125 | * Test if a member was admitted to the channel at the given message ID. |
163 | * | 126 | * |
164 | * This is useful when relaying and replaying messages to check if a particular slave has access to the message fragment with a given group generation. It is also used when handling join requests to determine whether the slave is currently admitted to the channel. | 127 | * This is useful when relaying and replaying messages to check if a particular |
128 | * slave has access to the message fragment with a given group generation. It | ||
129 | * is also used when handling join requests to determine whether the slave is | ||
130 | * currently admitted to the channel. | ||
165 | * | 131 | * |
166 | * @param h Handle for the PSYCstore. | 132 | * @param h Handle for the PSYCstore. |
167 | * @param channel_key The channel we are interested in. | 133 | * @param channel_key The channel we are interested in. |
@@ -239,7 +205,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
239 | 205 | ||
240 | 206 | ||
241 | /** | 207 | /** |
242 | * Retrieve a message by ID. | 208 | * Retrieve all fragments of a message. |
243 | * | 209 | * |
244 | * @param h Handle for the PSYCstore. | 210 | * @param h Handle for the PSYCstore. |
245 | * @param channel_key The channel we are interested in. | 211 | * @param channel_key The channel we are interested in. |
@@ -258,6 +224,97 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
258 | 224 | ||
259 | 225 | ||
260 | /** | 226 | /** |
227 | * Retrieve a fragment of message specified by its message ID and fragment offset. | ||
228 | * | ||
229 | * @param h Handle for the PSYCstore. | ||
230 | * @param channel_key The channel we are interested in. | ||
231 | * @param message_id Message ID to check. Use 0 to get the latest message. | ||
232 | * @param fragment_offset Offset of the fragment to retrieve. | ||
233 | * @param cb Callback to call with the retrieved fragments. | ||
234 | * @param cb_cls Closure for the callback. | ||
235 | * | ||
236 | * @return Handle that can be used to cancel the operation. | ||
237 | */ | ||
238 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
239 | GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, | ||
240 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
241 | uint64_t message_id, | ||
242 | uint64_t fragment_offset, | ||
243 | GNUNET_PSYCSTORE_FragmentCallback cb, | ||
244 | void *cb_cls); | ||
245 | |||
246 | |||
247 | /** | ||
248 | * Callback used to return the latest value of counters for the channel master. | ||
249 | * | ||
250 | * @see GNUNET_PSYCSTORE_counters_get_master() | ||
251 | * | ||
252 | * @param cls Closure. | ||
253 | * @param fragment_id Latest message fragment ID, used by multicast. | ||
254 | * @param message_id Latest message ID, used by PSYC. | ||
255 | * @param group_generation Latest group generation, used by PSYC. | ||
256 | */ | ||
257 | typedef void | ||
258 | (*GNUNET_PSYCSTORE_MasterCountersCallback) (void *cls, | ||
259 | uint64_t fragment_id, | ||
260 | uint64_t message_id, | ||
261 | uint64_t group_generation); | ||
262 | |||
263 | |||
264 | /** | ||
265 | * Callback used to return the latest value of counters for a channel slave. | ||
266 | * | ||
267 | * @see GNUNET_PSYCSTORE_counters_get_slave() | ||
268 | * | ||
269 | * @param cls Closure. | ||
270 | * @param max_state_msg_id Latest message ID containing state modifiers that was applied to the state store. Used for the state sync process. | ||
271 | */ | ||
272 | typedef void | ||
273 | (*GNUNET_PSYCSTORE_SlaveCountersCallback) (void *cls, | ||
274 | uint64_t max_state_msg_id); | ||
275 | |||
276 | |||
277 | /** | ||
278 | * Retrieve latest values of counters for a channel master. | ||
279 | * | ||
280 | * The current value of counters are needed when a channel master is restarted, | ||
281 | * so that it can continue incrementing the counters from their last value. | ||
282 | * | ||
283 | * @param h Handle for the PSYCstore. | ||
284 | * @param channel_key Public key that identifies the channel. | ||
285 | * @param cb Callback to call with the result. | ||
286 | * @param cb_cls Closure for the callback. | ||
287 | * | ||
288 | * @return | ||
289 | */ | ||
290 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
291 | GNUNET_PSYCSTORE_counters_get_master (struct GNUNET_PSYCSTORE_Handle *h, | ||
292 | struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
293 | GNUNET_PSYCSTORE_MasterCountersCallback *cb, | ||
294 | void *cb_cls); | ||
295 | |||
296 | |||
297 | /** | ||
298 | * Retrieve latest values of counters for a channel slave. | ||
299 | * | ||
300 | * The current value of counters are needed when a channel slave rejoins | ||
301 | * and starts the state synchronization process. | ||
302 | * | ||
303 | * @param h Handle for the PSYCstore. | ||
304 | * @param channel_key Public key that identifies the channel. | ||
305 | * @param cb Callback to call with the result. | ||
306 | * @param cb_cls Closure for the callback. | ||
307 | * | ||
308 | * @return | ||
309 | */ | ||
310 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
311 | GNUNET_PSYCSTORE_counters_get_slave (struct GNUNET_PSYCSTORE_Handle *h, | ||
312 | struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
313 | GNUNET_PSYCSTORE_SlaveCountersCallback *cb, | ||
314 | void *cb_cls); | ||
315 | |||
316 | |||
317 | /** | ||
261 | * Apply modifiers of a message to the current channel state. | 318 | * Apply modifiers of a message to the current channel state. |
262 | * | 319 | * |
263 | * An error is returned if there are missing messages containing state | 320 | * An error is returned if there are missing messages containing state |