diff options
-rw-r--r-- | contrib/defaults.conf | 1 | ||||
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/datastore/datastore_api.c | 126 | ||||
-rw-r--r-- | src/fs/fs_namespace.c | 1 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 4 | ||||
-rw-r--r-- | src/fs/fs_unindex.c | 5 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 39 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_drq.c | 9 | ||||
-rw-r--r-- | src/include/gnunet_block_lib.h | 6 | ||||
-rw-r--r-- | src/include/gnunet_datastore_service.h | 84 |
10 files changed, 220 insertions, 61 deletions
diff --git a/contrib/defaults.conf b/contrib/defaults.conf index 8aac5049e..b4a3ddd72 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf | |||
@@ -198,5 +198,6 @@ CONFIG = $DEFAULTCONFIG | |||
198 | BINARY = gnunet-service-fs | 198 | BINARY = gnunet-service-fs |
199 | ACCEPT_FROM = 127.0.0.1; | 199 | ACCEPT_FROM = 127.0.0.1; |
200 | ACCEPT_FROM6 = ::1; | 200 | ACCEPT_FROM6 = ::1; |
201 | ACTIVEMIGRATION = YES | ||
201 | # DEBUG = YES | 202 | # DEBUG = YES |
202 | 203 | ||
diff --git a/src/Makefile.am b/src/Makefile.am index 1756ac1ec..f709a63d6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -15,7 +15,6 @@ SUBDIRS = \ | |||
15 | hello \ | 15 | hello \ |
16 | peerinfo \ | 16 | peerinfo \ |
17 | datacache \ | 17 | datacache \ |
18 | datastore \ | ||
19 | template \ | 18 | template \ |
20 | transport \ | 19 | transport \ |
21 | peerinfo-tool \ | 20 | peerinfo-tool \ |
@@ -24,6 +23,5 @@ SUBDIRS = \ | |||
24 | testing \ | 23 | testing \ |
25 | hostlist \ | 24 | hostlist \ |
26 | topology \ | 25 | topology \ |
27 | $(NAT_DIR) \ | 26 | $(NAT_DIR) |
28 | fs \ | 27 | |
29 | migration | ||
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index c8b4f2e91..72f7faed7 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -29,6 +29,75 @@ | |||
29 | #include "datastore.h" | 29 | #include "datastore.h" |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Entry in our priority queue. | ||
33 | */ | ||
34 | struct QueueEntry | ||
35 | { | ||
36 | |||
37 | /** | ||
38 | * This is a linked list. | ||
39 | */ | ||
40 | struct QueueEntry *next; | ||
41 | |||
42 | /** | ||
43 | * This is a linked list. | ||
44 | */ | ||
45 | struct QueueEntry *prev; | ||
46 | |||
47 | /** | ||
48 | * Handle to the master context. | ||
49 | */ | ||
50 | struct GNUNET_DATASTORE_Handle *h; | ||
51 | |||
52 | /** | ||
53 | * Task for timeout signalling. | ||
54 | */ | ||
55 | GNUNET_SCHEDULER_TaskIdentifier task; | ||
56 | |||
57 | /** | ||
58 | * Timeout for the current operation. | ||
59 | */ | ||
60 | struct GNUNET_TIME_Absolute timeout; | ||
61 | |||
62 | /** | ||
63 | * Priority in the queue. | ||
64 | */ | ||
65 | unsigned int priority; | ||
66 | |||
67 | /** | ||
68 | * Maximum allowed length of queue (otherwise | ||
69 | * this request should be discarded). | ||
70 | */ | ||
71 | unsigned int max_queue; | ||
72 | |||
73 | /** | ||
74 | * Number of bytes in the request message following | ||
75 | * this struct. | ||
76 | */ | ||
77 | uint16_t message_size; | ||
78 | |||
79 | /** | ||
80 | * Has this message been transmitted to the service? | ||
81 | * Only ever GNUNET_YES for the head of the queue. | ||
82 | */ | ||
83 | int16_t was_transmitted; | ||
84 | |||
85 | /** | ||
86 | * Response processor (NULL if we are not waiting for a response). | ||
87 | * This struct should be used for the closure, function-specific | ||
88 | * arguments can be passed via 'client_ctx'. | ||
89 | */ | ||
90 | GNUNET_CLIENT_MessageHandler response_proc; | ||
91 | |||
92 | /** | ||
93 | * Specific context (variable argument that | ||
94 | * can be used by the response processor). | ||
95 | */ | ||
96 | void *client_ctx; | ||
97 | |||
98 | }; | ||
99 | |||
100 | /** | ||
32 | * Handle to the datastore service. Followed | 101 | * Handle to the datastore service. Followed |
33 | * by 65536 bytes used for storing messages. | 102 | * by 65536 bytes used for storing messages. |
34 | */ | 103 | */ |
@@ -51,27 +120,19 @@ struct GNUNET_DATASTORE_Handle | |||
51 | struct GNUNET_CLIENT_Connection *client; | 120 | struct GNUNET_CLIENT_Connection *client; |
52 | 121 | ||
53 | /** | 122 | /** |
54 | * Current response processor (NULL if we are not waiting for a | 123 | * Current head of priority queue. |
55 | * response). The specific type depends on the kind of message we | ||
56 | * just transmitted. | ||
57 | */ | 124 | */ |
58 | void *response_proc; | 125 | struct QueueEntry *queue_head; |
59 | |||
60 | /** | ||
61 | * Closure for response_proc. | ||
62 | */ | ||
63 | void *response_proc_cls; | ||
64 | 126 | ||
65 | /** | 127 | /** |
66 | * Timeout for the current operation. | 128 | * Current tail of priority queue. |
67 | */ | 129 | */ |
68 | struct GNUNET_TIME_Absolute timeout; | 130 | struct QueueEntry *queue_tail; |
69 | 131 | ||
70 | /** | 132 | /** |
71 | * Number of bytes in the message following | 133 | * Number of entries in the queue. |
72 | * this struct, 0 if we have no request pending. | ||
73 | */ | 134 | */ |
74 | size_t message_size; | 135 | unsigned int queue_size; |
75 | 136 | ||
76 | }; | 137 | }; |
77 | 138 | ||
@@ -84,12 +145,13 @@ struct GNUNET_DATASTORE_Handle | |||
84 | * @param sched scheduler to use | 145 | * @param sched scheduler to use |
85 | * @return handle to use to access the service | 146 | * @return handle to use to access the service |
86 | */ | 147 | */ |
87 | struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (const struct | 148 | struct GNUNET_DATASTORE_Handle * |
88 | GNUNET_CONFIGURATION_Handle | 149 | GNUNET_DATASTORE_connect (const struct |
89 | *cfg, | 150 | GNUNET_CONFIGURATION_Handle |
90 | struct | 151 | *cfg, |
91 | GNUNET_SCHEDULER_Handle | 152 | struct |
92 | *sched) | 153 | GNUNET_SCHEDULER_Handle |
154 | *sched) | ||
93 | { | 155 | { |
94 | struct GNUNET_CLIENT_Connection *c; | 156 | struct GNUNET_CLIENT_Connection *c; |
95 | struct GNUNET_DATASTORE_Handle *h; | 157 | struct GNUNET_DATASTORE_Handle *h; |
@@ -108,10 +170,16 @@ struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (const struct | |||
108 | 170 | ||
109 | /** | 171 | /** |
110 | * Transmit DROP message to datastore service. | 172 | * Transmit DROP message to datastore service. |
173 | * | ||
174 | * @param cls the 'struct GNUNET_DATASTORE_Handle' | ||
175 | * @param size number of bytes that can be copied to buf | ||
176 | * @param buf where to copy the drop message | ||
177 | * @return number of bytes written to buf | ||
111 | */ | 178 | */ |
112 | static size_t | 179 | static size_t |
113 | transmit_drop (void *cls, | 180 | transmit_drop (void *cls, |
114 | size_t size, void *buf) | 181 | size_t size, |
182 | void *buf) | ||
115 | { | 183 | { |
116 | struct GNUNET_DATASTORE_Handle *h = cls; | 184 | struct GNUNET_DATASTORE_Handle *h = cls; |
117 | struct GNUNET_MessageHeader *hdr; | 185 | struct GNUNET_MessageHeader *hdr; |
@@ -142,9 +210,20 @@ transmit_drop (void *cls, | |||
142 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | 210 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, |
143 | int drop) | 211 | int drop) |
144 | { | 212 | { |
213 | struct QueueEntry *qe; | ||
214 | |||
145 | if (h->client != NULL) | 215 | if (h->client != NULL) |
146 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); | 216 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
147 | h->client = NULL; | 217 | h->client = NULL; |
218 | while (NULL != (qe = h->queue_head)) | ||
219 | { | ||
220 | GNUNET_CONTAINER_DLL_remove (h->queue_head, | ||
221 | h->queue_tail, | ||
222 | qe); | ||
223 | if (NULL != qe->response_proc) | ||
224 | qe->response_proc (qe, NULL); | ||
225 | GNUNET_free (qe); | ||
226 | } | ||
148 | if (GNUNET_YES == drop) | 227 | if (GNUNET_YES == drop) |
149 | { | 228 | { |
150 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 229 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
@@ -166,6 +245,7 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
166 | } | 245 | } |
167 | 246 | ||
168 | 247 | ||
248 | #if 0 | ||
169 | /** | 249 | /** |
170 | * Type of a function to call when we receive a message | 250 | * Type of a function to call when we receive a message |
171 | * from the service. This specific function is used | 251 | * from the service. This specific function is used |
@@ -764,6 +844,6 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | |||
764 | memcpy (&dm[1], data, size); | 844 | memcpy (&dm[1], data, size); |
765 | transmit_for_status (h, cont, cont_cls, timeout); | 845 | transmit_for_status (h, cont, cont_cls, timeout); |
766 | } | 846 | } |
767 | 847 | #endif | |
768 | 848 | ||
769 | /* end of datastore_api.c */ | 849 | /* end of datastore_api.c */ |
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index e853ce813..9e198adc2 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -203,6 +203,7 @@ advertisement_cont (void *cls, | |||
203 | ac->priority, | 203 | ac->priority, |
204 | ac->anonymity, | 204 | ac->anonymity, |
205 | ac->expiration, | 205 | ac->expiration, |
206 | -2, 1, | ||
206 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 207 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
207 | &advertisement_cont, | 208 | &advertisement_cont, |
208 | ac); | 209 | ac); |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index be2994176..aa7f794be 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -483,6 +483,7 @@ block_proc (void *cls, | |||
483 | p->priority, | 483 | p->priority, |
484 | p->anonymity, | 484 | p->anonymity, |
485 | p->expirationTime, | 485 | p->expirationTime, |
486 | -2, 1, | ||
486 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 487 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
487 | &ds_put_cont, | 488 | &ds_put_cont, |
488 | dpc_cls); | 489 | dpc_cls); |
@@ -504,6 +505,7 @@ block_proc (void *cls, | |||
504 | p->priority, | 505 | p->priority, |
505 | p->anonymity, | 506 | p->anonymity, |
506 | p->expirationTime, | 507 | p->expirationTime, |
508 | -2, 1, | ||
507 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 509 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
508 | &ds_put_cont, | 510 | &ds_put_cont, |
509 | dpc_cls); | 511 | dpc_cls); |
@@ -1354,6 +1356,7 @@ publish_ksk_cont (void *cls, | |||
1354 | pkc->priority, | 1356 | pkc->priority, |
1355 | pkc->anonymity, | 1357 | pkc->anonymity, |
1356 | pkc->expirationTime, | 1358 | pkc->expirationTime, |
1359 | -2, 1, | ||
1357 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 1360 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
1358 | &kb_put_cont, | 1361 | &kb_put_cont, |
1359 | pkc); | 1362 | pkc); |
@@ -1667,6 +1670,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
1667 | priority, | 1670 | priority, |
1668 | anonymity, | 1671 | anonymity, |
1669 | expirationTime, | 1672 | expirationTime, |
1673 | -2, 1, | ||
1670 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 1674 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
1671 | &sb_put_cont, | 1675 | &sb_put_cont, |
1672 | psc); | 1676 | psc); |
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 349cc4251..220ec5870 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -218,9 +218,10 @@ unindex_process (void *cls, | |||
218 | query, | 218 | query, |
219 | size, | 219 | size, |
220 | data, | 220 | data, |
221 | -2, 1, | ||
222 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | ||
221 | &process_cont, | 223 | &process_cont, |
222 | uc, | 224 | uc); |
223 | GNUNET_CONSTANTS_SERVICE_TIMEOUT); | ||
224 | } | 225 | } |
225 | 226 | ||
226 | 227 | ||
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 42dd2d23b..7e88f9d4e 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -606,6 +606,10 @@ static struct ClientList *client_list; | |||
606 | */ | 606 | */ |
607 | static struct GNUNET_CORE_Handle *core; | 607 | static struct GNUNET_CORE_Handle *core; |
608 | 608 | ||
609 | /** | ||
610 | * Are we allowed to migrate content to this peer. | ||
611 | */ | ||
612 | static int active_migration; | ||
609 | 613 | ||
610 | /* ******************* clean up functions ************************ */ | 614 | /* ******************* clean up functions ************************ */ |
611 | 615 | ||
@@ -1998,6 +2002,24 @@ process_reply (void *cls, | |||
1998 | } | 2002 | } |
1999 | 2003 | ||
2000 | 2004 | ||
2005 | |||
2006 | /** | ||
2007 | * Continuation called to notify client about result of the | ||
2008 | * operation. | ||
2009 | * | ||
2010 | * @param cls closure | ||
2011 | * @param success GNUNET_SYSERR on failure | ||
2012 | * @param msg NULL on success, otherwise an error message | ||
2013 | */ | ||
2014 | static void | ||
2015 | put_migration_continuation (void *cls, | ||
2016 | int success, | ||
2017 | const char *msg) | ||
2018 | { | ||
2019 | /* FIXME */ | ||
2020 | } | ||
2021 | |||
2022 | |||
2001 | /** | 2023 | /** |
2002 | * Handle P2P "PUT" message. | 2024 | * Handle P2P "PUT" message. |
2003 | * | 2025 | * |
@@ -2076,9 +2098,17 @@ handle_p2p_put (void *cls, | |||
2076 | &query, | 2098 | &query, |
2077 | &process_reply, | 2099 | &process_reply, |
2078 | &prq); | 2100 | &prq); |
2079 | // FIXME: if migration is on and load is low, | 2101 | if (GNUNET_YES == active_migration) |
2080 | // queue to store data in datastore; | 2102 | { |
2081 | // use "prq.priority" for that! | 2103 | GNUNET_DATASTORE_put (NULL /* FIXME */, |
2104 | 0, &query, dsize, &put[1], | ||
2105 | type, prq.priority, 1 /* anonymity */, | ||
2106 | expiration, | ||
2107 | 0, 64 /* FIXME: use define */, | ||
2108 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | ||
2109 | &put_migration_continuation, | ||
2110 | NULL); | ||
2111 | } | ||
2082 | return GNUNET_OK; | 2112 | return GNUNET_OK; |
2083 | } | 2113 | } |
2084 | 2114 | ||
@@ -2936,6 +2966,9 @@ run (void *cls, | |||
2936 | struct GNUNET_SERVER_Handle *server, | 2966 | struct GNUNET_SERVER_Handle *server, |
2937 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 2967 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
2938 | { | 2968 | { |
2969 | active_migration = GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
2970 | "FS", | ||
2971 | "ACTIVEMIGRATION"); | ||
2939 | if ( (GNUNET_OK != GNUNET_FS_drq_init (sched, cfg)) || | 2972 | if ( (GNUNET_OK != GNUNET_FS_drq_init (sched, cfg)) || |
2940 | (GNUNET_OK != GNUNET_FS_indexing_init (sched, cfg)) || | 2973 | (GNUNET_OK != GNUNET_FS_indexing_init (sched, cfg)) || |
2941 | (GNUNET_OK != main_init (sched, server, cfg)) ) | 2974 | (GNUNET_OK != main_init (sched, server, cfg)) ) |
diff --git a/src/fs/gnunet-service-fs_drq.c b/src/fs/gnunet-service-fs_drq.c index fde34187a..ab6c9ad21 100644 --- a/src/fs/gnunet-service-fs_drq.c +++ b/src/fs/gnunet-service-fs_drq.c | |||
@@ -222,9 +222,10 @@ run_next_request (void *cls, | |||
222 | GNUNET_DATASTORE_get (dsh, | 222 | GNUNET_DATASTORE_get (dsh, |
223 | &gc->key, | 223 | &gc->key, |
224 | gc->type, | 224 | gc->type, |
225 | 42 /* FIXME */, 64 /* FIXME */, | ||
226 | GNUNET_TIME_absolute_get_remaining(gc->timeout), | ||
225 | &get_iterator, | 227 | &get_iterator, |
226 | gc, | 228 | gc); |
227 | GNUNET_TIME_absolute_get_remaining(gc->timeout)); | ||
228 | } | 229 | } |
229 | 230 | ||
230 | 231 | ||
@@ -508,8 +509,10 @@ GNUNET_FS_drq_remove (const GNUNET_HashCode *key, | |||
508 | rc->cont_cls = cont_cls; | 509 | rc->cont_cls = cont_cls; |
509 | rc->rmdsh = rmdsh; | 510 | rc->rmdsh = rmdsh; |
510 | GNUNET_DATASTORE_remove (rmdsh, key, size, data, | 511 | GNUNET_DATASTORE_remove (rmdsh, key, size, data, |
512 | -3, 128, | ||
513 | timeout, | ||
511 | &drq_remove_cont, | 514 | &drq_remove_cont, |
512 | rc, timeout); | 515 | rc); |
513 | } | 516 | } |
514 | 517 | ||
515 | 518 | ||
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index 513605eb2..d76a7f63f 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h | |||
@@ -80,9 +80,6 @@ enum GNUNET_BLOCK_Type | |||
80 | }; | 80 | }; |
81 | 81 | ||
82 | 82 | ||
83 | |||
84 | |||
85 | |||
86 | /** | 83 | /** |
87 | * @brief keyword block (advertising data under a keyword) | 84 | * @brief keyword block (advertising data under a keyword) |
88 | */ | 85 | */ |
@@ -110,6 +107,7 @@ struct KBlock | |||
110 | 107 | ||
111 | }; | 108 | }; |
112 | 109 | ||
110 | |||
113 | /** | 111 | /** |
114 | * @brief namespace content block (advertising data under an identifier in a namespace) | 112 | * @brief namespace content block (advertising data under an identifier in a namespace) |
115 | */ | 113 | */ |
@@ -193,8 +191,6 @@ struct NBlock | |||
193 | }; | 191 | }; |
194 | 192 | ||
195 | 193 | ||
196 | |||
197 | |||
198 | /** | 194 | /** |
199 | * @brief index block (indexing a DBlock that | 195 | * @brief index block (indexing a DBlock that |
200 | * can be obtained directly from reading | 196 | * can be obtained directly from reading |
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index bf18860a6..6f16dad22 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -80,7 +80,9 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
80 | * operation. | 80 | * operation. |
81 | * | 81 | * |
82 | * @param cls closure | 82 | * @param cls closure |
83 | * @param success GNUNET_SYSERR on failure | 83 | * @param success GNUNET_SYSERR on failure, |
84 | * GNUNET_NO on timeout/queue drop | ||
85 | * GNUNET_YES on success | ||
84 | * @param msg NULL on success, otherwise an error message | 86 | * @param msg NULL on success, otherwise an error message |
85 | */ | 87 | */ |
86 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | 88 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, |
@@ -96,18 +98,23 @@ typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | |||
96 | * @param h handle to the datastore | 98 | * @param h handle to the datastore |
97 | * @param amount how much space (in bytes) should be reserved (for content only) | 99 | * @param amount how much space (in bytes) should be reserved (for content only) |
98 | * @param entries how many entries will be created (to calculate per-entry overhead) | 100 | * @param entries how many entries will be created (to calculate per-entry overhead) |
101 | * @param queue_priority ranking of this request in the priority queue | ||
102 | * @param max_queue_size at what queue size should this request be dropped | ||
103 | * (if other requests of higher priority are in the queue) | ||
104 | * @param timeout how long to wait at most for a response (or before dying in queue) | ||
99 | * @param cont continuation to call when done; "success" will be set to | 105 | * @param cont continuation to call when done; "success" will be set to |
100 | * a positive reservation value if space could be reserved. | 106 | * a positive reservation value if space could be reserved. |
101 | * @param cont_cls closure for cont | 107 | * @param cont_cls closure for cont |
102 | * @param timeout how long to wait at most for a response | ||
103 | */ | 108 | */ |
104 | void | 109 | void |
105 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | 110 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, |
106 | uint64_t amount, | 111 | uint64_t amount, |
107 | uint32_t entries, | 112 | uint32_t entries, |
113 | unsigned int queue_priority, | ||
114 | unsigned int max_queue_size, | ||
115 | struct GNUNET_TIME_Relative timeout, | ||
108 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 116 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
109 | void *cont_cls, | 117 | void *cont_cls); |
110 | struct GNUNET_TIME_Relative timeout); | ||
111 | 118 | ||
112 | 119 | ||
113 | /** | 120 | /** |
@@ -125,6 +132,9 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
125 | * @param priority priority of the content | 132 | * @param priority priority of the content |
126 | * @param anonymity anonymity-level for the content | 133 | * @param anonymity anonymity-level for the content |
127 | * @param expiration expiration time for the content | 134 | * @param expiration expiration time for the content |
135 | * @param queue_priority ranking of this request in the priority queue | ||
136 | * @param max_queue_size at what queue size should this request be dropped | ||
137 | * (if other requests of higher priority are in the queue) | ||
128 | * @param timeout timeout for the operation | 138 | * @param timeout timeout for the operation |
129 | * @param cont continuation to call when done | 139 | * @param cont continuation to call when done |
130 | * @param cont_cls closure for cont | 140 | * @param cont_cls closure for cont |
@@ -139,6 +149,8 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
139 | uint32_t priority, | 149 | uint32_t priority, |
140 | uint32_t anonymity, | 150 | uint32_t anonymity, |
141 | struct GNUNET_TIME_Absolute expiration, | 151 | struct GNUNET_TIME_Absolute expiration, |
152 | unsigned int queue_priority, | ||
153 | unsigned int max_queue_size, | ||
142 | struct GNUNET_TIME_Relative timeout, | 154 | struct GNUNET_TIME_Relative timeout, |
143 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 155 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
144 | void *cont_cls); | 156 | void *cont_cls); |
@@ -152,16 +164,24 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
152 | * @param h handle to the datastore | 164 | * @param h handle to the datastore |
153 | * @param rid reservation ID (value of "success" in original continuation | 165 | * @param rid reservation ID (value of "success" in original continuation |
154 | * from the "reserve" function). | 166 | * from the "reserve" function). |
167 | * @param queue_priority ranking of this request in the priority queue | ||
168 | * @param max_queue_size at what queue size should this request be dropped | ||
169 | * (if other requests of higher priority are in the queue) | ||
170 | * @param queue_priority ranking of this request in the priority queue | ||
171 | * @param max_queue_size at what queue size should this request be dropped | ||
172 | * (if other requests of higher priority are in the queue) | ||
173 | * @param timeout how long to wait at most for a response | ||
155 | * @param cont continuation to call when done | 174 | * @param cont continuation to call when done |
156 | * @param cont_cls closure for cont | 175 | * @param cont_cls closure for cont |
157 | * @param timeout how long to wait at most for a response | ||
158 | */ | 176 | */ |
159 | void | 177 | void |
160 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | 178 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, |
161 | int rid, | 179 | int rid, |
180 | unsigned int queue_priority, | ||
181 | unsigned int max_queue_size, | ||
182 | struct GNUNET_TIME_Relative timeout, | ||
162 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 183 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
163 | void *cont_cls, | 184 | void *cont_cls); |
164 | struct GNUNET_TIME_Relative timeout); | ||
165 | 185 | ||
166 | 186 | ||
167 | /** | 187 | /** |
@@ -171,18 +191,23 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
171 | * @param uid identifier for the value | 191 | * @param uid identifier for the value |
172 | * @param priority how much to increase the priority of the value | 192 | * @param priority how much to increase the priority of the value |
173 | * @param expiration new expiration value should be MAX of existing and this argument | 193 | * @param expiration new expiration value should be MAX of existing and this argument |
194 | * @param queue_priority ranking of this request in the priority queue | ||
195 | * @param max_queue_size at what queue size should this request be dropped | ||
196 | * (if other requests of higher priority are in the queue) | ||
197 | * @param timeout how long to wait at most for a response | ||
174 | * @param cont continuation to call when done | 198 | * @param cont continuation to call when done |
175 | * @param cont_cls closure for cont | 199 | * @param cont_cls closure for cont |
176 | * @param timeout how long to wait at most for a response | ||
177 | */ | 200 | */ |
178 | void | 201 | void |
179 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | 202 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, |
180 | unsigned long long uid, | 203 | unsigned long long uid, |
181 | uint32_t priority, | 204 | uint32_t priority, |
182 | struct GNUNET_TIME_Absolute expiration, | 205 | struct GNUNET_TIME_Absolute expiration, |
206 | unsigned int queue_priority, | ||
207 | unsigned int max_queue_size, | ||
208 | struct GNUNET_TIME_Relative timeout, | ||
183 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 209 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
184 | void *cont_cls, | 210 | void *cont_cls); |
185 | struct GNUNET_TIME_Relative timeout); | ||
186 | 211 | ||
187 | 212 | ||
188 | /** | 213 | /** |
@@ -220,18 +245,23 @@ typedef void (*GNUNET_DATASTORE_Iterator) (void *cls, | |||
220 | * @param h handle to the datastore | 245 | * @param h handle to the datastore |
221 | * @param key maybe NULL (to match all entries) | 246 | * @param key maybe NULL (to match all entries) |
222 | * @param type desired type, 0 for any | 247 | * @param type desired type, 0 for any |
248 | * @param queue_priority ranking of this request in the priority queue | ||
249 | * @param max_queue_size at what queue size should this request be dropped | ||
250 | * (if other requests of higher priority are in the queue) | ||
251 | * @param timeout how long to wait at most for a response | ||
223 | * @param iter function to call on each matching value; | 252 | * @param iter function to call on each matching value; |
224 | * will be called once with a NULL value at the end | 253 | * will be called once with a NULL value at the end |
225 | * @param iter_cls closure for iter | 254 | * @param iter_cls closure for iter |
226 | * @param timeout how long to wait at most for a response | ||
227 | */ | 255 | */ |
228 | void | 256 | void |
229 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, | 257 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, |
230 | const GNUNET_HashCode * key, | 258 | const GNUNET_HashCode * key, |
231 | enum GNUNET_BLOCK_Type type, | 259 | enum GNUNET_BLOCK_Type type, |
260 | unsigned int queue_priority, | ||
261 | unsigned int max_queue_size, | ||
262 | struct GNUNET_TIME_Relative timeout, | ||
232 | GNUNET_DATASTORE_Iterator iter, | 263 | GNUNET_DATASTORE_Iterator iter, |
233 | void *iter_cls, | 264 | void *iter_cls); |
234 | struct GNUNET_TIME_Relative timeout); | ||
235 | 265 | ||
236 | 266 | ||
237 | /** | 267 | /** |
@@ -251,16 +281,22 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h, | |||
251 | * Get a random value from the datastore. | 281 | * Get a random value from the datastore. |
252 | * | 282 | * |
253 | * @param h handle to the datastore | 283 | * @param h handle to the datastore |
284 | * @param queue_priority ranking of this request in the priority queue | ||
285 | * @param max_queue_size at what queue size should this request be dropped | ||
286 | * (if other requests of higher priority are in the queue) | ||
287 | * @param timeout how long to wait at most for a response | ||
254 | * @param iter function to call on a random value; it | 288 | * @param iter function to call on a random value; it |
255 | * will be called once with a value (if available) | 289 | * will be called once with a value (if available) |
256 | * and always once with a value of NULL. | 290 | * and always once with a value of NULL. |
257 | * @param iter_cls closure for iter | 291 | * @param iter_cls closure for iter |
258 | * @param timeout how long to wait at most for a response | ||
259 | */ | 292 | */ |
260 | void | 293 | void |
261 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | 294 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, |
262 | GNUNET_DATASTORE_Iterator iter, void *iter_cls, | 295 | unsigned int queue_priority, |
263 | struct GNUNET_TIME_Relative timeout); | 296 | unsigned int max_queue_size, |
297 | struct GNUNET_TIME_Relative timeout, | ||
298 | GNUNET_DATASTORE_Iterator iter, | ||
299 | void *iter_cls); | ||
264 | 300 | ||
265 | 301 | ||
266 | /** | 302 | /** |
@@ -274,17 +310,23 @@ GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | |||
274 | * @param key key for the value | 310 | * @param key key for the value |
275 | * @param size number of bytes in data | 311 | * @param size number of bytes in data |
276 | * @param data content stored | 312 | * @param data content stored |
313 | * @param queue_priority ranking of this request in the priority queue | ||
314 | * @param max_queue_size at what queue size should this request be dropped | ||
315 | * (if other requests of higher priority are in the queue) | ||
316 | * @param timeout how long to wait at most for a response | ||
277 | * @param cont continuation to call when done | 317 | * @param cont continuation to call when done |
278 | * @param cont_cls closure for cont | 318 | * @param cont_cls closure for cont |
279 | * @param timeout how long to wait at most for a response | ||
280 | */ | 319 | */ |
281 | void | 320 | void |
282 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | 321 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, |
283 | const GNUNET_HashCode *key, | 322 | const GNUNET_HashCode *key, |
284 | uint32_t size, const void *data, | 323 | uint32_t size, |
324 | const void *data, | ||
325 | unsigned int queue_priority, | ||
326 | unsigned int max_queue_size, | ||
327 | struct GNUNET_TIME_Relative timeout, | ||
285 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 328 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
286 | void *cont_cls, | 329 | void *cont_cls); |
287 | struct GNUNET_TIME_Relative timeout); | ||
288 | 330 | ||
289 | 331 | ||
290 | #if 0 /* keep Emacsens' auto-indent happy */ | 332 | #if 0 /* keep Emacsens' auto-indent happy */ |