diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-04-03 15:10:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-04-03 15:10:41 +0000 |
commit | d2f2c8800aa6ea07a024c5511a1b1d23ad356090 (patch) | |
tree | 244c947db2921817c15d04b6a88a3f843e33d2a3 /src/include | |
parent | 745d6c5753f2e5f163220a376d58083b2d7ff76d (diff) | |
download | gnunet-d2f2c8800aa6ea07a024c5511a1b1d23ad356090.tar.gz gnunet-d2f2c8800aa6ea07a024c5511a1b1d23ad356090.zip |
new plugin API
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_datastore_plugin.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h index 8666dac10..c981ceb1d 100644 --- a/src/include/gnunet_datastore_plugin.h +++ b/src/include/gnunet_datastore_plugin.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2009, 2011 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -136,8 +136,8 @@ typedef unsigned long long (*PluginGetSize) (void *cls); | |||
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Store an item in the datastore. If the item is already present, | 138 | * Store an item in the datastore. If the item is already present, |
139 | * the priorities are summed up and the higher expiration time and | 139 | * the priorities and replication levels are summed up and the higher |
140 | * lower anonymity level is used. | 140 | * expiration time and lower anonymity level is used. |
141 | * | 141 | * |
142 | * @param cls closure | 142 | * @param cls closure |
143 | * @param key key for the item | 143 | * @param key key for the item |
@@ -146,6 +146,7 @@ typedef unsigned long long (*PluginGetSize) (void *cls); | |||
146 | * @param type type of the content | 146 | * @param type type of the content |
147 | * @param priority priority of the content | 147 | * @param priority priority of the content |
148 | * @param anonymity anonymity-level for the content | 148 | * @param anonymity anonymity-level for the content |
149 | * @param replication replication-level for the content | ||
149 | * @param expiration expiration time for the content | 150 | * @param expiration expiration time for the content |
150 | * @param msg set to an error message (on failure) | 151 | * @param msg set to an error message (on failure) |
151 | * @return GNUNET_OK on success, GNUNET_NO if the content | 152 | * @return GNUNET_OK on success, GNUNET_NO if the content |
@@ -159,6 +160,7 @@ typedef int (*PluginPut) (void *cls, | |||
159 | enum GNUNET_BLOCK_Type type, | 160 | enum GNUNET_BLOCK_Type type, |
160 | uint32_t priority, | 161 | uint32_t priority, |
161 | uint32_t anonymity, | 162 | uint32_t anonymity, |
163 | uint32_t replication, | ||
162 | struct GNUNET_TIME_Absolute expiration, | 164 | struct GNUNET_TIME_Absolute expiration, |
163 | char **msg); | 165 | char **msg); |
164 | 166 | ||
@@ -191,6 +193,22 @@ typedef void (*PluginGet) (void *cls, | |||
191 | PluginIterator iter, void *iter_cls); | 193 | PluginIterator iter, void *iter_cls); |
192 | 194 | ||
193 | 195 | ||
196 | |||
197 | /** | ||
198 | * Get a random item for replication. Returns a single, | ||
199 | * not expired, random item | ||
200 | * from those with the highest replication counters. The item's | ||
201 | * replication counter is decremented by one IF it was positive before. | ||
202 | * Call 'iter' with all values ZERO or NULL if the datastore is empty. | ||
203 | * | ||
204 | * @param cls closure | ||
205 | * @param iter function to call the value (once only). | ||
206 | * @param iter_cls closure for iter | ||
207 | */ | ||
208 | typedef void (*PluginReplicationGet) (void *cls, | ||
209 | PluginIterator iter, void *iter_cls); | ||
210 | |||
211 | |||
194 | /** | 212 | /** |
195 | * Update the priority for a particular key in the datastore. If | 213 | * Update the priority for a particular key in the datastore. If |
196 | * the expiration time in value is different than the time found in | 214 | * the expiration time in value is different than the time found in |
@@ -288,6 +306,12 @@ struct GNUNET_DATASTORE_PluginFunctions | |||
288 | PluginGet get; | 306 | PluginGet get; |
289 | 307 | ||
290 | /** | 308 | /** |
309 | * Function to get a random item with high replication score from | ||
310 | * the database, lowering the item's replication score. | ||
311 | */ | ||
312 | PluginReplicationGet replication_get; | ||
313 | |||
314 | /** | ||
291 | * Update the priority for a particular key in the datastore. If | 315 | * Update the priority for a particular key in the datastore. If |
292 | * the expiration time in value is different than the time found in | 316 | * the expiration time in value is different than the time found in |
293 | * the datastore, the higher value should be kept. For the | 317 | * the datastore, the higher value should be kept. For the |