glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / fs / gnunet-service-fs_indexing.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010, 2011 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your 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      Affero General Public License for more details.
14 */
15
16 /**
17  * @file fs/gnunet-service-fs_indexing.h
18  * @brief indexing for the file-sharing service
19  * @author Christian Grothoff
20  */
21 #ifndef GNUNET_SERVICE_FS_INDEXING_H
22 #define GNUNET_SERVICE_FS_INDEXING_H
23
24 #include "gnunet_block_lib.h"
25 #include "gnunet_core_service.h"
26 #include "gnunet_datastore_service.h"
27 #include "gnunet_peer_lib.h"
28 #include "gnunet_protocols.h"
29 #include "gnunet_signatures.h"
30 #include "gnunet_util_lib.h"
31
32
33 /**
34  * We've received an on-demand encoded block from the datastore.
35  * Attempt to do on-demand encoding and (if successful), call the
36  * continuation with the resulting block.  On error, clean up and ask
37  * the datastore for more results.
38  *
39  * @param key key for the content
40  * @param size number of bytes in data
41  * @param data content stored
42  * @param type type of the content
43  * @param priority priority of the content
44  * @param anonymity anonymity-level for the content
45  * @param replication replication-level for the content
46  * @param expiration expiration time for the content
47  * @param uid unique identifier for the datum;
48  *        maybe 0 if no unique identifier is available
49  * @param cont function to call with the actual block (at most once, on success)
50  * @param cont_cls closure for @a cont
51  * @return #GNUNET_OK on success
52  */
53 int
54 GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode *key,
55                                   uint32_t size,
56                                   const void *data,
57                                   enum GNUNET_BLOCK_Type type,
58                                   uint32_t priority,
59                                   uint32_t anonymity,
60                                   uint32_t replication,
61                                   struct GNUNET_TIME_Absolute expiration,
62                                   uint64_t uid,
63                                   GNUNET_DATASTORE_DatumProcessor cont,
64                                   void *cont_cls);
65
66
67 /**
68  * Transmit information about indexed files to @a mq.
69  *
70  * @param mq message queue to send information to
71  */
72 void
73 GNUNET_FS_indexing_send_list (struct GNUNET_MQ_Handle *mq);
74
75
76 /**
77  * Remove a file from the index.
78  *
79  * @param fid identifier of the file to remove
80  * @return #GNUNET_YES if the @a fid was found
81  */
82 int
83 GNUNET_FS_indexing_do_unindex (const struct GNUNET_HashCode *fid);
84
85
86 /**
87  * Add the given file to the list of indexed files.
88  *
89  * @param filename name of the file
90  * @param file_id hash identifier for @a filename
91  */
92 void
93 GNUNET_FS_add_to_index (const char *filename,
94                         const struct GNUNET_HashCode *file_id);
95
96
97 /**
98  * Initialize the indexing submodule.
99  *
100  * @param c configuration to use
101  * @param d datastore to use
102  * @return GNUNET_OK on success
103  */
104 int
105 GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c,
106                          struct GNUNET_DATASTORE_Handle *d);
107
108
109 /**
110  * Shutdown the module.
111  */
112 void
113 GNUNET_FS_indexing_done (void);
114
115
116 #endif