diff options
Diffstat (limited to 'src/fs/fs_api.h')
-rw-r--r-- | src/fs/fs_api.h | 157 |
1 files changed, 90 insertions, 67 deletions
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index 4b0965f15..77e26e155 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h | |||
@@ -347,7 +347,7 @@ struct GNUNET_FS_FileInformation | |||
347 | 347 | ||
348 | /** | 348 | /** |
349 | * Has the service confirmed our INDEX_START request? | 349 | * Has the service confirmed our INDEX_START request? |
350 | * GNUNET_YES if this step has been completed. | 350 | * #GNUNET_YES if this step has been completed. |
351 | */ | 351 | */ |
352 | int index_start_confirmed; | 352 | int index_start_confirmed; |
353 | 353 | ||
@@ -376,6 +376,16 @@ struct GNUNET_FS_FileInformation | |||
376 | */ | 376 | */ |
377 | void *dir_data; | 377 | void *dir_data; |
378 | 378 | ||
379 | /** | ||
380 | * How much of the directory have we published (relative to @e contents_size). | ||
381 | */ | ||
382 | uint64_t contents_completed; | ||
383 | |||
384 | /** | ||
385 | * Sum of all of the sizes of all of the files in the directory. | ||
386 | */ | ||
387 | uint64_t contents_size; | ||
388 | |||
379 | } dir; | 389 | } dir; |
380 | 390 | ||
381 | } data; | 391 | } data; |
@@ -416,17 +426,17 @@ typedef void (*GNUNET_FS_QueueStop) (void *cls); | |||
416 | * Priorities for the queue. | 426 | * Priorities for the queue. |
417 | */ | 427 | */ |
418 | enum GNUNET_FS_QueuePriority | 428 | enum GNUNET_FS_QueuePriority |
419 | { | 429 | { |
420 | /** | 430 | /** |
421 | * This is a probe (low priority). | 431 | * This is a probe (low priority). |
422 | */ | 432 | */ |
423 | GNUNET_FS_QUEUE_PRIORITY_PROBE, | 433 | GNUNET_FS_QUEUE_PRIORITY_PROBE, |
424 | 434 | ||
425 | /** | 435 | /** |
426 | * Default priority. | 436 | * Default priority. |
427 | */ | 437 | */ |
428 | GNUNET_FS_QUEUE_PRIORITY_NORMAL | 438 | GNUNET_FS_QUEUE_PRIORITY_NORMAL |
429 | }; | 439 | }; |
430 | 440 | ||
431 | 441 | ||
432 | /** | 442 | /** |
@@ -701,6 +711,7 @@ size_t | |||
701 | GNUNET_FS_data_reader_copy_ (void *cls, uint64_t offset, size_t max, void *buf, | 711 | GNUNET_FS_data_reader_copy_ (void *cls, uint64_t offset, size_t max, void *buf, |
702 | char **emsg); | 712 | char **emsg); |
703 | 713 | ||
714 | |||
704 | /** | 715 | /** |
705 | * Notification of FS that a search probe has made progress. | 716 | * Notification of FS that a search probe has made progress. |
706 | * This function is used INSTEAD of the client's event handler | 717 | * This function is used INSTEAD of the client's event handler |
@@ -901,6 +912,7 @@ GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, const char *ext, | |||
901 | void | 912 | void |
902 | GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f); | 913 | GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f); |
903 | 914 | ||
915 | |||
904 | /** | 916 | /** |
905 | * Synchronize this publishing struct with its mirror | 917 | * Synchronize this publishing struct with its mirror |
906 | * on disk. Note that all internal FS-operations that change | 918 | * on disk. Note that all internal FS-operations that change |
@@ -912,6 +924,7 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f); | |||
912 | void | 924 | void |
913 | GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc); | 925 | GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc); |
914 | 926 | ||
927 | |||
915 | /** | 928 | /** |
916 | * Synchronize this unindex struct with its mirror | 929 | * Synchronize this unindex struct with its mirror |
917 | * on disk. Note that all internal FS-operations that change | 930 | * on disk. Note that all internal FS-operations that change |
@@ -923,6 +936,7 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc); | |||
923 | void | 936 | void |
924 | GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc); | 937 | GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc); |
925 | 938 | ||
939 | |||
926 | /** | 940 | /** |
927 | * Synchronize this search struct with its mirror | 941 | * Synchronize this search struct with its mirror |
928 | * on disk. Note that all internal FS-operations that change | 942 | * on disk. Note that all internal FS-operations that change |
@@ -934,6 +948,7 @@ GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc); | |||
934 | void | 948 | void |
935 | GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc); | 949 | GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc); |
936 | 950 | ||
951 | |||
937 | /** | 952 | /** |
938 | * Synchronize this search result with its mirror | 953 | * Synchronize this search result with its mirror |
939 | * on disk. Note that all internal FS-operations that change | 954 | * on disk. Note that all internal FS-operations that change |
@@ -945,6 +960,7 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc); | |||
945 | void | 960 | void |
946 | GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr); | 961 | GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr); |
947 | 962 | ||
963 | |||
948 | /** | 964 | /** |
949 | * Synchronize this download struct with its mirror | 965 | * Synchronize this download struct with its mirror |
950 | * on disk. Note that all internal FS-operations that change | 966 | * on disk. Note that all internal FS-operations that change |
@@ -956,6 +972,7 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr); | |||
956 | void | 972 | void |
957 | GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc); | 973 | GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc); |
958 | 974 | ||
975 | |||
959 | /** | 976 | /** |
960 | * Create SUSPEND event for the given publish operation | 977 | * Create SUSPEND event for the given publish operation |
961 | * and then clean up our state (without stop signal). | 978 | * and then clean up our state (without stop signal). |
@@ -965,6 +982,7 @@ GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc); | |||
965 | void | 982 | void |
966 | GNUNET_FS_publish_signal_suspend_ (void *cls); | 983 | GNUNET_FS_publish_signal_suspend_ (void *cls); |
967 | 984 | ||
985 | |||
968 | /** | 986 | /** |
969 | * Create SUSPEND event for the given search operation | 987 | * Create SUSPEND event for the given search operation |
970 | * and then clean up our state (without stop signal). | 988 | * and then clean up our state (without stop signal). |
@@ -974,6 +992,7 @@ GNUNET_FS_publish_signal_suspend_ (void *cls); | |||
974 | void | 992 | void |
975 | GNUNET_FS_search_signal_suspend_ (void *cls); | 993 | GNUNET_FS_search_signal_suspend_ (void *cls); |
976 | 994 | ||
995 | |||
977 | /** | 996 | /** |
978 | * Create SUSPEND event for the given download operation | 997 | * Create SUSPEND event for the given download operation |
979 | * and then clean up our state (without stop signal). | 998 | * and then clean up our state (without stop signal). |
@@ -983,6 +1002,7 @@ GNUNET_FS_search_signal_suspend_ (void *cls); | |||
983 | void | 1002 | void |
984 | GNUNET_FS_download_signal_suspend_ (void *cls); | 1003 | GNUNET_FS_download_signal_suspend_ (void *cls); |
985 | 1004 | ||
1005 | |||
986 | /** | 1006 | /** |
987 | * Create SUSPEND event for the given unindex operation | 1007 | * Create SUSPEND event for the given unindex operation |
988 | * and then clean up our state (without stop signal). | 1008 | * and then clean up our state (without stop signal). |
@@ -992,6 +1012,7 @@ GNUNET_FS_download_signal_suspend_ (void *cls); | |||
992 | void | 1012 | void |
993 | GNUNET_FS_unindex_signal_suspend_ (void *cls); | 1013 | GNUNET_FS_unindex_signal_suspend_ (void *cls); |
994 | 1014 | ||
1015 | |||
995 | /** | 1016 | /** |
996 | * Function signature of the functions that can be called | 1017 | * Function signature of the functions that can be called |
997 | * to trigger suspend signals and clean-up for top-level | 1018 | * to trigger suspend signals and clean-up for top-level |
@@ -1034,11 +1055,12 @@ struct TopLevelActivity | |||
1034 | * | 1055 | * |
1035 | * @param h global fs handle | 1056 | * @param h global fs handle |
1036 | * @param ssf suspend signal function to use | 1057 | * @param ssf suspend signal function to use |
1037 | * @param ssf_cls closure for ssf | 1058 | * @param ssf_cls closure for @a ssf |
1038 | * @return fresh top-level activity handle | 1059 | * @return fresh top-level activity handle |
1039 | */ | 1060 | */ |
1040 | struct TopLevelActivity * | 1061 | struct TopLevelActivity * |
1041 | GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf, | 1062 | GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, |
1063 | SuspendSignalFunction ssf, | ||
1042 | void *ssf_cls); | 1064 | void *ssf_cls); |
1043 | 1065 | ||
1044 | 1066 | ||
@@ -1049,7 +1071,8 @@ GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf, | |||
1049 | * @param top top level activity entry | 1071 | * @param top top level activity entry |
1050 | */ | 1072 | */ |
1051 | void | 1073 | void |
1052 | GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, struct TopLevelActivity *top); | 1074 | GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, |
1075 | struct TopLevelActivity *top); | ||
1053 | 1076 | ||
1054 | 1077 | ||
1055 | 1078 | ||
@@ -1256,13 +1279,13 @@ struct GNUNET_FS_PublishContext | |||
1256 | int rid; | 1279 | int rid; |
1257 | 1280 | ||
1258 | /** | 1281 | /** |
1259 | * Set to GNUNET_YES if all processing has completed. | 1282 | * Set to #GNUNET_YES if all processing has completed. |
1260 | */ | 1283 | */ |
1261 | int all_done; | 1284 | int all_done; |
1262 | 1285 | ||
1263 | /** | 1286 | /** |
1264 | * Flag set to GNUNET_YES if the next callback from | 1287 | * Flag set to #GNUNET_YES if the next callback from |
1265 | * GNUNET_FS_file_information_inspect should be skipped because it | 1288 | * #GNUNET_FS_file_information_inspect should be skipped because it |
1266 | * is for the directory which was already processed with the parent. | 1289 | * is for the directory which was already processed with the parent. |
1267 | */ | 1290 | */ |
1268 | int skip_next_fi_callback; | 1291 | int skip_next_fi_callback; |
@@ -1362,7 +1385,7 @@ struct GNUNET_FS_UnindexContext | |||
1362 | 1385 | ||
1363 | /** | 1386 | /** |
1364 | * Connection to the FS service, only valid during the | 1387 | * Connection to the FS service, only valid during the |
1365 | * UNINDEX_STATE_FS_NOTIFY phase. | 1388 | * #UNINDEX_STATE_FS_NOTIFY phase. |
1366 | */ | 1389 | */ |
1367 | struct GNUNET_CLIENT_Connection *client; | 1390 | struct GNUNET_CLIENT_Connection *client; |
1368 | 1391 | ||
@@ -1424,7 +1447,7 @@ struct GNUNET_FS_UnindexContext | |||
1424 | uint64_t file_size; | 1447 | uint64_t file_size; |
1425 | 1448 | ||
1426 | /** | 1449 | /** |
1427 | * Random offset given to 'GNUNET_DATASTORE_get_key'. | 1450 | * Random offset given to #GNUNET_DATASTORE_get_key. |
1428 | */ | 1451 | */ |
1429 | uint64_t roff; | 1452 | uint64_t roff; |
1430 | 1453 | ||
@@ -1561,7 +1584,7 @@ struct GNUNET_FS_SearchContext | |||
1561 | /** | 1584 | /** |
1562 | * ID of a task that is using this struct and that must be cancelled | 1585 | * ID of a task that is using this struct and that must be cancelled |
1563 | * when the search is being stopped (if not | 1586 | * when the search is being stopped (if not |
1564 | * GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some | 1587 | * #GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some |
1565 | * artificial delay when trying to reconnect to the FS service. | 1588 | * artificial delay when trying to reconnect to the FS service. |
1566 | */ | 1589 | */ |
1567 | GNUNET_SCHEDULER_TaskIdentifier task; | 1590 | GNUNET_SCHEDULER_TaskIdentifier task; |
@@ -1602,65 +1625,65 @@ struct GNUNET_FS_SearchContext | |||
1602 | */ | 1625 | */ |
1603 | enum BlockRequestState | 1626 | enum BlockRequestState |
1604 | { | 1627 | { |
1605 | /** | 1628 | /** |
1606 | * Initial state, block has only been allocated (since it is | 1629 | * Initial state, block has only been allocated (since it is |
1607 | * relevant to the overall download request). | 1630 | * relevant to the overall download request). |
1608 | */ | 1631 | */ |
1609 | BRS_INIT = 0, | 1632 | BRS_INIT = 0, |
1610 | 1633 | ||
1611 | /** | 1634 | /** |
1612 | * We've checked the block on the path down the tree, and the | 1635 | * We've checked the block on the path down the tree, and the |
1613 | * content on disk did match the desired CHK, but not all | 1636 | * content on disk did match the desired CHK, but not all |
1614 | * the way down, so at the bottom some blocks will still | 1637 | * the way down, so at the bottom some blocks will still |
1615 | * need to be reconstructed). | 1638 | * need to be reconstructed). |
1616 | */ | 1639 | */ |
1617 | BRS_RECONSTRUCT_DOWN = 1, | 1640 | BRS_RECONSTRUCT_DOWN = 1, |
1618 | 1641 | ||
1619 | /** | 1642 | /** |
1620 | * We've calculated the CHK bottom-up based on the meta data. | 1643 | * We've calculated the CHK bottom-up based on the meta data. |
1621 | * This may work, but if it did we have to write the meta data to | 1644 | * This may work, but if it did we have to write the meta data to |
1622 | * disk at the end (and we still need to check against the | 1645 | * disk at the end (and we still need to check against the |
1623 | * CHK set on top). | 1646 | * CHK set on top). |
1624 | */ | 1647 | */ |
1625 | BRS_RECONSTRUCT_META_UP = 2, | 1648 | BRS_RECONSTRUCT_META_UP = 2, |
1626 | 1649 | ||
1627 | /** | 1650 | /** |
1628 | * We've calculated the CHK bottom-up based on what we have on | 1651 | * We've calculated the CHK bottom-up based on what we have on |
1629 | * disk, which may not be what the desired CHK is. If the | 1652 | * disk, which may not be what the desired CHK is. If the |
1630 | * reconstructed CHKs match whatever comes from above, we're | 1653 | * reconstructed CHKs match whatever comes from above, we're |
1631 | * done with the respective subtree. | 1654 | * done with the respective subtree. |
1632 | */ | 1655 | */ |
1633 | BRS_RECONSTRUCT_UP = 3, | 1656 | BRS_RECONSTRUCT_UP = 3, |
1634 | 1657 | ||
1635 | /** | 1658 | /** |
1636 | * We've determined the real, desired CHK for this block | 1659 | * We've determined the real, desired CHK for this block |
1637 | * (full tree reconstruction failed), request is now pending. | 1660 | * (full tree reconstruction failed), request is now pending. |
1638 | * If the CHK that bubbled up through reconstruction did match | 1661 | * If the CHK that bubbled up through reconstruction did match |
1639 | * the top-level request, the state machine for the subtree | 1662 | * the top-level request, the state machine for the subtree |
1640 | * would have moved to BRS_DOWNLOAD_UP. | 1663 | * would have moved to BRS_DOWNLOAD_UP. |
1641 | */ | 1664 | */ |
1642 | BRS_CHK_SET = 4, | 1665 | BRS_CHK_SET = 4, |
1643 | 1666 | ||
1644 | /** | 1667 | /** |
1645 | * We've successfully downloaded this block, but the children | 1668 | * We've successfully downloaded this block, but the children |
1646 | * still need to be either downloaded or verified (download | 1669 | * still need to be either downloaded or verified (download |
1647 | * request propagates down). If the download fails, the | 1670 | * request propagates down). If the download fails, the |
1648 | * state machine for this block may move to | 1671 | * state machine for this block may move to |
1649 | * BRS_DOWNLOAD_ERROR instead. | 1672 | * BRS_DOWNLOAD_ERROR instead. |
1650 | */ | 1673 | */ |
1651 | BRS_DOWNLOAD_DOWN = 5, | 1674 | BRS_DOWNLOAD_DOWN = 5, |
1652 | 1675 | ||
1653 | /** | 1676 | /** |
1654 | * This block and all of its children have been downloaded | 1677 | * This block and all of its children have been downloaded |
1655 | * successfully (full completion propagates up). | 1678 | * successfully (full completion propagates up). |
1656 | */ | 1679 | */ |
1657 | BRS_DOWNLOAD_UP = 6, | 1680 | BRS_DOWNLOAD_UP = 6, |
1658 | 1681 | ||
1659 | /** | 1682 | /** |
1660 | * We got a block back that matched the query but did not hash to | 1683 | * We got a block back that matched the query but did not hash to |
1661 | * the key (malicious publisher or hash collision); this block | 1684 | * the key (malicious publisher or hash collision); this block |
1662 | * can never be downloaded (error propagates up). | 1685 | * can never be downloaded (error propagates up). |
1663 | */ | 1686 | */ |
1664 | BRS_ERROR = 7 | 1687 | BRS_ERROR = 7 |
1665 | }; | 1688 | }; |
1666 | 1689 | ||
@@ -1724,7 +1747,7 @@ struct DownloadRequest | |||
1724 | enum BlockRequestState state; | 1747 | enum BlockRequestState state; |
1725 | 1748 | ||
1726 | /** | 1749 | /** |
1727 | * GNUNET_YES if this entry is in the pending list. | 1750 | * #GNUNET_YES if this entry is in the pending list. |
1728 | */ | 1751 | */ |
1729 | int is_pending; | 1752 | int is_pending; |
1730 | 1753 | ||
@@ -1944,7 +1967,7 @@ struct GNUNET_FS_DownloadContext | |||
1944 | 1967 | ||
1945 | /** | 1968 | /** |
1946 | * Flag set upon transitive completion (includes child downloads). | 1969 | * Flag set upon transitive completion (includes child downloads). |
1947 | * This flag is only set to GNUNET_YES for directories where all | 1970 | * This flag is only set to #GNUNET_YES for directories where all |
1948 | * child-downloads have also completed (and signalled completion). | 1971 | * child-downloads have also completed (and signalled completion). |
1949 | */ | 1972 | */ |
1950 | int has_finished; | 1973 | int has_finished; |