aboutsummaryrefslogtreecommitdiff
path: root/src/fs
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/fs
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/fs')
-rw-r--r--src/fs/gnunet-service-fs_cadet_server.c35
-rw-r--r--src/fs/gnunet-service-fs_indexing.c3
-rw-r--r--src/fs/gnunet-service-fs_indexing.h11
-rw-r--r--src/fs/gnunet-service-fs_pr.c17
-rw-r--r--src/fs/gnunet-service-fs_push.c6
-rw-r--r--src/fs/gnunet-service-fs_put.c2
6 files changed, 51 insertions, 23 deletions
diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c
index f8619b812..02ebb2ffe 100644
--- a/src/fs/gnunet-service-fs_cadet_server.c
+++ b/src/fs/gnunet-service-fs_cadet_server.c
@@ -219,19 +219,21 @@ continue_writing (void *cls)
219 * @param type type of the content 219 * @param type type of the content
220 * @param priority priority of the content 220 * @param priority priority of the content
221 * @param anonymity anonymity-level for the content 221 * @param anonymity anonymity-level for the content
222 * @param replication replication-level for the content
222 * @param expiration expiration time for the content 223 * @param expiration expiration time for the content
223 * @param uid unique identifier for the datum; 224 * @param uid unique identifier for the datum;
224 * maybe 0 if no unique identifier is available 225 * maybe 0 if no unique identifier is available
225 */ 226 */
226static void 227static void
227handle_datastore_reply (void *cls, 228handle_datastore_reply (void *cls,
228 const struct GNUNET_HashCode *key, 229 const struct GNUNET_HashCode *key,
229 size_t size, 230 size_t size,
230 const void *data, 231 const void *data,
231 enum GNUNET_BLOCK_Type type, 232 enum GNUNET_BLOCK_Type type,
232 uint32_t priority, 233 uint32_t priority,
233 uint32_t anonymity, 234 uint32_t anonymity,
234 struct GNUNET_TIME_Absolute expiration, 235 uint32_t replication,
236 struct GNUNET_TIME_Absolute expiration,
235 uint64_t uid) 237 uint64_t uid)
236{ 238{
237 struct CadetClient *sc = cls; 239 struct CadetClient *sc = cls;
@@ -273,15 +275,16 @@ handle_datastore_reply (void *cls,
273 GNUNET_h2s (key)); 275 GNUNET_h2s (key));
274 if (GNUNET_OK != 276 if (GNUNET_OK !=
275 GNUNET_FS_handle_on_demand_block (key, 277 GNUNET_FS_handle_on_demand_block (key,
276 size, 278 size,
277 data, 279 data,
278 type, 280 type,
279 priority, 281 priority,
280 anonymity, 282 anonymity,
281 expiration, 283 replication,
282 uid, 284 expiration,
283 &handle_datastore_reply, 285 uid,
284 sc)) 286 &handle_datastore_reply,
287 sc))
285 { 288 {
286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
287 "On-demand encoding request failed\n"); 290 "On-demand encoding request failed\n");
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index ce6bcec41..b5e8af95f 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -266,6 +266,7 @@ remove_cont (void *cls, int success,
266 * @param type type of the content 266 * @param type type of the content
267 * @param priority priority of the content 267 * @param priority priority of the content
268 * @param anonymity anonymity-level for the content 268 * @param anonymity anonymity-level for the content
269 * @param replication replication-level for the content
269 * @param expiration expiration time for the content 270 * @param expiration expiration time for the content
270 * @param uid unique identifier for the datum; 271 * @param uid unique identifier for the datum;
271 * maybe 0 if no unique identifier is available 272 * maybe 0 if no unique identifier is available
@@ -280,6 +281,7 @@ GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key,
280 enum GNUNET_BLOCK_Type type, 281 enum GNUNET_BLOCK_Type type,
281 uint32_t priority, 282 uint32_t priority,
282 uint32_t anonymity, 283 uint32_t anonymity,
284 uint32_t replication,
283 struct GNUNET_TIME_Absolute expiration, 285 struct GNUNET_TIME_Absolute expiration,
284 uint64_t uid, 286 uint64_t uid,
285 GNUNET_DATASTORE_DatumProcessor cont, 287 GNUNET_DATASTORE_DatumProcessor cont,
@@ -412,6 +414,7 @@ GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key,
412 GNUNET_BLOCK_TYPE_FS_DBLOCK, 414 GNUNET_BLOCK_TYPE_FS_DBLOCK,
413 priority, 415 priority,
414 anonymity, 416 anonymity,
417 replication,
415 expiration, 418 expiration,
416 uid); 419 uid);
417 return GNUNET_OK; 420 return GNUNET_OK;
diff --git a/src/fs/gnunet-service-fs_indexing.h b/src/fs/gnunet-service-fs_indexing.h
index 8b861e3f7..331c51105 100644
--- a/src/fs/gnunet-service-fs_indexing.h
+++ b/src/fs/gnunet-service-fs_indexing.h
@@ -47,6 +47,7 @@
47 * @param type type of the content 47 * @param type type of the content
48 * @param priority priority of the content 48 * @param priority priority of the content
49 * @param anonymity anonymity-level for the content 49 * @param anonymity anonymity-level for the content
50 * @param replication replication-level for the content
50 * @param expiration expiration time for the content 51 * @param expiration expiration time for the content
51 * @param uid unique identifier for the datum; 52 * @param uid unique identifier for the datum;
52 * maybe 0 if no unique identifier is available 53 * maybe 0 if no unique identifier is available
@@ -55,9 +56,13 @@
55 * @return #GNUNET_OK on success 56 * @return #GNUNET_OK on success
56 */ 57 */
57int 58int
58GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t size, 59GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode *key,
59 const void *data, enum GNUNET_BLOCK_Type type, 60 uint32_t size,
60 uint32_t priority, uint32_t anonymity, 61 const void *data,
62 enum GNUNET_BLOCK_Type type,
63 uint32_t priority,
64 uint32_t anonymity,
65 uint32_t replication,
61 struct GNUNET_TIME_Absolute expiration, 66 struct GNUNET_TIME_Absolute expiration,
62 uint64_t uid, 67 uint64_t uid,
63 GNUNET_DATASTORE_DatumProcessor cont, 68 GNUNET_DATASTORE_DatumProcessor cont,
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index b736b49c2..7c64ab98b 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -1409,6 +1409,7 @@ process_local_reply (void *cls,
1409 enum GNUNET_BLOCK_Type type, 1409 enum GNUNET_BLOCK_Type type,
1410 uint32_t priority, 1410 uint32_t priority,
1411 uint32_t anonymity, 1411 uint32_t anonymity,
1412 uint32_t replication,
1412 struct GNUNET_TIME_Absolute expiration, 1413 struct GNUNET_TIME_Absolute expiration,
1413 uint64_t uid); 1414 uint64_t uid);
1414 1415
@@ -1470,6 +1471,7 @@ start_local_query (struct GSF_PendingRequest *pr,
1470 * @param type type of the content 1471 * @param type type of the content
1471 * @param priority priority of the content 1472 * @param priority priority of the content
1472 * @param anonymity anonymity-level for the content 1473 * @param anonymity anonymity-level for the content
1474 * @param replication replication-level for the content
1473 * @param expiration expiration time for the content 1475 * @param expiration expiration time for the content
1474 * @param uid unique identifier for the datum; 1476 * @param uid unique identifier for the datum;
1475 * maybe 0 if no unique identifier is available 1477 * maybe 0 if no unique identifier is available
@@ -1482,6 +1484,7 @@ process_local_reply (void *cls,
1482 enum GNUNET_BLOCK_Type type, 1484 enum GNUNET_BLOCK_Type type,
1483 uint32_t priority, 1485 uint32_t priority,
1484 uint32_t anonymity, 1486 uint32_t anonymity,
1487 uint32_t replication,
1485 struct GNUNET_TIME_Absolute expiration, 1488 struct GNUNET_TIME_Absolute expiration,
1486 uint64_t uid) 1489 uint64_t uid)
1487{ 1490{
@@ -1563,9 +1566,17 @@ process_local_reply (void *cls,
1563 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 1566 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
1564 &odc_warn_delay_task, pr); 1567 &odc_warn_delay_task, pr);
1565 if (GNUNET_OK == 1568 if (GNUNET_OK ==
1566 GNUNET_FS_handle_on_demand_block (key, size, data, type, priority, 1569 GNUNET_FS_handle_on_demand_block (key,
1567 anonymity, expiration, uid, 1570 size,
1568 &process_local_reply, pr)) 1571 data,
1572 type,
1573 priority,
1574 anonymity,
1575 replication,
1576 expiration,
1577 uid,
1578 &process_local_reply,
1579 pr))
1569 { 1580 {
1570 GNUNET_STATISTICS_update (GSF_stats, 1581 GNUNET_STATISTICS_update (GSF_stats,
1571 gettext_noop 1582 gettext_noop
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index 361d30755..21c598a72 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -448,6 +448,7 @@ consider_gathering ()
448 * @param type type of the content 448 * @param type type of the content
449 * @param priority priority of the content 449 * @param priority priority of the content
450 * @param anonymity anonymity-level for the content 450 * @param anonymity anonymity-level for the content
451 * @param replication replication-level for the content
451 * @param expiration expiration time for the content 452 * @param expiration expiration time for the content
452 * @param uid unique identifier for the datum; 453 * @param uid unique identifier for the datum;
453 * maybe 0 if no unique identifier is available 454 * maybe 0 if no unique identifier is available
@@ -460,6 +461,7 @@ process_migration_content (void *cls,
460 enum GNUNET_BLOCK_Type type, 461 enum GNUNET_BLOCK_Type type,
461 uint32_t priority, 462 uint32_t priority,
462 uint32_t anonymity, 463 uint32_t anonymity,
464 uint32_t replication,
463 struct GNUNET_TIME_Absolute expiration, 465 struct GNUNET_TIME_Absolute expiration,
464 uint64_t uid) 466 uint64_t uid)
465{ 467{
@@ -491,9 +493,11 @@ process_migration_content (void *cls,
491 type, 493 type,
492 priority, 494 priority,
493 anonymity, 495 anonymity,
496 replication,
494 expiration, 497 expiration,
495 uid, 498 uid,
496 &process_migration_content, NULL)) 499 &process_migration_content,
500 NULL))
497 consider_gathering (); 501 consider_gathering ();
498 return; 502 return;
499 } 503 }
diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c
index cd062bf2b..e8c7f586d 100644
--- a/src/fs/gnunet-service-fs_put.c
+++ b/src/fs/gnunet-service-fs_put.c
@@ -176,6 +176,7 @@ delay_dht_put_task (void *cls)
176 * @param type type of the content 176 * @param type type of the content
177 * @param priority priority of the content 177 * @param priority priority of the content
178 * @param anonymity anonymity-level for the content 178 * @param anonymity anonymity-level for the content
179 * @param replication replication-level for the content
179 * @param expiration expiration time for the content 180 * @param expiration expiration time for the content
180 * @param uid unique identifier for the datum; 181 * @param uid unique identifier for the datum;
181 * maybe 0 if no unique identifier is available 182 * maybe 0 if no unique identifier is available
@@ -188,6 +189,7 @@ process_dht_put_content (void *cls,
188 enum GNUNET_BLOCK_Type type, 189 enum GNUNET_BLOCK_Type type,
189 uint32_t priority, 190 uint32_t priority,
190 uint32_t anonymity, 191 uint32_t anonymity,
192 uint32_t replication,
191 struct GNUNET_TIME_Absolute expiration, 193 struct GNUNET_TIME_Absolute expiration,
192 uint64_t uid) 194 uint64_t uid)
193{ 195{