diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-27 13:40:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-27 13:40:04 +0000 |
commit | 9c50ed21bb57e53eaa0b0011b1523f1984c857f3 (patch) | |
tree | b9498d1bfcf595b74ad5e6511edba6fce42df79f /src/fs/fs.h | |
parent | 2cb9c03d745f69e5cfd0964a75aff1a33acf838f (diff) | |
download | gnunet-9c50ed21bb57e53eaa0b0011b1523f1984c857f3.tar.gz gnunet-9c50ed21bb57e53eaa0b0011b1523f1984c857f3.zip |
bounded parallelism
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r-- | src/fs/fs.h | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h index b10add77c..e11b0aa74 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -462,22 +462,6 @@ typedef void (*GNUNET_FS_QueueStart)(void *cls, | |||
462 | */ | 462 | */ |
463 | typedef void (*GNUNET_FS_QueueStop)(void *cls); | 463 | typedef void (*GNUNET_FS_QueueStop)(void *cls); |
464 | 464 | ||
465 | /** | ||
466 | * Categories of jobs in the FS queue. | ||
467 | */ | ||
468 | enum GNUNET_FS_QueueCategory | ||
469 | { | ||
470 | /** | ||
471 | * File download. | ||
472 | */ | ||
473 | GNUNET_FS_QC_DOWNLOAD, | ||
474 | |||
475 | /** | ||
476 | * Availability probe (related to search). | ||
477 | */ | ||
478 | GNUNET_FS_QC_PROBE | ||
479 | |||
480 | }; | ||
481 | 465 | ||
482 | /** | 466 | /** |
483 | * Entry in the job queue. | 467 | * Entry in the job queue. |
@@ -536,9 +520,14 @@ struct GNUNET_FS_QueueEntry | |||
536 | struct GNUNET_TIME_Relative run_time; | 520 | struct GNUNET_TIME_Relative run_time; |
537 | 521 | ||
538 | /** | 522 | /** |
539 | * What type of job is this? | 523 | * How many blocks do the active downloads have? |
524 | */ | ||
525 | unsigned int blocks; | ||
526 | |||
527 | /** | ||
528 | * How often have we (re)started this download? | ||
540 | */ | 529 | */ |
541 | enum GNUNET_FS_QueueCategory category; | 530 | unsigned int start_times; |
542 | 531 | ||
543 | }; | 532 | }; |
544 | 533 | ||
@@ -552,6 +541,7 @@ struct GNUNET_FS_QueueEntry | |||
552 | * @param start function to call to begin the job | 541 | * @param start function to call to begin the job |
553 | * @param stop function to call to pause the job, or on dequeue (if the job was running) | 542 | * @param stop function to call to pause the job, or on dequeue (if the job was running) |
554 | * @param cls closure for start and stop | 543 | * @param cls closure for start and stop |
544 | * @param blocks number of blocks this download has | ||
555 | * @return queue handle | 545 | * @return queue handle |
556 | */ | 546 | */ |
557 | struct GNUNET_FS_QueueEntry * | 547 | struct GNUNET_FS_QueueEntry * |
@@ -559,7 +549,7 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, | |||
559 | GNUNET_FS_QueueStart start, | 549 | GNUNET_FS_QueueStart start, |
560 | GNUNET_FS_QueueStop stop, | 550 | GNUNET_FS_QueueStop stop, |
561 | void *cls, | 551 | void *cls, |
562 | enum GNUNET_FS_QueueCategory cat); | 552 | unsigned int blocks); |
563 | 553 | ||
564 | 554 | ||
565 | /** | 555 | /** |
@@ -632,10 +622,10 @@ struct GNUNET_FS_Handle | |||
632 | GNUNET_SCHEDULER_TaskIdentifier queue_job; | 622 | GNUNET_SCHEDULER_TaskIdentifier queue_job; |
633 | 623 | ||
634 | /** | 624 | /** |
635 | * How many downloads probing availability of search results do we | 625 | * Average time we take for a single request to be satisfied. |
636 | * have running right now? | 626 | * FIXME: not yet calcualted properly... |
637 | */ | 627 | */ |
638 | unsigned int active_probes; | 628 | struct GNUNET_TIME_Relative avg_block_latency; |
639 | 629 | ||
640 | /** | 630 | /** |
641 | * How many actual downloads do we have running right now? | 631 | * How many actual downloads do we have running right now? |
@@ -643,10 +633,25 @@ struct GNUNET_FS_Handle | |||
643 | unsigned int active_downloads; | 633 | unsigned int active_downloads; |
644 | 634 | ||
645 | /** | 635 | /** |
636 | * How many blocks do the active downloads have? | ||
637 | */ | ||
638 | unsigned int active_blocks; | ||
639 | |||
640 | /** | ||
646 | * General flags. | 641 | * General flags. |
647 | */ | 642 | */ |
648 | enum GNUNET_FS_Flags flags; | 643 | enum GNUNET_FS_Flags flags; |
649 | 644 | ||
645 | /** | ||
646 | * Maximum number of parallel downloads. | ||
647 | */ | ||
648 | unsigned int max_parallel_downloads; | ||
649 | |||
650 | /** | ||
651 | * Maximum number of parallel requests. | ||
652 | */ | ||
653 | unsigned int max_parallel_requests; | ||
654 | |||
650 | }; | 655 | }; |
651 | 656 | ||
652 | 657 | ||
@@ -1189,6 +1194,11 @@ struct GNUNET_FS_DownloadContext | |||
1189 | struct GNUNET_CLIENT_TransmitHandle *th; | 1194 | struct GNUNET_CLIENT_TransmitHandle *th; |
1190 | 1195 | ||
1191 | /** | 1196 | /** |
1197 | * Our entry in the job queue. | ||
1198 | */ | ||
1199 | struct GNUNET_FS_QueueEntry *job_queue; | ||
1200 | |||
1201 | /** | ||
1192 | * Identity of the peer having the content, or all-zeros | 1202 | * Identity of the peer having the content, or all-zeros |
1193 | * if we don't know of such a peer. | 1203 | * if we don't know of such a peer. |
1194 | */ | 1204 | */ |