finally compiles again
[oweals/gnunet.git] / src / fs / gnunet-service-fs_drq.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010 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 2, 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_drq.h
23  * @brief queueing of requests to the datastore service
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_FS_DRQ_H
27 #define GNUNET_SERVICE_FS_DRQ_H
28
29 #include "gnunet_datastore_service.h"
30 #include "gnunet_util_lib.h"
31
32
33 /**
34  * Handle for pending, abortable requests for the datastore.
35  */
36 struct DatastoreRequestQueue;
37
38
39 /**
40  * Iterate over the results for a particular key
41  * in the datastore.  The iterator will only be called
42  * once initially; if the first call did contain a
43  * result, further results can be obtained by calling
44  * "GNUNET_DATASTORE_get_next" with the given argument.
45  *
46  * @param key maybe NULL (to match all entries)
47  * @param type desired type, 0 for any
48  * @param iter function to call on each matching value;
49  *        will be called once with a NULL value at the end
50  * @param iter_cls closure for iter
51  * @param timeout how long to wait at most for a response
52  */
53 struct DatastoreRequestQueue *
54 GNUNET_FS_drq_get (const GNUNET_HashCode * key,
55                    uint32_t type,
56                    GNUNET_DATASTORE_Iterator iter, 
57                    void *iter_cls,
58                    struct GNUNET_TIME_Relative timeout);
59
60
61
62 void
63 GNUNET_FS_drq_get_cancel (struct DatastoreRequestQueue *drq);
64
65
66 /**
67  * Function called to trigger obtaining the next result
68  * from the datastore.  Must be called (directly or indirectly)
69  * from the 'iter' callback given to 'GNUNET_FS_drq_get'.
70  * Not calling 'get_next' means no other datastore
71  * interactions (other than remove) will happen.
72  * 
73  * @param more GNUNET_YES to get more results, GNUNET_NO to abort
74  *        iteration (with a final call to "iter" with key/data == NULL).
75  */
76 void
77 GNUNET_FS_drq_get_next (int more);
78
79
80 /**
81  * Explicitly remove some content from the database.
82  * The "cont"inuation will be called with status
83  * "GNUNET_OK" if content was removed, "GNUNET_NO"
84  * if no matching entry was found and "GNUNET_SYSERR"
85  * on all other types of errors.
86  *
87  * @param key key for the value
88  * @param size number of bytes in data
89  * @param data content stored
90  * @param cont continuation to call when done
91  * @param cont_cls closure for cont
92  * @param timeout how long to wait at most for a response
93  */
94 void
95 GNUNET_FS_drq_remove (const GNUNET_HashCode *key,
96                       uint32_t size, const void *data,
97                       GNUNET_DATASTORE_ContinuationWithStatus cont,
98                       void *cont_cls,
99                       struct GNUNET_TIME_Relative timeout);
100
101
102
103 /**
104  * Explicitly remove some content from the database.
105  * The "cont"inuation will be called with status
106  * "GNUNET_OK" if content was removed, "GNUNET_NO"
107  * if no matching entry was found and "GNUNET_SYSERR"
108  * on all other types of errors.
109  *
110  * @param key key for the value
111  * @param size number of bytes in data
112  * @param data content stored
113  * @param cont continuation to call when done
114  * @param cont_cls closure for cont
115  * @param timeout how long to wait at most for a response
116  */
117 void
118 GNUNET_FS_drq_remove (const GNUNET_HashCode *key,
119                       uint32_t size, const void *data,
120                       GNUNET_DATASTORE_ContinuationWithStatus cont,
121                       void *cont_cls,
122                       struct GNUNET_TIME_Relative timeout);
123 /**
124  * Setup datastore request queues.
125  * 
126  * @param s scheduler to use
127  * @param c configuration to use
128  * @return GNUNET_OK on success
129  */
130 int 
131 GNUNET_FS_drq_init (struct GNUNET_SCHEDULER_Handle *s,
132                     const struct GNUNET_CONFIGURATION_Handle *c);
133
134
135
136 /* end of gnunet-service-fs_drq.h */
137 #endif