diff options
author | Gabor X Toth <*@tg-x.net> | 2013-09-03 22:33:21 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-09-03 22:33:21 +0000 |
commit | eb9556bf2983ca19a5cbcf7cf460a0b2509b290a (patch) | |
tree | 285d31e951f7ecf9308b22257adcadd5b07d80ea /src/include/gnunet_psycstore_plugin.h | |
parent | 37bafa60a6f0e447cb5b61547404f0902fa7ad41 (diff) | |
download | gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.tar.gz gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.zip |
PSYCstore SQLite backend; API fixes/enhancements
Diffstat (limited to 'src/include/gnunet_psycstore_plugin.h')
-rw-r--r-- | src/include/gnunet_psycstore_plugin.h | 120 |
1 files changed, 86 insertions, 34 deletions
diff --git a/src/include/gnunet_psycstore_plugin.h b/src/include/gnunet_psycstore_plugin.h index e567de278..69d4bf7fc 100644 --- a/src/include/gnunet_psycstore_plugin.h +++ b/src/include/gnunet_psycstore_plugin.h | |||
@@ -40,7 +40,7 @@ extern "C" | |||
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @brief struct returned by the initialization function of the plugin | 43 | * Struct returned by the initialization function of the plugin. |
44 | */ | 44 | */ |
45 | struct GNUNET_PSYCSTORE_PluginFunctions | 45 | struct GNUNET_PSYCSTORE_PluginFunctions |
46 | { | 46 | { |
@@ -59,9 +59,9 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
59 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 59 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
60 | */ | 60 | */ |
61 | int | 61 | int |
62 | (*membership_store) (void *cls, | 62 | (*membership_store) (void *cls, |
63 | const struct GNUNET_HashCode *channel_key, | 63 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
64 | const struct GNUNET_HashCode *slave_key, | 64 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
65 | int did_join, | 65 | int did_join, |
66 | uint64_t announced_at, | 66 | uint64_t announced_at, |
67 | uint64_t effective_since, | 67 | uint64_t effective_since, |
@@ -71,7 +71,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
71 | * Test if a member was admitted to the channel at the given message ID. | 71 | * Test if a member was admitted to the channel at the given message ID. |
72 | * | 72 | * |
73 | * @see GNUNET_PSYCSTORE_membership_test() | 73 | * @see GNUNET_PSYCSTORE_membership_test() |
74 | * | 74 | * |
75 | * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not, | 75 | * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not, |
76 | * #GNUNET_SYSERR if there was en error. | 76 | * #GNUNET_SYSERR if there was en error. |
77 | */ | 77 | */ |
@@ -79,41 +79,42 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
79 | (*membership_test) (void *cls, | 79 | (*membership_test) (void *cls, |
80 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 80 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
81 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, | 81 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
82 | uint64_t message_id, | 82 | uint64_t message_id); |
83 | uint64_t group_generation); | ||
84 | 83 | ||
85 | /** | 84 | /** |
86 | * Store a message fragment sent to a channel. | 85 | * Store a message fragment sent to a channel. |
87 | * | 86 | * |
88 | * @see GNUNET_PSYCSTORE_fragment_store() | 87 | * @see GNUNET_PSYCSTORE_fragment_store() |
89 | * | 88 | * |
90 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 89 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
91 | */ | 90 | */ |
92 | int | 91 | int |
93 | (*fragment_store) (void *cls, | 92 | (*fragment_store) (void *cls, |
94 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 93 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
95 | const struct GNUNET_MULTICAST_MessageHeader *message); | 94 | const struct GNUNET_MULTICAST_MessageHeader *message, |
95 | uint32_t psycstore_flags); | ||
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Set additional flags for a given message. | 98 | * Set additional flags for a given message. |
99 | * | 99 | * |
100 | * They are OR'd with any existing flags set. | ||
101 | * | ||
100 | * @param message_id ID of the message. | 102 | * @param message_id ID of the message. |
101 | * @param flags Flags to add. | 103 | * @param psycstore_flags OR'd GNUNET_PSYCSTORE_MessageFlags. |
102 | * | 104 | * |
103 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 105 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
104 | */ | 106 | */ |
105 | int | 107 | int |
106 | (*fragment_add_flags) (void *cls, | 108 | (*message_add_flags) (void *cls, |
107 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 109 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
108 | uint64_t message_id, | 110 | uint64_t message_id, |
109 | uint64_t multicast_flags, | 111 | uint64_t psycstore_flags); |
110 | uint64_t psyc_flags); | ||
111 | 112 | ||
112 | /** | 113 | /** |
113 | * Retrieve a message fragment by fragment ID. | 114 | * Retrieve a message fragment by fragment ID. |
114 | * | 115 | * |
115 | * @see GNUNET_PSYCSTORE_fragment_get() | 116 | * @see GNUNET_PSYCSTORE_fragment_get() |
116 | * | 117 | * |
117 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 118 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
118 | */ | 119 | */ |
119 | int | 120 | int |
@@ -127,7 +128,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
127 | * Retrieve all fragments of a message. | 128 | * Retrieve all fragments of a message. |
128 | * | 129 | * |
129 | * @see GNUNET_PSYCSTORE_message_get() | 130 | * @see GNUNET_PSYCSTORE_message_get() |
130 | * | 131 | * |
131 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 132 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
132 | */ | 133 | */ |
133 | int | 134 | int |
@@ -142,7 +143,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
142 | * offset. | 143 | * offset. |
143 | * | 144 | * |
144 | * @see GNUNET_PSYCSTORE_message_get_fragment() | 145 | * @see GNUNET_PSYCSTORE_message_get_fragment() |
145 | * | 146 | * |
146 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 147 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
147 | */ | 148 | */ |
148 | int | 149 | int |
@@ -157,7 +158,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
157 | * Retrieve latest values of counters for a channel master. | 158 | * Retrieve latest values of counters for a channel master. |
158 | * | 159 | * |
159 | * @see GNUNET_PSYCSTORE_counters_get_master() | 160 | * @see GNUNET_PSYCSTORE_counters_get_master() |
160 | * | 161 | * |
161 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 162 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
162 | */ | 163 | */ |
163 | int | 164 | int |
@@ -168,10 +169,10 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
168 | uint64_t *group_generation); | 169 | uint64_t *group_generation); |
169 | 170 | ||
170 | /** | 171 | /** |
171 | * Retrieve latest values of counters for a channel slave. | 172 | * Retrieve latest values of counters for a channel slave. |
172 | * | 173 | * |
173 | * @see GNUNET_PSYCSTORE_counters_get_slave() | 174 | * @see GNUNET_PSYCSTORE_counters_get_slave() |
174 | * | 175 | * |
175 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 176 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
176 | */ | 177 | */ |
177 | int | 178 | int |
@@ -183,27 +184,66 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
183 | * Set a state variable to the given value. | 184 | * Set a state variable to the given value. |
184 | * | 185 | * |
185 | * @see GNUNET_PSYCSTORE_state_modify() | 186 | * @see GNUNET_PSYCSTORE_state_modify() |
186 | * | 187 | * |
187 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 188 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
188 | */ | 189 | */ |
189 | int | 190 | int |
190 | (*state_set) (struct GNUNET_PSYCSTORE_Handle *h, | 191 | (*state_set) (void *cls, |
191 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 192 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
192 | const char *name, | 193 | const char *name, |
193 | size_t value_size, | 194 | const void *value, |
194 | const void *value); | 195 | size_t value_size); |
196 | |||
197 | |||
198 | /** | ||
199 | * Reset the state of a channel. | ||
200 | * | ||
201 | * Delete all state variables stored for the given channel. | ||
202 | * | ||
203 | * @see GNUNET_PSYCSTORE_state_reset() | ||
204 | * | ||
205 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
206 | */ | ||
207 | int | ||
208 | (*state_reset) (void *cls, | ||
209 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key); | ||
210 | |||
211 | /** | ||
212 | * Update signed state values from the current ones. | ||
213 | * | ||
214 | * Sets value_signed = value_current for each variable for the given channel. | ||
215 | */ | ||
216 | int | ||
217 | (*state_update_signed) (void *cls, | ||
218 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key); | ||
219 | |||
220 | /** | ||
221 | * Update signed values of state variables in the state store. | ||
222 | * | ||
223 | * @param h Handle for the PSYCstore. | ||
224 | * @param channel_key The channel we are interested in. | ||
225 | * @param message_id Message ID that contained the state @a hash. | ||
226 | * @param hash Hash of the serialized full state. | ||
227 | * @param rcb Callback to call with the result of the operation. | ||
228 | * @param rcb_cls Closure for the callback. | ||
229 | * | ||
230 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
231 | */ | ||
232 | int | ||
233 | (*state_hash_update) (void *cls, | ||
234 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
235 | uint64_t message_id, | ||
236 | const struct GNUNET_HashCode *hash, | ||
237 | GNUNET_PSYCSTORE_ResultCallback rcb, | ||
238 | void *rcb_cls); | ||
195 | 239 | ||
196 | /** | 240 | /** |
197 | * Retrieve a state variable by name. | 241 | * Retrieve a state variable by name (exact match). |
198 | * | 242 | * |
199 | * @param name Name of the variable to retrieve. | ||
200 | * @param[out] value_size Size of value. | ||
201 | * @param[out] value Returned value. | ||
202 | * | ||
203 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 243 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
204 | */ | 244 | */ |
205 | int | 245 | int |
206 | (*state_get) (struct GNUNET_PSYCSTORE_Handle *h, | 246 | (*state_get) (void *cls, |
207 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 247 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
208 | const char *name, | 248 | const char *name, |
209 | GNUNET_PSYCSTORE_StateCallback cb, | 249 | GNUNET_PSYCSTORE_StateCallback cb, |
@@ -213,16 +253,28 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
213 | * Retrieve all state variables for a channel with the given prefix. | 253 | * Retrieve all state variables for a channel with the given prefix. |
214 | * | 254 | * |
215 | * @see GNUNET_PSYCSTORE_state_get_all() | 255 | * @see GNUNET_PSYCSTORE_state_get_all() |
216 | * | 256 | * |
217 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 257 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
218 | */ | 258 | */ |
219 | int | 259 | int |
220 | (*state_get_all) (struct GNUNET_PSYCSTORE_Handle *h, | 260 | (*state_get_all) (void *cls, |
221 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 261 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
222 | const char *name, | 262 | const char *name, |
223 | GNUNET_PSYCSTORE_StateCallback cb, | 263 | GNUNET_PSYCSTORE_StateCallback cb, |
224 | void *cb_cls); | 264 | void *cb_cls); |
225 | 265 | ||
266 | |||
267 | /** | ||
268 | * Retrieve all signed state variables for a channel. | ||
269 | * | ||
270 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
271 | */ | ||
272 | int | ||
273 | (*state_get_signed) (void *cls, | ||
274 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
275 | GNUNET_PSYCSTORE_StateCallback cb, | ||
276 | void *cb_cls); | ||
277 | |||
226 | }; | 278 | }; |
227 | 279 | ||
228 | 280 | ||