GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
/**
* @file include/gnunet_consensus_service.h
- * @brief
+ * @brief multi-peer set reconciliation
* @author Florian Dold
*/
#include "gnunet_common.h"
#include "gnunet_time_lib.h"
#include "gnunet_configuration_lib.h"
-
-
-/**
- * An element of the consensus set.
- */
-struct GNUNET_CONSENSUS_Element
-{
- /**
- * The actual data of the element.
- */
- const void *data;
-
- /**
- * Size of the element's data.
- */
- uint16_t size;
-
- /**
- * Application specific element type
- */
- uint16_t type;
-};
+#include "gnunet_set_service.h"
/**
* Called when a new element was received from another peer, or an error occured.
- *
* May deliver duplicate values.
- *
* Elements given to a consensus operation by the local peer are NOT given
* to this callback.
*
* @param cls closure
* @param element new element, NULL on error
- * @return GNUNET_OK if the valid is well-formed and should be added to the consensus,
- * GNUNET_SYSERR if the element should be ignored and not be propagated
*/
-typedef int (*GNUNET_CONSENSUS_ElementCallback) (void *cls,
- struct GNUNET_CONSENSUS_Element *element);
+typedef void (*GNUNET_CONSENSUS_ElementCallback) (void *cls,
+ const struct GNUNET_SET_Element *element);
/**
- * Create a consensus session.
- * The set being reconciled is initially empty. Only reconcile with other peers
- * after GNUNET_CONSENSUS_reconcile has been called.
+ * Create a consensus session. The set being reconciled is initially
+ * empty. Only reconcile with other peers after
+ * GNUNET_CONSENSUS_reconcile has been called.
*
* @param cfg
* @param num_peers
* GNUNET_CONSENSUS_destroy instead.
*
* @param cls
- * @param success GNUNET_OK on success, GNUNET_SYSERR if
+ * @param success GNUNET_OK on success, GNUNET_SYSERR if
* the insertion and thus the consensus failed for good
*/
typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
*
* @param consensus handle for the consensus session
* @param element the element to be inserted
- * @param idc function called when we are done with this element and it
+ * @param idc function called when we are done with this element and it
* is thus allowed to call GNUNET_CONSENSUS_insert again
* @param idc_cls closure for 'idc'
*/
void
GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
- const struct GNUNET_CONSENSUS_Element *element,
+ const struct GNUNET_SET_Element *element,
GNUNET_CONSENSUS_InsertDoneCallback idc,
void *idc_cls);
-/**
- * Begin reconciling elements with other peers.
- * May not be called if an insert operation has not yet finished.
- *
- * @param consensus handle for the consensus session
- */
-void
-GNUNET_CONSENSUS_begin (struct GNUNET_CONSENSUS_Handle *consensus);
-
-
-
-struct GNUNET_CONSENSUS_DeltaRequest;
-
-/**
- * We are finished inserting new elements into the consensus;
- * try to conclude the consensus within a given time window.
- *
- * @param consensus consensus session
- * @param timeout timeout after which the conculde callback
- * must be called
- * @param conclude called when the conclusion was successful
- * @param conclude_cls closure for the conclude callback
- */
-struct GNUNET_CONSENSUS_DeltaRequest *
-GNUNET_CONSENSUS_get_delta (struct GNUNET_CONSENSUS_Handle *consensus,
- uint32_t group_id,
- GNUNET_CONSENSUS_ElementCallback remove_element_cb,
- void *remove_element_cb_cls);
-
-
-void
-GNUNET_CONSENSUS_get_delta_cancel (struct GNUNET_CONSENSUS_DeltaRequest *dr);
-
-
-struct GNUNET_CONSENSUS_Group
-{
- unsigned int num_members;
- uint64_t total_elements_in_group;
- const struct GNUNET_PeerIdentity **members;
-};
-
/**
* Called when a conclusion was successful.
*
* @param cls
- * @param group
- * @return GNUNET_YES if more consensus groups should be offered, GNUNET_NO if not
*/
-typedef int (*GNUNET_CONSENSUS_ConcludeCallback) (void *cls, const struct GNUNET_CONSENSUS_Group *group);
+typedef void (*GNUNET_CONSENSUS_ConcludeCallback) (void *cls);
/**
void
GNUNET_CONSENSUS_conclude (struct GNUNET_CONSENSUS_Handle *consensus,
struct GNUNET_TIME_Relative timeout,
- unsigned int min_group_size_in_consensus,
GNUNET_CONSENSUS_ConcludeCallback conclude,
void *conclude_cls);