diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-03 12:05:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-03 12:05:57 +0000 |
commit | 82d0757e1908c04f76dd69016fbb7d538318f003 (patch) | |
tree | 243464194f9e2148adc905f811d46831dea55001 /src/fs/fs_api.h | |
parent | 8b46e74546fb643a5d272bb1edd8c909a4ee978d (diff) | |
download | gnunet-82d0757e1908c04f76dd69016fbb7d538318f003.tar.gz gnunet-82d0757e1908c04f76dd69016fbb7d538318f003.zip |
convert download API to MQ
Diffstat (limited to 'src/fs/fs_api.h')
-rw-r--r-- | src/fs/fs_api.h | 81 |
1 files changed, 15 insertions, 66 deletions
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index 398de27fd..86219b3f8 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h | |||
@@ -410,27 +410,6 @@ struct GNUNET_FS_FileInformation | |||
410 | 410 | ||
411 | 411 | ||
412 | /** | 412 | /** |
413 | * The job is now ready to run and should use the given client | ||
414 | * handle to communicate with the FS service. | ||
415 | * | ||
416 | * @param cls closure | ||
417 | * @param client handle to use for FS communication | ||
418 | */ | ||
419 | typedef void | ||
420 | (*GNUNET_FS_QueueStart) (void *cls, | ||
421 | struct GNUNET_CLIENT_Connection *client); | ||
422 | |||
423 | |||
424 | /** | ||
425 | * The job must now stop to run and should destry the client handle as | ||
426 | * soon as possible (ideally prior to returning). | ||
427 | */ | ||
428 | typedef void | ||
429 | (*GNUNET_FS_QueueStop) (void *cls); | ||
430 | |||
431 | |||
432 | |||
433 | /** | ||
434 | * Priorities for the queue. | 413 | * Priorities for the queue. |
435 | */ | 414 | */ |
436 | enum GNUNET_FS_QueuePriority | 415 | enum GNUNET_FS_QueuePriority |
@@ -465,12 +444,12 @@ struct GNUNET_FS_QueueEntry | |||
465 | /** | 444 | /** |
466 | * Function to call when the job is started. | 445 | * Function to call when the job is started. |
467 | */ | 446 | */ |
468 | GNUNET_FS_QueueStart start; | 447 | GNUNET_SCHEDULER_TaskCallback start; |
469 | 448 | ||
470 | /** | 449 | /** |
471 | * Function to call when the job needs to stop (or is done / dequeued). | 450 | * Function to call when the job needs to stop (or is done / dequeued). |
472 | */ | 451 | */ |
473 | GNUNET_FS_QueueStop stop; | 452 | GNUNET_SCHEDULER_TaskCallback stop; |
474 | 453 | ||
475 | /** | 454 | /** |
476 | * Closure for start and stop. | 455 | * Closure for start and stop. |
@@ -483,9 +462,9 @@ struct GNUNET_FS_QueueEntry | |||
483 | struct GNUNET_FS_Handle *h; | 462 | struct GNUNET_FS_Handle *h; |
484 | 463 | ||
485 | /** | 464 | /** |
486 | * Client handle, or NULL if job is not running. | 465 | * Message queue handle, or NULL if job is not running. |
487 | */ | 466 | */ |
488 | struct GNUNET_CLIENT_Connection *client; | 467 | struct GNUNET_MQ_Handle *mq; |
489 | 468 | ||
490 | /** | 469 | /** |
491 | * Time the job was originally queued. | 470 | * Time the job was originally queued. |
@@ -518,6 +497,11 @@ struct GNUNET_FS_QueueEntry | |||
518 | */ | 497 | */ |
519 | unsigned int start_times; | 498 | unsigned int start_times; |
520 | 499 | ||
500 | /** | ||
501 | * #GNUNET_YES if the job is active now. | ||
502 | */ | ||
503 | int active; | ||
504 | |||
521 | }; | 505 | }; |
522 | 506 | ||
523 | 507 | ||
@@ -658,8 +642,8 @@ struct GNUNET_FS_SearchResult | |||
658 | */ | 642 | */ |
659 | struct GNUNET_FS_QueueEntry * | 643 | struct GNUNET_FS_QueueEntry * |
660 | GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, | 644 | GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, |
661 | GNUNET_FS_QueueStart start, | 645 | GNUNET_SCHEDULER_TaskCallback start, |
662 | GNUNET_FS_QueueStop stop, | 646 | GNUNET_SCHEDULER_TaskCallback stop, |
663 | void *cls, | 647 | void *cls, |
664 | unsigned int blocks, | 648 | unsigned int blocks, |
665 | enum GNUNET_FS_QueuePriority priority); | 649 | enum GNUNET_FS_QueuePriority priority); |
@@ -1221,7 +1205,7 @@ struct GNUNET_FS_PublishContext | |||
1221 | /** | 1205 | /** |
1222 | * Connection to FS service (only used for LOC URI signing). | 1206 | * Connection to FS service (only used for LOC URI signing). |
1223 | */ | 1207 | */ |
1224 | struct GNUNET_CLIENT_Handle *fs_client; | 1208 | struct GNUNET_CLIENT_Connection *fs_client; |
1225 | 1209 | ||
1226 | /** | 1210 | /** |
1227 | * Our top-level activity entry (if we are top-level, otherwise NULL). | 1211 | * Our top-level activity entry (if we are top-level, otherwise NULL). |
@@ -1255,7 +1239,7 @@ struct GNUNET_FS_PublishContext | |||
1255 | char *serialization; | 1239 | char *serialization; |
1256 | 1240 | ||
1257 | /** | 1241 | /** |
1258 | * Our own client handle for the FS service; only briefly used when | 1242 | * Our own message queue for the FS service; only briefly used when |
1259 | * we start to index a file, otherwise NULL. | 1243 | * we start to index a file, otherwise NULL. |
1260 | */ | 1244 | */ |
1261 | struct GNUNET_CLIENT_Connection *client; | 1245 | struct GNUNET_CLIENT_Connection *client; |
@@ -1740,15 +1724,6 @@ enum BlockRequestState | |||
1740 | */ | 1724 | */ |
1741 | struct DownloadRequest | 1725 | struct DownloadRequest |
1742 | { | 1726 | { |
1743 | /** | ||
1744 | * While pending, we keep all download requests in a doubly-linked list. | ||
1745 | */ | ||
1746 | struct DownloadRequest *next; | ||
1747 | |||
1748 | /** | ||
1749 | * While pending, we keep all download requests in a doubly-linked list. | ||
1750 | */ | ||
1751 | struct DownloadRequest *prev; | ||
1752 | 1727 | ||
1753 | /** | 1728 | /** |
1754 | * Parent in the CHK-tree. | 1729 | * Parent in the CHK-tree. |
@@ -1774,7 +1749,7 @@ struct DownloadRequest | |||
1774 | uint64_t offset; | 1749 | uint64_t offset; |
1775 | 1750 | ||
1776 | /** | 1751 | /** |
1777 | * Number of entries in 'children' array. | 1752 | * Number of entries in @e children array. |
1778 | */ | 1753 | */ |
1779 | unsigned int num_children; | 1754 | unsigned int num_children; |
1780 | 1755 | ||
@@ -1793,11 +1768,6 @@ struct DownloadRequest | |||
1793 | */ | 1768 | */ |
1794 | enum BlockRequestState state; | 1769 | enum BlockRequestState state; |
1795 | 1770 | ||
1796 | /** | ||
1797 | * #GNUNET_YES if this entry is in the pending list. | ||
1798 | */ | ||
1799 | int is_pending; | ||
1800 | |||
1801 | }; | 1771 | }; |
1802 | 1772 | ||
1803 | 1773 | ||
@@ -1838,7 +1808,7 @@ struct GNUNET_FS_DownloadContext | |||
1838 | /** | 1808 | /** |
1839 | * Connection to the FS service. | 1809 | * Connection to the FS service. |
1840 | */ | 1810 | */ |
1841 | struct GNUNET_CLIENT_Connection *client; | 1811 | struct GNUNET_MQ_Handle *mq; |
1842 | 1812 | ||
1843 | /** | 1813 | /** |
1844 | * Parent download (used when downloading files | 1814 | * Parent download (used when downloading files |
@@ -1917,12 +1887,6 @@ struct GNUNET_FS_DownloadContext | |||
1917 | struct GNUNET_FS_QueueEntry *job_queue; | 1887 | struct GNUNET_FS_QueueEntry *job_queue; |
1918 | 1888 | ||
1919 | /** | 1889 | /** |
1920 | * Non-NULL if we are currently having a request for | ||
1921 | * transmission pending with the client handle. | ||
1922 | */ | ||
1923 | struct GNUNET_CLIENT_TransmitHandle *th; | ||
1924 | |||
1925 | /** | ||
1926 | * Tree encoder used for the reconstruction. | 1890 | * Tree encoder used for the reconstruction. |
1927 | */ | 1891 | */ |
1928 | struct GNUNET_FS_TreeEncoder *te; | 1892 | struct GNUNET_FS_TreeEncoder *te; |
@@ -1940,16 +1904,6 @@ struct GNUNET_FS_DownloadContext | |||
1940 | struct GNUNET_CONTAINER_MultiHashMap *active; | 1904 | struct GNUNET_CONTAINER_MultiHashMap *active; |
1941 | 1905 | ||
1942 | /** | 1906 | /** |
1943 | * Head of linked list of pending requests. | ||
1944 | */ | ||
1945 | struct DownloadRequest *pending_head; | ||
1946 | |||
1947 | /** | ||
1948 | * Head of linked list of pending requests. | ||
1949 | */ | ||
1950 | struct DownloadRequest *pending_tail; | ||
1951 | |||
1952 | /** | ||
1953 | * Top-level download request. | 1907 | * Top-level download request. |
1954 | */ | 1908 | */ |
1955 | struct DownloadRequest *top_request; | 1909 | struct DownloadRequest *top_request; |
@@ -2029,11 +1983,6 @@ struct GNUNET_FS_DownloadContext | |||
2029 | int has_finished; | 1983 | int has_finished; |
2030 | 1984 | ||
2031 | /** | 1985 | /** |
2032 | * Have we started the receive continuation yet? | ||
2033 | */ | ||
2034 | int in_receive; | ||
2035 | |||
2036 | /** | ||
2037 | * Are we ready to issue requests (reconstructions are finished)? | 1986 | * Are we ready to issue requests (reconstructions are finished)? |
2038 | */ | 1987 | */ |
2039 | int issue_requests; | 1988 | int issue_requests; |