aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorDavid Barksdale <amatus.amongus@gmail.com>2015-03-21 03:38:29 +0000
committerDavid Barksdale <amatus.amongus@gmail.com>2015-03-21 03:38:29 +0000
commitc77d4e5c69ac54ffddf5bd60c18bcb0504389311 (patch)
treebb40b73db6ed428d6ab44ffee91ca0ed6f16b592 /src/include
parentce6f1156a58aafed6563585b3be560ec0b4eabe7 (diff)
downloadgnunet-c77d4e5c69ac54ffddf5bd60c18bcb0504389311.tar.gz
gnunet-c77d4e5c69ac54ffddf5bd60c18bcb0504389311.zip
Convert datastore plugin API to asynchronous
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_datastore_plugin.h51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h
index e81a38566..efca0baed 100644
--- a/src/include/gnunet_datastore_plugin.h
+++ b/src/include/gnunet_datastore_plugin.h
@@ -113,6 +113,19 @@ typedef void (*PluginEstimateSize) (void *cls, unsigned long long *estimate);
113 113
114 114
115/** 115/**
116 * Put continuation.
117 *
118 * @param cls closure
119 * @param key key for the item stored
120 * @param size size of the item stored
121 * @param status GNUNET_OK or GNUNET_SYSERROR
122 * @param msg error message on error
123 */
124typedef void (*PluginPutCont) (void *cls, const struct GNUNET_HashCode *key,
125 uint32_t size, int status, char *msg);
126
127
128/**
116 * Store an item in the datastore. If the item is already present, 129 * Store an item in the datastore. If the item is already present,
117 * the priorities and replication levels are summed up and the higher 130 * the priorities and replication levels are summed up and the higher
118 * expiration time and lower anonymity level is used. 131 * expiration time and lower anonymity level is used.
@@ -126,22 +139,23 @@ typedef void (*PluginEstimateSize) (void *cls, unsigned long long *estimate);
126 * @param anonymity anonymity-level for the content 139 * @param anonymity anonymity-level for the content
127 * @param replication replication-level for the content 140 * @param replication replication-level for the content
128 * @param expiration expiration time for the content 141 * @param expiration expiration time for the content
129 * @param msg set to an error message (on failure) 142 * @param cont continuation called with success or failure status
130 * @return #GNUNET_OK on success, 143 * @param cont_cls continuation closure
131 * #GNUNET_SYSERR on failure
132 */ 144 */
133typedef int (*PluginPut) (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 145typedef void (*PluginPut) (void *cls, const struct GNUNET_HashCode * key,
134 const void *data, enum GNUNET_BLOCK_Type type, 146 uint32_t size,
135 uint32_t priority, uint32_t anonymity, 147 const void *data, enum GNUNET_BLOCK_Type type,
136 uint32_t replication, 148 uint32_t priority, uint32_t anonymity,
137 struct GNUNET_TIME_Absolute expiration, char **msg); 149 uint32_t replication,
150 struct GNUNET_TIME_Absolute expiration,
151 PluginPutCont cont, void *cont_cls);
138 152
139 153
140/** 154/**
141 * An processor over a set of keys stored in the datastore. 155 * An processor over a set of keys stored in the datastore.
142 * 156 *
143 * @param cls closure 157 * @param cls closure
144 * @param key key in the data store 158 * @param key key in the data store, if NULL iteration is finished
145 * @param count how many values are stored under this key in the datastore 159 * @param count how many values are stored under this key in the datastore
146 */ 160 */
147typedef void (*PluginKeyProcessor) (void *cls, 161typedef void (*PluginKeyProcessor) (void *cls,
@@ -174,8 +188,6 @@ typedef void (*PluginGetKeys) (void *cls,
174 * there may be! 188 * there may be!
175 * @param type entries of which type are relevant? 189 * @param type entries of which type are relevant?
176 * Use 0 for any type. 190 * Use 0 for any type.
177 * @param min find the smallest key that is larger than the given min,
178 * NULL for no minimum (return smallest key)
179 * @param proc function to call on the matching value; 191 * @param proc function to call on the matching value;
180 * proc should be called with NULL if there is no result 192 * proc should be called with NULL if there is no result
181 * @param proc_cls closure for @a proc 193 * @param proc_cls closure for @a proc
@@ -201,6 +213,14 @@ typedef void (*PluginGetRandom) (void *cls, PluginDatumProcessor proc,
201 void *proc_cls); 213 void *proc_cls);
202 214
203 215
216/**
217 * Update continuation.
218 *
219 * @param cls closure
220 * @param status GNUNET_OK or GNUNET_SYSERROR
221 * @param msg error message on error
222 */
223typedef void (*PluginUpdateCont) (void *cls, int status, char *msg);
204 224
205 225
206/** 226/**
@@ -220,11 +240,12 @@ typedef void (*PluginGetRandom) (void *cls, PluginDatumProcessor proc,
220 * @param expire new expiration time should be the 240 * @param expire new expiration time should be the
221 * MAX of any existing expiration time and 241 * MAX of any existing expiration time and
222 * this value 242 * this value
223 * @param msg set to an error message (on error) 243 * @param cont continuation called with success or failure status
224 * @return #GNUNET_OK on success 244 * @param cons_cls continuation closure
225 */ 245 */
226typedef int (*PluginUpdate) (void *cls, uint64_t uid, int delta, 246typedef void (*PluginUpdate) (void *cls, uint64_t uid, int delta,
227 struct GNUNET_TIME_Absolute expire, char **msg); 247 struct GNUNET_TIME_Absolute expire,
248 PluginUpdateCont cont, void *cont_cls);
228 249
229 250
230/** 251/**