#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_consensus_service.h"
#include "consensus.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_CONSENSUS_Handle |
Handle for the service. More... | |
struct | InsertDoneInfo |
FIXME: this should not bee necessary when the API issue has been fixed. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "consensus-api", __VA_ARGS__) |
Functions | |
static int | check_new_element (void *cls, const struct GNUNET_CONSENSUS_ElementMessage *msg) |
Called when the server has sent is a new element. More... | |
static void | handle_new_element (void *cls, const struct GNUNET_CONSENSUS_ElementMessage *msg) |
Called when the server has sent is a new element. More... | |
static void | handle_conclude_done (void *cls, const struct GNUNET_MessageHeader *msg) |
Called when the server has announced that the conclusion is over. More... | |
static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
struct GNUNET_CONSENSUS_Handle * | GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, const struct GNUNET_PeerIdentity *peers, const struct GNUNET_HashCode *session_id, struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute deadline, GNUNET_CONSENSUS_ElementCallback new_element_cb, void *new_element_cls) |
Create a consensus session. More... | |
static void | idc_adapter (void *cls) |
void | GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus, const struct GNUNET_SET_Element *element, GNUNET_CONSENSUS_InsertDoneCallback idc, void *idc_cls) |
Insert an element in the set being reconsiled. More... | |
void | GNUNET_CONSENSUS_conclude (struct GNUNET_CONSENSUS_Handle *consensus, GNUNET_CONSENSUS_ConcludeCallback conclude, void *conclude_cls) |
We are done with inserting new elements into the consensus; try to conclude the consensus within a given time window. More... | |
void | GNUNET_CONSENSUS_destroy (struct GNUNET_CONSENSUS_Handle *consensus) |
Destroy a consensus handle (free all state associated with it, no longer call any of the callbacks). More... | |
Definition in file consensus_api.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "consensus-api", __VA_ARGS__) |
Definition at line 33 of file consensus_api.c.
|
static |
Called when the server has sent is a new element.
cls | consensus handle |
msg | element message |
Definition at line 106 of file consensus_api.c.
References GNUNET_OK.
|
static |
Called when the server has sent is a new element.
cls | consensus handle |
msg | element message |
Definition at line 121 of file consensus_api.c.
References GNUNET_SET_Element::data, GNUNET_SET_Element::element_type, GNUNET_ERROR_TYPE_DEBUG, LOG, msg, GNUNET_CONSENSUS_Handle::new_element_cb, GNUNET_CONSENSUS_Handle::new_element_cls, GNUNET_MessageHeader::size, and GNUNET_SET_Element::size.
|
static |
Called when the server has announced that the conclusion is over.
cls | consensus handle |
msg | conclude done message |
Definition at line 146 of file consensus_api.c.
References GNUNET_CONSENSUS_Handle::conclude_cb, GNUNET_CONSENSUS_Handle::conclude_cls, GNUNET_assert, GNUNET_MQ_destroy(), and GNUNET_CONSENSUS_Handle::mq.
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure, same closure as for the message handlers |
error | error code |
Definition at line 170 of file consensus_api.c.
References GNUNET_ERROR_TYPE_WARNING, and LOG.
Referenced by GNUNET_CONSENSUS_create().
|
static |
Definition at line 253 of file consensus_api.c.
References InsertDoneInfo::cls, GNUNET_free, GNUNET_OK, and InsertDoneInfo::idc.
Referenced by GNUNET_CONSENSUS_insert().