diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-02-07 21:53:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-02-07 21:53:52 +0000 |
commit | de952b871bfe79a7f2b79d9ab04dc37933d49bf1 (patch) | |
tree | b40e7dd51794a85a8334406039b10a46bd50581f /src | |
parent | 4cdb30b30384ea6baf3da993966974001f200b37 (diff) | |
download | gnunet-de952b871bfe79a7f2b79d9ab04dc37933d49bf1.tar.gz gnunet-de952b871bfe79a7f2b79d9ab04dc37933d49bf1.zip |
stuff
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/gnunet-service-fs.h | 7 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 7 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 101 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pe.h | 41 |
4 files changed, 131 insertions, 25 deletions
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index a66339b91..ca8d4cdc5 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h | |||
@@ -44,12 +44,5 @@ struct GSF_PendingRequest; | |||
44 | struct GSF_LocalClient; | 44 | struct GSF_LocalClient; |
45 | 45 | ||
46 | 46 | ||
47 | /** | ||
48 | * Entry in the query transmission plan. | ||
49 | */ | ||
50 | struct GSF_PlanEntry; | ||
51 | |||
52 | |||
53 | |||
54 | #endif | 47 | #endif |
55 | /* end of gnunet-service-fs.h */ | 48 | /* end of gnunet-service-fs.h */ |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index a3994adf5..4c7c1b52d 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -33,6 +33,10 @@ | |||
33 | #define TRUST_FLUSH_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | 33 | #define TRUST_FLUSH_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) |
34 | 34 | ||
35 | 35 | ||
36 | |||
37 | /** | ||
38 | * Handle to cancel a transmission request. | ||
39 | */ | ||
36 | struct GSF_PeerTransmitHandle | 40 | struct GSF_PeerTransmitHandle |
37 | { | 41 | { |
38 | 42 | ||
@@ -954,5 +958,4 @@ GSF_handle_local_client_disconnect_ (const struct GSF_LocalClient *lc) | |||
954 | } | 958 | } |
955 | 959 | ||
956 | 960 | ||
957 | #endif | 961 | /* end of gnunet-service-fs_cp.c */ |
958 | /* end of gnunet-service-fs_cp.h */ | ||
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c new file mode 100644 index 000000000..ec6f315ff --- /dev/null +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2011 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file fs/gnunet-service-fs_pe.c | ||
23 | * @brief API to manage query plan | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet-service-fs_pe.h" | ||
28 | |||
29 | |||
30 | /** | ||
31 | * Create a new query plan entry. | ||
32 | * | ||
33 | * @param cp peer with the entry | ||
34 | * @param pr request with the entry | ||
35 | * @param weight determines position of the entry in the cp queue, | ||
36 | * lower weights are earlier in the queue | ||
37 | */ | ||
38 | void | ||
39 | GSF_plan_add_ (struct GSF_ConnectedPeer *cp, | ||
40 | struct GSF_PendingRequest *pr, | ||
41 | double weight) | ||
42 | { | ||
43 | // FIXME | ||
44 | } | ||
45 | |||
46 | |||
47 | /** | ||
48 | * Notify the plan about a peer being no longer available; | ||
49 | * destroy all entries associated with this peer. | ||
50 | * | ||
51 | * @param cp connected peer | ||
52 | */ | ||
53 | void | ||
54 | GSF_plan_notify_peer_disconnect_ (struct GSF_ConnectedPeer *cp) | ||
55 | { | ||
56 | // FIXME | ||
57 | } | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Notify the plan about a request being done; | ||
62 | * destroy all entries associated with this request. | ||
63 | * | ||
64 | * @param pr request that is done | ||
65 | */ | ||
66 | void | ||
67 | GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr) | ||
68 | { | ||
69 | // FIXME | ||
70 | } | ||
71 | |||
72 | |||
73 | /** | ||
74 | * Get the lowest-weight entry for the respective peer | ||
75 | * from the plan. Removes the entry from the plan's queue. | ||
76 | * | ||
77 | * @param cp connected peer to query for the next request | ||
78 | * @return NULL if the queue for this peer is empty | ||
79 | */ | ||
80 | struct GSF_PendingRequest * | ||
81 | GSF_plan_get_ (struct GSF_ConnectedPeer *cp) | ||
82 | { | ||
83 | return NULL; // FIXME | ||
84 | } | ||
85 | |||
86 | |||
87 | /** | ||
88 | * Get the size of the request queue for the given peer. | ||
89 | * | ||
90 | * @param cp connected peer to query | ||
91 | * @return number of entries in this peer's request queue | ||
92 | */ | ||
93 | unsigned int | ||
94 | GSF_plan_size_ (struct GSF_ConnectedPeer *cp) | ||
95 | { | ||
96 | return 0; // FIXME | ||
97 | } | ||
98 | |||
99 | |||
100 | |||
101 | /* end of gnunet-service-fs_pe.h */ | ||
diff --git a/src/fs/gnunet-service-fs_pe.h b/src/fs/gnunet-service-fs_pe.h index 24fbcbb7a..09baebc1a 100644 --- a/src/fs/gnunet-service-fs_pe.h +++ b/src/fs/gnunet-service-fs_pe.h | |||
@@ -34,45 +34,54 @@ | |||
34 | * | 34 | * |
35 | * @param cp peer with the entry | 35 | * @param cp peer with the entry |
36 | * @param pr request with the entry | 36 | * @param pr request with the entry |
37 | * @param position position of the entry in the cp queue | 37 | * @param weight determines position of the entry in the cp queue, |
38 | * @return handle for the new plan entry | 38 | * lower weights are earlier in the queue |
39 | */ | 39 | */ |
40 | struct GSF_PlanEntry * | 40 | void |
41 | GSF_plan_entry_create_ (struct GSF_ConnectedPeer *cp, | 41 | GSF_plan_add_ (struct GSF_ConnectedPeer *cp, |
42 | struct GSF_PendingRequest *pr, | 42 | struct GSF_PendingRequest *pr, |
43 | unsigned int position); | 43 | double weight); |
44 | 44 | ||
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Notify the plan about a new peer to use. | 47 | * Notify the plan about a peer being no longer available; |
48 | * destroy all entries associated with this peer. | ||
48 | * | 49 | * |
49 | * @param cp connected peer | 50 | * @param cp connected peer |
50 | */ | 51 | */ |
51 | void | 52 | void |
52 | GSF_plan_notify_new_peer_ (struct GSF_ConnectedPeer *cp); | 53 | GSF_plan_notify_peer_disconnect_ (struct GSF_ConnectedPeer *cp); |
53 | 54 | ||
54 | 55 | ||
55 | /** | 56 | /** |
56 | * Notify the plan about a peer being no longer available. | 57 | * Notify the plan about a request being done; |
58 | * destroy all entries associated with this request. | ||
57 | * | 59 | * |
58 | * @param cp connected peer | 60 | * @param pr request that is done |
59 | */ | 61 | */ |
60 | void | 62 | void |
61 | GSF_plan_notify_peer_disconnect_ (struct GSF_ConnectedPeer *cp); | 63 | GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr); |
62 | |||
63 | 64 | ||
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Get the first plan entry for the given connected peer. | 67 | * Get the lowest-weight entry for the respective peer |
67 | * FIXME... | 68 | * from the plan. Removes the entry from the plan's queue. |
68 | * | 69 | * |
69 | * @param cp connected peer | 70 | * @param cp connected peer to query for the next request |
70 | * @return NULL if there is no request planned for this peer | 71 | * @return NULL if the queue for this peer is empty |
71 | */ | 72 | */ |
72 | struct GSF_PendingRequest * | 73 | struct GSF_PendingRequest * |
73 | GSF_plan_get_ (struct GSF_ConnectedPeer *cp); | 74 | GSF_plan_get_ (struct GSF_ConnectedPeer *cp); |
74 | 75 | ||
75 | 76 | ||
77 | /** | ||
78 | * Get the size of the request queue for the given peer. | ||
79 | * | ||
80 | * @param cp connected peer to query | ||
81 | * @return number of entries in this peer's request queue | ||
82 | */ | ||
83 | unsigned int | ||
84 | GSF_plan_size_ (struct GSF_ConnectedPeer *cp); | ||
76 | 85 | ||
77 | #endif | 86 | #endif |
78 | /* end of gnunet-service-fs_pe.h */ | 87 | /* end of gnunet-service-fs_pe.h */ |