aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amat.us>2017-03-22 22:17:05 -0500
committerDavid Barksdale <amatus@amat.us>2017-03-22 22:19:13 -0500
commit78ecfccd774a77ae3d7a51e3f5c7c7c86cf7985b (patch)
tree1dc23a2f6d78c8026e69181ac90055929d79bba8 /src/include
parentaa98f144e6db0da5a0a4cad83fe64a80bbab6692 (diff)
downloadgnunet-78ecfccd774a77ae3d7a51e3f5c7c7c86cf7985b.tar.gz
gnunet-78ecfccd774a77ae3d7a51e3f5c7c7c86cf7985b.zip
[datastore] Return and update replication
This fixes a couple FIXMEs in the datastore code. The replication value is now returned from the datastore and the update function can increase the replication.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_datastore_plugin.h44
-rw-r--r--src/include/gnunet_datastore_service.h2
2 files changed, 26 insertions, 20 deletions
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h
index b1c9cb7c3..516ba525c 100644
--- a/src/include/gnunet_datastore_plugin.h
+++ b/src/include/gnunet_datastore_plugin.h
@@ -93,6 +93,7 @@ struct GNUNET_DATASTORE_PluginEnvironment
93 * @param type type of the content 93 * @param type type of the content
94 * @param priority priority of the content 94 * @param priority priority of the content
95 * @param anonymity anonymity-level for the content 95 * @param anonymity anonymity-level for the content
96 * @param replication replication-level for the content
96 * @param expiration expiration time for the content 97 * @param expiration expiration time for the content
97 * @param uid unique identifier for the datum 98 * @param uid unique identifier for the datum
98 * @return #GNUNET_OK to keep the item 99 * @return #GNUNET_OK to keep the item
@@ -100,14 +101,15 @@ struct GNUNET_DATASTORE_PluginEnvironment
100 */ 101 */
101typedef int 102typedef int
102(*PluginDatumProcessor) (void *cls, 103(*PluginDatumProcessor) (void *cls,
103 const struct GNUNET_HashCode *key, 104 const struct GNUNET_HashCode *key,
104 uint32_t size, 105 uint32_t size,
105 const void *data, 106 const void *data,
106 enum GNUNET_BLOCK_Type type, 107 enum GNUNET_BLOCK_Type type,
107 uint32_t priority, 108 uint32_t priority,
108 uint32_t anonymity, 109 uint32_t anonymity,
109 struct GNUNET_TIME_Absolute expiration, 110 uint32_t replication,
110 uint64_t uid); 111 struct GNUNET_TIME_Absolute expiration,
112 uint64_t uid);
111 113
112 114
113/** 115/**
@@ -259,16 +261,17 @@ typedef void
259 261
260 262
261/** 263/**
262 * Update the priority for a particular key in the datastore. If 264 * Update the priority, replication and expiration for a particular
263 * the expiration time in value is different than the time found in 265 * unique ID in the datastore. If the expiration time in value is
264 * the datastore, the higher value should be kept. For the 266 * different than the time found in the datastore, the higher value
265 * anonymity level, the lower value is to be used. The specified 267 * should be kept. The specified priority and replication is added
266 * priority should be added to the existing priority, ignoring the 268 * to the existing value.
267 * priority in value.
268 * 269 *
269 * @param cls closure 270 * @param cls closure
270 * @param uid unique identifier of the datum 271 * @param uid unique identifier of the datum
271 * @param delta by how much should the priority 272 * @param priority by how much should the priority
273 * change?
274 * @param replication by how much should the replication
272 * change? 275 * change?
273 * @param expire new expiration time should be the 276 * @param expire new expiration time should be the
274 * MAX of any existing expiration time and 277 * MAX of any existing expiration time and
@@ -278,11 +281,12 @@ typedef void
278 */ 281 */
279typedef void 282typedef void
280(*PluginUpdate) (void *cls, 283(*PluginUpdate) (void *cls,
281 uint64_t uid, 284 uint64_t uid,
282 uint32_t delta, 285 uint32_t priority,
283 struct GNUNET_TIME_Absolute expire, 286 uint32_t replication,
284 PluginUpdateCont cont, 287 struct GNUNET_TIME_Absolute expire,
285 void *cont_cls); 288 PluginUpdateCont cont,
289 void *cont_cls);
286 290
287 291
288/** 292/**
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h
index 830e7da86..f851385c5 100644
--- a/src/include/gnunet_datastore_service.h
+++ b/src/include/gnunet_datastore_service.h
@@ -240,6 +240,7 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
240 * @param type type of the content 240 * @param type type of the content
241 * @param priority priority of the content 241 * @param priority priority of the content
242 * @param anonymity anonymity-level for the content 242 * @param anonymity anonymity-level for the content
243 * @param replication how often should the content be replicated to other peers?
243 * @param expiration expiration time for the content 244 * @param expiration expiration time for the content
244 * @param uid unique identifier for the datum; 245 * @param uid unique identifier for the datum;
245 * maybe 0 if no unique identifier is available 246 * maybe 0 if no unique identifier is available
@@ -252,6 +253,7 @@ typedef void
252 enum GNUNET_BLOCK_Type type, 253 enum GNUNET_BLOCK_Type type,
253 uint32_t priority, 254 uint32_t priority,
254 uint32_t anonymity, 255 uint32_t anonymity,
256 uint32_t replication,
255 struct GNUNET_TIME_Absolute expiration, 257 struct GNUNET_TIME_Absolute expiration,
256 uint64_t uid); 258 uint64_t uid);
257 259