aboutsummaryrefslogtreecommitdiff
path: root/src/service/fs/gnunet-service-fs_indexing.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/fs/gnunet-service-fs_indexing.h')
-rw-r--r--src/service/fs/gnunet-service-fs_indexing.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/service/fs/gnunet-service-fs_indexing.h b/src/service/fs/gnunet-service-fs_indexing.h
new file mode 100644
index 000000000..244a51900
--- /dev/null
+++ b/src/service/fs/gnunet-service-fs_indexing.h
@@ -0,0 +1,120 @@
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 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file fs/gnunet-service-fs_indexing.h
23 * @brief indexing for the file-sharing service
24 * @author Christian Grothoff
25 */
26#ifndef GNUNET_SERVICE_FS_INDEXING_H
27#define GNUNET_SERVICE_FS_INDEXING_H
28
29#include "gnunet_block_lib.h"
30#include "gnunet_core_service.h"
31#include "gnunet_datastore_service.h"
32#include "gnunet_protocols.h"
33#include "gnunet_signatures.h"
34#include "gnunet_util_lib.h"
35
36
37/**
38 * We've received an on-demand encoded block from the datastore.
39 * Attempt to do on-demand encoding and (if successful), call the
40 * continuation with the resulting block. On error, clean up and ask
41 * the datastore for more results.
42 *
43 * @param key key for the content
44 * @param size number of bytes in data
45 * @param data content stored
46 * @param type type of the content
47 * @param priority priority of the content
48 * @param anonymity anonymity-level for the content
49 * @param replication replication-level for the content
50 * @param expiration expiration time for the content
51 * @param uid unique identifier for the datum;
52 * maybe 0 if no unique identifier is available
53 * @param cont function to call with the actual block (at most once, on success)
54 * @param cont_cls closure for @a cont
55 * @return #GNUNET_OK on success
56 */
57int
58GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode *key,
59 uint32_t size,
60 const void *data,
61 enum GNUNET_BLOCK_Type type,
62 uint32_t priority,
63 uint32_t anonymity,
64 uint32_t replication,
65 struct GNUNET_TIME_Absolute expiration,
66 uint64_t uid,
67 GNUNET_DATASTORE_DatumProcessor cont,
68 void *cont_cls);
69
70
71/**
72 * Transmit information about indexed files to @a mq.
73 *
74 * @param mq message queue to send information to
75 */
76void
77GNUNET_FS_indexing_send_list (struct GNUNET_MQ_Handle *mq);
78
79
80/**
81 * Remove a file from the index.
82 *
83 * @param fid identifier of the file to remove
84 * @return #GNUNET_YES if the @a fid was found
85 */
86int
87GNUNET_FS_indexing_do_unindex (const struct GNUNET_HashCode *fid);
88
89
90/**
91 * Add the given file to the list of indexed files.
92 *
93 * @param filename name of the file
94 * @param file_id hash identifier for @a filename
95 */
96void
97GNUNET_FS_add_to_index (const char *filename,
98 const struct GNUNET_HashCode *file_id);
99
100
101/**
102 * Initialize the indexing submodule.
103 *
104 * @param c configuration to use
105 * @param d datastore to use
106 * @return GNUNET_OK on success
107 */
108int
109GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c,
110 struct GNUNET_DATASTORE_Handle *d);
111
112
113/**
114 * Shutdown the module.
115 */
116void
117GNUNET_FS_indexing_done (void);
118
119
120#endif