diff options
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r-- | src/fs/fs.h | 120 |
1 files changed, 117 insertions, 3 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h index 6e793bf8d..ed925d9c8 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -382,6 +382,12 @@ struct GNUNET_FS_Handle | |||
382 | */ | 382 | */ |
383 | struct GNUNET_CLIENT_Connection *client; | 383 | struct GNUNET_CLIENT_Connection *client; |
384 | 384 | ||
385 | /** | ||
386 | * How many downloads probing availability | ||
387 | * of search results do we have running | ||
388 | * right now? | ||
389 | */ | ||
390 | unsigned int active_probes; | ||
385 | 391 | ||
386 | }; | 392 | }; |
387 | 393 | ||
@@ -583,6 +589,72 @@ struct GNUNET_FS_UnindexContext | |||
583 | 589 | ||
584 | 590 | ||
585 | /** | 591 | /** |
592 | * Information we store for each search result. | ||
593 | */ | ||
594 | struct SearchResult | ||
595 | { | ||
596 | |||
597 | /** | ||
598 | * URI to which this search result | ||
599 | * refers to. | ||
600 | */ | ||
601 | struct GNUNET_FS_Uri *uri; | ||
602 | |||
603 | /** | ||
604 | * Metadata for the search result. | ||
605 | */ | ||
606 | struct GNUNET_CONTAINER_MetaData *meta; | ||
607 | |||
608 | /** | ||
609 | * Client info for this search result. | ||
610 | */ | ||
611 | void *client_info; | ||
612 | |||
613 | /** | ||
614 | * ID of a job that is currently probing | ||
615 | * this results' availability (NULL if we | ||
616 | * are not currently probing). | ||
617 | */ | ||
618 | struct GNUNET_FS_DownloadContext *probe_ctx; | ||
619 | |||
620 | /** | ||
621 | * ID of the task that will clean up the probe_ctx | ||
622 | * should it not complete on time (and that will | ||
623 | * need to be cancelled if we clean up the search | ||
624 | * result before then). | ||
625 | */ | ||
626 | GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task; | ||
627 | |||
628 | /** | ||
629 | * Number of mandatory keywords for which | ||
630 | * we have NOT yet found the search result; | ||
631 | * when this value hits zero, the search | ||
632 | * result is given to the callback. | ||
633 | */ | ||
634 | uint32_t mandatory_missing; | ||
635 | |||
636 | /** | ||
637 | * Number of optional keywords under which | ||
638 | * this result was also found. | ||
639 | */ | ||
640 | uint32_t optional_support; | ||
641 | |||
642 | /** | ||
643 | * Number of availability tests that | ||
644 | * have succeeded for this result. | ||
645 | */ | ||
646 | uint32_t availability_success; | ||
647 | |||
648 | /** | ||
649 | * Number of availability trials that we | ||
650 | * have performed for this search result. | ||
651 | */ | ||
652 | uint32_t availability_trials; | ||
653 | |||
654 | }; | ||
655 | |||
656 | |||
657 | /** | ||
586 | * Information we keep for each keyword in | 658 | * Information we keep for each keyword in |
587 | * a keyword search. | 659 | * a keyword search. |
588 | */ | 660 | */ |
@@ -597,7 +669,24 @@ struct SearchRequestEntry | |||
597 | /** | 669 | /** |
598 | * Hash of the public key, also known as the query. | 670 | * Hash of the public key, also known as the query. |
599 | */ | 671 | */ |
600 | GNUNET_HashCode query; | 672 | GNUNET_HashCode query; |
673 | |||
674 | /** | ||
675 | * Map that contains a "struct SearchResult" for each result that | ||
676 | * was found under this keyword. Note that the entries will point | ||
677 | * to the same locations as those in the master result map (in | ||
678 | * "struct GNUNET_FS_SearchContext"), so they should not be freed. | ||
679 | * The key for each entry is the XOR of the key and query in the CHK | ||
680 | * URI (as a unique identifier for the search result). | ||
681 | */ | ||
682 | struct GNUNET_CONTAINER_MultiHashMap *results; | ||
683 | |||
684 | /** | ||
685 | * Is this keyword a mandatory keyword | ||
686 | * (started with '+')? | ||
687 | */ | ||
688 | int mandatory; | ||
689 | |||
601 | }; | 690 | }; |
602 | 691 | ||
603 | 692 | ||
@@ -617,12 +706,34 @@ struct GNUNET_FS_SearchContext | |||
617 | struct GNUNET_FS_Uri *uri; | 706 | struct GNUNET_FS_Uri *uri; |
618 | 707 | ||
619 | /** | 708 | /** |
709 | * For update-searches, link to the | ||
710 | * base-SKS search that triggered the | ||
711 | * update search; otherwise NULL. | ||
712 | */ | ||
713 | struct GNUNET_FS_SearchContext *parent; | ||
714 | |||
715 | /** | ||
620 | * Connection to the FS service. | 716 | * Connection to the FS service. |
621 | */ | 717 | */ |
622 | struct GNUNET_CLIENT_Connection *client; | 718 | struct GNUNET_CLIENT_Connection *client; |
623 | 719 | ||
624 | /** | 720 | /** |
721 | * Pointer we keep for the client. | ||
722 | */ | ||
723 | void *client_info; | ||
724 | |||
725 | /** | ||
726 | * Map that contains a "struct SearchResult" for each result that | ||
727 | * was found in the search. The key for each entry is the XOR of | ||
728 | * the key and query in the CHK URI (as a unique identifier for the | ||
729 | * search result). | ||
730 | */ | ||
731 | struct GNUNET_CONTAINER_MultiHashMap *master_result_map; | ||
732 | |||
733 | /** | ||
625 | * Per-keyword information for a keyword search. | 734 | * Per-keyword information for a keyword search. |
735 | * This array will have exactly as many entries | ||
736 | * as there were keywords. | ||
626 | */ | 737 | */ |
627 | struct SearchRequestEntry *requests; | 738 | struct SearchRequestEntry *requests; |
628 | 739 | ||
@@ -644,9 +755,12 @@ struct GNUNET_FS_SearchContext | |||
644 | /** | 755 | /** |
645 | * Anonymity level for the search. | 756 | * Anonymity level for the search. |
646 | */ | 757 | */ |
647 | unsigned int anonymity; | 758 | uint32_t anonymity; |
648 | |||
649 | 759 | ||
760 | /** | ||
761 | * Number of mandatory keywords in this query. | ||
762 | */ | ||
763 | uint32_t mandatory_count; | ||
650 | }; | 764 | }; |
651 | 765 | ||
652 | 766 | ||