publishing to namespaces, and tracking updateable entries for our namespaces More...
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_publish_ublock.h"
Go to the source code of this file.
Data Structures | |
struct | NamespaceUpdateNode |
Information about an (updateable) node in the namespace. More... | |
struct | GNUNET_FS_UpdateInformationGraph |
Handle to update information for a namespace. More... | |
struct | GNUNET_FS_PublishSksContext |
Context for the SKS publication. More... | |
struct | ProcessUpdateClosure |
Closure for 'process_update_node'. More... | |
struct | FindTreeClosure |
Closure for 'find_trees'. More... | |
Functions | |
static char * | get_update_information_directory (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) |
Return the name of the directory in which we store the update information graph for the given local namespace. More... | |
static void | free_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig) |
Release memory occupied by UIG datastructure. More... | |
static void | write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig) |
Write a namespace's update node graph to a file. More... | |
static struct GNUNET_FS_UpdateInformationGraph * | read_update_information_graph (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) |
Read the namespace update node graph from a file. More... | |
static void | sks_publish_cont (void *cls, const char *msg) |
Function called by the UBlock construction with the result from the PUT (UBlock) request. More... | |
struct GNUNET_FS_PublishSksContext * | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *identifier, const char *update, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls) |
Publish an SBlock on GNUnet. More... | |
void | GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc) |
Abort the SKS publishing operation. More... | |
static int | process_update_node (void *cls, const struct GNUNET_HashCode *key, void *value) |
Call the iterator in the closure for each node. More... | |
static int | find_trees (void *cls, const struct GNUNET_HashCode *key, void *value) |
Find all nodes reachable from the current node (including the current node itself). More... | |
void | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *next_id, GNUNET_FS_IdentifierProcessor ip, void *ip_cls) |
List all of the identifiers in the namespace for which we could produce an update. More... | |
publishing to namespaces, and tracking updateable entries for our namespaces
Definition in file fs_namespace.c.
|
static |
Return the name of the directory in which we store the update information graph for the given local namespace.
h | file-sharing handle |
ns | namespace handle |
Definition at line 128 of file fs_namespace.c.
References GNUNET_ARM_Handle::cfg, DIR_SEPARATOR_STR, enc, GNUNET_asprintf(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_to_enc(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_config_missing(), GNUNET_OK, h, ns, pub, and ret.
Referenced by read_update_information_graph(), and write_update_information_graph().
|
static |
Release memory occupied by UIG datastructure.
uig | data structure to free |
Definition at line 163 of file fs_namespace.c.
References GNUNET_array_grow, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_uri_destroy(), NamespaceUpdateNode::id, NamespaceUpdateNode::md, NamespaceUpdateNode::update, GNUNET_FS_UpdateInformationGraph::update_map, GNUNET_FS_UpdateInformationGraph::update_node_count, GNUNET_FS_UpdateInformationGraph::update_nodes, and NamespaceUpdateNode::uri.
Referenced by GNUNET_FS_namespace_list_updateable(), and sks_publish_cont().
|
static |
Write a namespace's update node graph to a file.
uig | update information graph to dump |
Definition at line 190 of file fs_namespace.c.
References _, END, get_update_information_directory(), GNUNET_BIO_write_close(), GNUNET_BIO_write_int32(), GNUNET_BIO_write_open_file(), GNUNET_BIO_write_spec_commit(), GNUNET_BIO_write_spec_end, GNUNET_BIO_write_spec_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_FS_uri_to_string(), GNUNET_FS_write_spec_meta_data(), GNUNET_log, GNUNET_OK, GNUNET_FS_UpdateInformationGraph::h, NamespaceUpdateNode::id, NamespaceUpdateNode::md, GNUNET_FS_UpdateInformationGraph::ns, NamespaceUpdateNode::update, GNUNET_FS_UpdateInformationGraph::update_node_count, GNUNET_FS_UpdateInformationGraph::update_nodes, NamespaceUpdateNode::uri, and GNUNET_BIO_WriteSpec::wh.
Referenced by sks_publish_cont().
|
static |
Read the namespace update node graph from a file.
h | FS handle to use |
ns | namespace to read |
Definition at line 251 of file fs_namespace.c.
References _, END, get_update_information_directory(), GNUNET_BIO_read_close(), GNUNET_BIO_read_int32(), GNUNET_BIO_read_open_file(), GNUNET_BIO_read_spec_commit(), GNUNET_BIO_read_spec_end, GNUNET_BIO_read_spec_string(), GNUNET_break, GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_read_spec_meta_data(), GNUNET_FS_uri_parse(), GNUNET_log, GNUNET_malloc, GNUNET_new, GNUNET_OK, GNUNET_YES, h, GNUNET_FS_UpdateInformationGraph::h, NamespaceUpdateNode::id, NamespaceUpdateNode::md, ns, GNUNET_FS_UpdateInformationGraph::ns, GNUNET_BIO_ReadSpec::rh, NamespaceUpdateNode::update, GNUNET_FS_UpdateInformationGraph::update_node_count, GNUNET_FS_UpdateInformationGraph::update_nodes, and NamespaceUpdateNode::uri.
Referenced by GNUNET_FS_namespace_list_updateable(), and sks_publish_cont().
|
static |
Function called by the UBlock construction with the result from the PUT (UBlock) request.
cls | closure of type "struct GNUNET_FS_PublishSksContext*" |
msg | error message (or NULL) |
Definition at line 401 of file fs_namespace.c.
References GNUNET_FS_PublishSksContext::cont, GNUNET_FS_PublishSksContext::cont_cls, free_update_information_graph(), GNUNET_array_append, GNUNET_FS_publish_sks_cancel(), GNUNET_FS_PublishSksContext::h, msg, GNUNET_FS_PublishSksContext::ns, GNUNET_FS_PublishSksContext::nsn, read_update_information_graph(), GNUNET_FS_PublishSksContext::uc, GNUNET_FS_UpdateInformationGraph::update_node_count, GNUNET_FS_UpdateInformationGraph::update_nodes, GNUNET_FS_PublishSksContext::uri, and write_update_information_graph().
Referenced by GNUNET_FS_publish_sks().
|
static |
Call the iterator in the closure for each node.
cls | closure (of type 'struct ProcessUpdateClosure *') |
key | current key code |
value | value in the hash map (of type 'struct NamespaceUpdateNode *') |
Definition at line 548 of file fs_namespace.c.
References GNUNET_YES, NamespaceUpdateNode::id, NamespaceUpdateNode::md, pc, NamespaceUpdateNode::update, NamespaceUpdateNode::uri, and value.
Referenced by GNUNET_FS_namespace_list_updateable().
|
static |
Find all nodes reachable from the current node (including the current node itself).
If they are in no tree, add them to the current one. If they are the head of another tree, merge the trees. If they are in the middle of another tree, let them be. We can tell that a node is already in an tree by checking if its 'nug' field is set to the current 'nug' value. It is the head of an tree if it is in the 'tree_array' under its respective 'tree_id'.
In short, we're trying to find the smallest number of tree to cover a directed graph.
cls | closure (of type 'struct FindTreeClosure') |
key | current key code |
value | value in the hash map |
Definition at line 611 of file fs_namespace.c.
References find_trees(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CRYPTO_hash(), GNUNET_YES, FindTreeClosure::id, NamespaceUpdateNode::nug, FindTreeClosure::nug, FindTreeClosure::tree_array, FindTreeClosure::tree_array_size, NamespaceUpdateNode::tree_id, FindTreeClosure::uig, NamespaceUpdateNode::update, GNUNET_FS_UpdateInformationGraph::update_map, and value.
Referenced by find_trees(), and GNUNET_FS_namespace_list_updateable().