diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-28 12:10:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-28 12:10:06 +0000 |
commit | ae300a58c5bdfcadca8837a1e23abe3e34032209 (patch) | |
tree | c90e62d0c32575dce3ac763fa1f67ca858823a5e /src/fs/fs.h | |
parent | 684476aafc7c225d565295fdac4a00ee8bfc207f (diff) | |
download | gnunet-ae300a58c5bdfcadca8837a1e23abe3e34032209.tar.gz gnunet-ae300a58c5bdfcadca8837a1e23abe3e34032209.zip |
adding availability probes for search results
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r-- | src/fs/fs.h | 134 |
1 files changed, 81 insertions, 53 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h index e11b0aa74..0a656e1e9 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -84,6 +84,11 @@ | |||
84 | #define BLOOMFILTER_K 16 | 84 | #define BLOOMFILTER_K 16 |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Number of availability trials we perform per search result. | ||
88 | */ | ||
89 | #define AVAILABILITY_TRIALS_MAX 8 | ||
90 | |||
91 | /** | ||
87 | * By how much (in ms) do we decrement the TTL | 92 | * By how much (in ms) do we decrement the TTL |
88 | * at each hop? | 93 | * at each hop? |
89 | */ | 94 | */ |
@@ -560,6 +565,28 @@ void | |||
560 | GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh); | 565 | GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh); |
561 | 566 | ||
562 | 567 | ||
568 | |||
569 | /** | ||
570 | * Notification of FS that a search probe has made progress. | ||
571 | * This function is used INSTEAD of the client's event handler | ||
572 | * for downloads where the GNUNET_FS_DOWNLOAD_IS_PROBE flag is set. | ||
573 | * | ||
574 | * @param cls closure, always NULL (!), actual closure | ||
575 | * is in the client-context of the info struct | ||
576 | * @param info details about the event, specifying the event type | ||
577 | * and various bits about the event | ||
578 | * @return client-context (for the next progress call | ||
579 | * for this operation; should be set to NULL for | ||
580 | * SUSPEND and STOPPED events). The value returned | ||
581 | * will be passed to future callbacks in the respective | ||
582 | * field in the GNUNET_FS_ProgressInfo struct. | ||
583 | */ | ||
584 | void* | ||
585 | GNUNET_FS_search_probe_progress_ (void *cls, | ||
586 | const struct GNUNET_FS_ProgressInfo *info); | ||
587 | |||
588 | |||
589 | |||
563 | /** | 590 | /** |
564 | * Master context for most FS operations. | 591 | * Master context for most FS operations. |
565 | */ | 592 | */ |
@@ -799,16 +826,14 @@ struct GNUNET_FS_UnindexContext | |||
799 | char *filename; | 826 | char *filename; |
800 | 827 | ||
801 | /** | 828 | /** |
802 | * Connection to the FS service, | 829 | * Connection to the FS service, only valid during the |
803 | * only valid during the UNINDEX_STATE_FS_NOTIFY | 830 | * UNINDEX_STATE_FS_NOTIFY phase. |
804 | * phase. | ||
805 | */ | 831 | */ |
806 | struct GNUNET_CLIENT_Connection *client; | 832 | struct GNUNET_CLIENT_Connection *client; |
807 | 833 | ||
808 | /** | 834 | /** |
809 | * Connection to the datastore service, | 835 | * Connection to the datastore service, only valid during the |
810 | * only valid during the UNINDEX_STATE_DS_NOTIFY | 836 | * UNINDEX_STATE_DS_NOTIFY phase. |
811 | * phase. | ||
812 | */ | 837 | */ |
813 | struct GNUNET_DATASTORE_Handle *dsh; | 838 | struct GNUNET_DATASTORE_Handle *dsh; |
814 | 839 | ||
@@ -838,8 +863,7 @@ struct GNUNET_FS_UnindexContext | |||
838 | struct GNUNET_TIME_Absolute start_time; | 863 | struct GNUNET_TIME_Absolute start_time; |
839 | 864 | ||
840 | /** | 865 | /** |
841 | * Hash of the file's contents (once | 866 | * Hash of the file's contents (once computed). |
842 | * computed). | ||
843 | */ | 867 | */ |
844 | GNUNET_HashCode file_id; | 868 | GNUNET_HashCode file_id; |
845 | 869 | ||
@@ -858,8 +882,12 @@ struct SearchResult | |||
858 | { | 882 | { |
859 | 883 | ||
860 | /** | 884 | /** |
861 | * URI to which this search result | 885 | * Search context this result belongs to. |
862 | * refers to. | 886 | */ |
887 | struct GNUNET_FS_SearchContext *sc; | ||
888 | |||
889 | /** | ||
890 | * URI to which this search result refers to. | ||
863 | */ | 891 | */ |
864 | struct GNUNET_FS_Uri *uri; | 892 | struct GNUNET_FS_Uri *uri; |
865 | 893 | ||
@@ -874,43 +902,49 @@ struct SearchResult | |||
874 | void *client_info; | 902 | void *client_info; |
875 | 903 | ||
876 | /** | 904 | /** |
877 | * ID of a job that is currently probing | 905 | * ID of a job that is currently probing this results' availability |
878 | * this results' availability (NULL if we | 906 | * (NULL if we are not currently probing). |
879 | * are not currently probing). | ||
880 | */ | 907 | */ |
881 | struct GNUNET_FS_DownloadContext *probe_ctx; | 908 | struct GNUNET_FS_DownloadContext *probe_ctx; |
882 | 909 | ||
883 | /** | 910 | /** |
884 | * ID of the task that will clean up the probe_ctx | 911 | * ID of the task that will clean up the probe_ctx should it not |
885 | * should it not complete on time (and that will | 912 | * complete on time (and that will need to be cancelled if we clean |
886 | * need to be cancelled if we clean up the search | 913 | * up the search result before then). |
887 | * result before then). | ||
888 | */ | 914 | */ |
889 | GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task; | 915 | GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task; |
890 | 916 | ||
891 | /** | 917 | /** |
892 | * Number of mandatory keywords for which | 918 | * When did the current probe become active? |
893 | * we have NOT yet found the search result; | 919 | */ |
894 | * when this value hits zero, the search | 920 | struct GNUNET_TIME_Absolute probe_active_time; |
895 | * result is given to the callback. | 921 | |
922 | /** | ||
923 | * How much longer should we run the current probe before giving up? | ||
924 | */ | ||
925 | struct GNUNET_TIME_Relative remaining_probe_time; | ||
926 | |||
927 | /** | ||
928 | * Number of mandatory keywords for which we have NOT yet found the | ||
929 | * search result; when this value hits zero, the search result is | ||
930 | * given to the callback. | ||
896 | */ | 931 | */ |
897 | uint32_t mandatory_missing; | 932 | uint32_t mandatory_missing; |
898 | 933 | ||
899 | /** | 934 | /** |
900 | * Number of optional keywords under which | 935 | * Number of optional keywords under which this result was also |
901 | * this result was also found. | 936 | * found. |
902 | */ | 937 | */ |
903 | uint32_t optional_support; | 938 | uint32_t optional_support; |
904 | 939 | ||
905 | /** | 940 | /** |
906 | * Number of availability tests that | 941 | * Number of availability tests that have succeeded for this result. |
907 | * have succeeded for this result. | ||
908 | */ | 942 | */ |
909 | uint32_t availability_success; | 943 | uint32_t availability_success; |
910 | 944 | ||
911 | /** | 945 | /** |
912 | * Number of availability trials that we | 946 | * Number of availability trials that we have performed for this |
913 | * have performed for this search result. | 947 | * search result. |
914 | */ | 948 | */ |
915 | uint32_t availability_trials; | 949 | uint32_t availability_trials; |
916 | 950 | ||
@@ -969,36 +1003,32 @@ struct GNUNET_FS_SearchContext | |||
969 | struct GNUNET_FS_Uri *uri; | 1003 | struct GNUNET_FS_Uri *uri; |
970 | 1004 | ||
971 | /** | 1005 | /** |
972 | * For update-searches, link to the | 1006 | * For update-searches, link to the base-SKS search that triggered |
973 | * base-SKS search that triggered the | 1007 | * the update search; otherwise NULL. |
974 | * update search; otherwise NULL. | ||
975 | */ | 1008 | */ |
976 | struct GNUNET_FS_SearchContext *parent; | 1009 | struct GNUNET_FS_SearchContext *parent; |
977 | 1010 | ||
978 | /** | 1011 | /** |
979 | * For update-searches, link to the | 1012 | * For update-searches, link to the first child search that |
980 | * first child search that triggered the | 1013 | * triggered the update search; otherwise NULL. |
981 | * update search; otherwise NULL. | ||
982 | */ | 1014 | */ |
983 | struct GNUNET_FS_SearchContext *child_head; | 1015 | struct GNUNET_FS_SearchContext *child_head; |
984 | 1016 | ||
985 | /** | 1017 | /** |
986 | * For update-searches, link to the | 1018 | * For update-searches, link to the last child search that triggered |
987 | * last child search that triggered the | 1019 | * the update search; otherwise NULL. |
988 | * update search; otherwise NULL. | ||
989 | */ | 1020 | */ |
990 | struct GNUNET_FS_SearchContext *child_tail; | 1021 | struct GNUNET_FS_SearchContext *child_tail; |
991 | 1022 | ||
992 | /** | 1023 | /** |
993 | * For update-searches, link to the | 1024 | * For update-searches, link to the next child belonging to the same |
994 | * next child belonging to the same parent. | 1025 | * parent. |
995 | */ | 1026 | */ |
996 | struct GNUNET_FS_SearchContext *next; | 1027 | struct GNUNET_FS_SearchContext *next; |
997 | 1028 | ||
998 | /** | 1029 | /** |
999 | * For update-searches, link to the | 1030 | * For update-searches, link to the previous child belonging to the |
1000 | * previous child belonging to the same | 1031 | * same parent. |
1001 | * parent. | ||
1002 | */ | 1032 | */ |
1003 | struct GNUNET_FS_SearchContext *prev; | 1033 | struct GNUNET_FS_SearchContext *prev; |
1004 | 1034 | ||
@@ -1021,9 +1051,8 @@ struct GNUNET_FS_SearchContext | |||
1021 | struct GNUNET_CONTAINER_MultiHashMap *master_result_map; | 1051 | struct GNUNET_CONTAINER_MultiHashMap *master_result_map; |
1022 | 1052 | ||
1023 | /** | 1053 | /** |
1024 | * Per-keyword information for a keyword search. | 1054 | * Per-keyword information for a keyword search. This array will |
1025 | * This array will have exactly as many entries | 1055 | * have exactly as many entries as there were keywords. |
1026 | * as there were keywords. | ||
1027 | */ | 1056 | */ |
1028 | struct SearchRequestEntry *requests; | 1057 | struct SearchRequestEntry *requests; |
1029 | 1058 | ||
@@ -1033,12 +1062,10 @@ struct GNUNET_FS_SearchContext | |||
1033 | struct GNUNET_TIME_Absolute start_time; | 1062 | struct GNUNET_TIME_Absolute start_time; |
1034 | 1063 | ||
1035 | /** | 1064 | /** |
1036 | * ID of a task that is using this struct | 1065 | * ID of a task that is using this struct and that must be cancelled |
1037 | * and that must be cancelled when the search | 1066 | * when the search is being stopped (if not |
1038 | * is being stopped (if not GNUNET_SCHEDULER_NO_TASK). | 1067 | * GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some |
1039 | * Used for the task that adds some artificial | 1068 | * artificial delay when trying to reconnect to the FS service. |
1040 | * delay when trying to reconnect to the FS | ||
1041 | * service. | ||
1042 | */ | 1069 | */ |
1043 | GNUNET_SCHEDULER_TaskIdentifier task; | 1070 | GNUNET_SCHEDULER_TaskIdentifier task; |
1044 | 1071 | ||
@@ -1051,6 +1078,8 @@ struct GNUNET_FS_SearchContext | |||
1051 | * Number of mandatory keywords in this query. | 1078 | * Number of mandatory keywords in this query. |
1052 | */ | 1079 | */ |
1053 | uint32_t mandatory_count; | 1080 | uint32_t mandatory_count; |
1081 | |||
1082 | |||
1054 | }; | 1083 | }; |
1055 | 1084 | ||
1056 | 1085 | ||
@@ -1060,8 +1089,7 @@ struct GNUNET_FS_SearchContext | |||
1060 | struct DownloadRequest | 1089 | struct DownloadRequest |
1061 | { | 1090 | { |
1062 | /** | 1091 | /** |
1063 | * While pending, we keep all download requests | 1092 | * While pending, we keep all download requests in a linked list. |
1064 | * in a linked list. | ||
1065 | */ | 1093 | */ |
1066 | struct DownloadRequest *next; | 1094 | struct DownloadRequest *next; |
1067 | 1095 | ||