indexing for the file-sharing service More...
#include "gnunet_block_lib.h"
#include "gnunet_core_service.h"
#include "gnunet_datastore_service.h"
#include "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
Go to the source code of this file.
Functions | |
int | GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode *key, uint32_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, uint64_t uid, GNUNET_DATASTORE_DatumProcessor cont, void *cont_cls) |
We've received an on-demand encoded block from the datastore. More... | |
void | GNUNET_FS_indexing_send_list (struct GNUNET_MQ_Handle *mq) |
Transmit information about indexed files to mq. More... | |
int | GNUNET_FS_indexing_do_unindex (const struct GNUNET_HashCode *fid) |
Remove a file from the index. More... | |
void | GNUNET_FS_add_to_index (const char *filename, const struct GNUNET_HashCode *file_id) |
Add the given file to the list of indexed files. More... | |
int | GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_DATASTORE_Handle *d) |
Initialize the indexing submodule. More... | |
void | GNUNET_FS_indexing_done (void) |
Shutdown the module. More... | |
indexing for the file-sharing service
Definition in file gnunet-service-fs_indexing.h.
int GNUNET_FS_handle_on_demand_block | ( | const struct GNUNET_HashCode * | key, |
uint32_t | size, | ||
const void * | data, | ||
enum GNUNET_BLOCK_Type | type, | ||
uint32_t | priority, | ||
uint32_t | anonymity, | ||
uint32_t | replication, | ||
struct GNUNET_TIME_Absolute | expiration, | ||
uint64_t | uid, | ||
GNUNET_DATASTORE_DatumProcessor | cont, | ||
void * | cont_cls | ||
) |
We've received an on-demand encoded block from the datastore.
Attempt to do on-demand encoding and (if successful), call the continuation with the resulting block. On error, clean up and ask the datastore for more results.
key | key for the content |
size | number of bytes in data |
data | content stored |
type | type of the content |
priority | priority of the content |
anonymity | anonymity-level for the content |
replication | replication-level for the content |
expiration | expiration time for the content |
uid | unique identifier for the datum; maybe 0 if no unique identifier is available |
cont | function to call with the actual block (at most once, on success) |
cont_cls | closure for cont |
Definition at line 249 of file gnunet-service-fs_indexing.c.
References _, anonymity, data, DBLOCK_SIZE, dsh, expiration, OnDemandBlock::file_id, IndexInfo::filename, gettext_noop, GNUNET_BLOCK_TYPE_FS_DBLOCK, GNUNET_break, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_to_aes_key(), GNUNET_CRYPTO_symmetric_encrypt(), GNUNET_DATASTORE_remove(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_read(), GNUNET_DISK_file_seek(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE, GNUNET_DISK_SEEK_SET, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_ntohll(), GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_SYSERR, GNUNET_YES, GSF_stats, ifm, key, OnDemandBlock::offset, remove_cont(), replication, and size.
Referenced by handle_datastore_reply(), process_local_reply(), and process_migration_content().
void GNUNET_FS_indexing_send_list | ( | struct GNUNET_MQ_Handle * | mq | ) |
Transmit information about indexed files to mq.
mq | message queue to send information to |
Definition at line 357 of file gnunet-service-fs_indexing.c.
References env, IndexInfoMessage::file_id, IndexInfo::file_id, IndexInfo::filename, GNUNET_break, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), indexed_files_head, mq, IndexInfo::next, and IndexInfoMessage::reserved.
Referenced by handle_client_index_list_get().
int GNUNET_FS_indexing_do_unindex | ( | const struct GNUNET_HashCode * | fid | ) |
Remove a file from the index.
fid | identifier of the file to remove |
Definition at line 394 of file gnunet-service-fs_indexing.c.
References IndexInfo::file_id, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_YES, ifm, indexed_files_head, indexed_files_tail, IndexInfo::next, and write_index_list().
Referenced by handle_client_unindex().
void GNUNET_FS_add_to_index | ( | const char * | filename, |
const struct GNUNET_HashCode * | file_id | ||
) |
Add the given file to the list of indexed files.
filename | name of the file |
file_id | hash identifier for filename |
Definition at line 422 of file gnunet-service-fs_indexing.c.
References _, IndexInfo::file_id, filename, IndexInfo::filename, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_h2s(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, ifm, indexed_files_head, indexed_files_tail, and write_index_list().
Referenced by signal_index_ok().
int GNUNET_FS_indexing_init | ( | const struct GNUNET_CONFIGURATION_Handle * | c, |
struct GNUNET_DATASTORE_Handle * | d | ||
) |
Initialize the indexing submodule.
c | configuration to use |
d | datastore to use |
Definition at line 484 of file gnunet-service-fs_indexing.c.
References cfg, d, dsh, GNUNET_CONTAINER_multihashmap_create(), GNUNET_OK, GNUNET_YES, ifm, and read_index_list().
Referenced by run().
void GNUNET_FS_indexing_done | ( | void | ) |
Shutdown the module.
Definition at line 463 of file gnunet-service-fs_indexing.c.
References cfg, IndexInfo::fhc, IndexInfo::file_id, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CRYPTO_hash_file_cancel(), GNUNET_free, GNUNET_OK, ifm, indexed_files_head, and indexed_files_tail.
Referenced by shutdown_task().