Skip to content

Commit

Permalink
remove the following mature functions from draft : set_contest_in_gro…
Browse files Browse the repository at this point in the history
…up, set_advertise_endpoint, set_zcert, gossip_connect_curve
  • Loading branch information
stvales committed Jun 2, 2023
1 parent f51b7a3 commit dedeb67
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 91 deletions.
10 changes: 5 additions & 5 deletions api/zyre.api
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<return type = "integer" />
</method>

<method name = "set contest in group" state = "draft">
<method name = "set contest in group">
This options enables a peer to actively contest for leadership in the
given group. If this option is not set the peer will still participate in
elections but never gets elected. This ensures that a consent for a leader
Expand All @@ -133,18 +133,18 @@
<argument name = "group" type = "string" />
</method>

<method name = "set advertised endpoint" state = "draft">
<method name = "set advertised endpoint">
Set an alternative endpoint value when using GOSSIP ONLY. This is useful
if you're advertising an endpoint behind a NAT.
<argument name = "value" type = "string" />
</method>

<method name = "set zcert" state = "draft">
<method name = "set zcert">
Apply a azcert to a Zyre node.
<argument name = "zcert" type = "zcert"></argument>
</method>

<method name = "set zap domain" state = "draft">
<method name = "set zap domain">
Specify the ZAP domain (for use with CURVE).
<argument name = "domain" type = "string"/>
</method>
Expand All @@ -164,7 +164,7 @@
<argument name = "format" type = "format" />
</method>

<method name = "gossip connect curve" state = "draft">
<method name = "gossip connect curve">
Set-up gossip discovery with CURVE enabled.
<argument name = "public_key" type = "string" />
<argument name = "format" type = "format" />
Expand Down
55 changes: 25 additions & 30 deletions include/zyre.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,27 @@ ZYRE_EXPORT void
ZYRE_EXPORT int
zyre_set_endpoint (zyre_t *self, const char *format, ...) CHECK_PRINTF (2);

// This options enables a peer to actively contest for leadership in the
// given group. If this option is not set the peer will still participate in
// elections but never gets elected. This ensures that a consent for a leader
// is reached within a group even though not every peer is contesting for
// leadership.
ZYRE_EXPORT void
zyre_set_contest_in_group (zyre_t *self, const char *group);

// Set an alternative endpoint value when using GOSSIP ONLY. This is useful
// if you're advertising an endpoint behind a NAT.
ZYRE_EXPORT void
zyre_set_advertised_endpoint (zyre_t *self, const char *value);

// Apply a azcert to a Zyre node.
ZYRE_EXPORT void
zyre_set_zcert (zyre_t *self, zcert_t *zcert);

// Specify the ZAP domain (for use with CURVE).
ZYRE_EXPORT void
zyre_set_zap_domain (zyre_t *self, const char *domain);

// Set-up gossip discovery of other nodes. At least one node in the cluster
// must bind to a well-known gossip endpoint, so other nodes can connect to
// it. Note that gossip endpoints are completely distinct from Zyre node
Expand All @@ -133,6 +154,10 @@ ZYRE_EXPORT void
ZYRE_EXPORT void
zyre_gossip_connect (zyre_t *self, const char *format, ...) CHECK_PRINTF (2);

// Set-up gossip discovery with CURVE enabled.
ZYRE_EXPORT void
zyre_gossip_connect_curve (zyre_t *self, const char *public_key, const char *format, ...) CHECK_PRINTF (3);

// Start node, after setting header values. When you start a node it
// begins discovery and connection. Returns 0 if OK, -1 if it wasn't
// possible to start the node.
Expand Down Expand Up @@ -237,36 +262,6 @@ ZYRE_EXPORT void
ZYRE_EXPORT void
zyre_set_beacon_peer_port (zyre_t *self, int port_nbr);

// *** Draft method, for development use, may change without warning ***
// This options enables a peer to actively contest for leadership in the
// given group. If this option is not set the peer will still participate in
// elections but never gets elected. This ensures that a consent for a leader
// is reached within a group even though not every peer is contesting for
// leadership.
ZYRE_EXPORT void
zyre_set_contest_in_group (zyre_t *self, const char *group);

// *** Draft method, for development use, may change without warning ***
// Set an alternative endpoint value when using GOSSIP ONLY. This is useful
// if you're advertising an endpoint behind a NAT.
ZYRE_EXPORT void
zyre_set_advertised_endpoint (zyre_t *self, const char *value);

// *** Draft method, for development use, may change without warning ***
// Apply a azcert to a Zyre node.
ZYRE_EXPORT void
zyre_set_zcert (zyre_t *self, zcert_t *zcert);

// *** Draft method, for development use, may change without warning ***
// Specify the ZAP domain (for use with CURVE).
ZYRE_EXPORT void
zyre_set_zap_domain (zyre_t *self, const char *domain);

// *** Draft method, for development use, may change without warning ***
// Set-up gossip discovery with CURVE enabled.
ZYRE_EXPORT void
zyre_gossip_connect_curve (zyre_t *self, const char *public_key, const char *format, ...) CHECK_PRINTF (3);

// *** Draft method, for development use, may change without warning ***
// Unpublish a GOSSIP node from local list, useful in removing nodes from list when they EXIT
ZYRE_EXPORT void
Expand Down
6 changes: 0 additions & 6 deletions src/zyre.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ zyre_set_contest_in_group (zyre_t *self, const char *group) {
zstr_sendx (self->actor, "SET CONTEST" , group, NULL);
}

#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Public IP
void
zyre_set_advertised_endpoint (zyre_t *self, const char *endpoint)
{
Expand All @@ -344,7 +342,6 @@ zyre_set_advertised_endpoint (zyre_t *self, const char *endpoint)

zstr_sendx (self->actor, "SET ADVERTISED ENDPOINT", endpoint, NULL);
}
#endif

void zyre_set_zcert(zyre_t *self, zcert_t *zcert)
{
Expand Down Expand Up @@ -909,8 +906,6 @@ zyre_test (bool verbose)

printf ("OK\n");

#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Security
if (zsys_has_curve()){

printf (" * zyre-curve: ");
Expand Down Expand Up @@ -1145,5 +1140,4 @@ zyre_test (bool verbose)
printf ("OK\n");

}
#endif
}
30 changes: 0 additions & 30 deletions src/zyre_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,36 +83,6 @@ typedef struct _zyre_node_t zyre_node_t;
ZYRE_PRIVATE void
zyre_set_beacon_peer_port (zyre_t *self, int port_nbr);

// *** Draft method, defined for internal use only ***
// This options enables a peer to actively contest for leadership in the
// given group. If this option is not set the peer will still participate in
// elections but never gets elected. This ensures that a consent for a leader
// is reached within a group even though not every peer is contesting for
// leadership.
ZYRE_PRIVATE void
zyre_set_contest_in_group (zyre_t *self, const char *group);

// *** Draft method, defined for internal use only ***
// Set an alternative endpoint value when using GOSSIP ONLY. This is useful
// if you're advertising an endpoint behind a NAT.
ZYRE_PRIVATE void
zyre_set_advertised_endpoint (zyre_t *self, const char *value);

// *** Draft method, defined for internal use only ***
// Apply a azcert to a Zyre node.
ZYRE_PRIVATE void
zyre_set_zcert (zyre_t *self, zcert_t *zcert);

// *** Draft method, defined for internal use only ***
// Specify the ZAP domain (for use with CURVE).
ZYRE_PRIVATE void
zyre_set_zap_domain (zyre_t *self, const char *domain);

// *** Draft method, defined for internal use only ***
// Set-up gossip discovery with CURVE enabled.
ZYRE_PRIVATE void
zyre_gossip_connect_curve (zyre_t *self, const char *public_key, const char *format, ...) CHECK_PRINTF (3);

// *** Draft method, defined for internal use only ***
// Unpublish a GOSSIP node from local list, useful in removing nodes from list when they EXIT
ZYRE_PRIVATE void
Expand Down
21 changes: 1 addition & 20 deletions src/zyre_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,8 @@ zyre_node_dump (zyre_node_t *self)
zsys_info (" - name=%s uuid=%s", self->name, zuuid_str (self->uuid));

zsys_info (" - endpoint=%s", self->endpoint);
#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Security
if (self->public_key)
zsys_info (" - public-key: %s", self->public_key);
#endif
if (self->beacon_port)
zsys_info (" - discovery=beacon port=%d interval=%zu",
self->beacon_port, self->interval);
Expand Down Expand Up @@ -515,23 +512,17 @@ zyre_node_recv_api (zyre_node_t *self)
zstr_free (&value);
}
else
#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Election
if (streq (command, "SET CONTEST")) {
char *groupname = zmsg_popstr (request);
zyre_group_t *group = zyre_node_require_peer_group (self, groupname);
zyre_group_set_contest (group);
zstr_free (&groupname);
}
else
#endif
#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Public IP
if (streq (command, "SET ADVERTISED ENDPOINT")) {
self->advertised_endpoint = zmsg_popstr (request);
}
else
#endif
if (streq (command, "SET ENDPOINT")) {
zyre_node_gossip_start (self);
char *endpoint = zmsg_popstr (request);
Expand Down Expand Up @@ -592,8 +583,6 @@ zyre_node_recv_api (zyre_node_t *self)
}
}
else
#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Security
if (streq (command, "SET PUBLICKEY")) {
self->public_key = zmsg_popstr (request);
zhash_update (self->headers, "X-PUBLICKEY", self->public_key);
Expand All @@ -611,7 +600,6 @@ zyre_node_recv_api (zyre_node_t *self)
assert (self->zap_domain);
}
else
#endif
if (streq (command, "GOSSIP BIND")) {
zyre_node_gossip_start (self);
zstr_free (&self->gossip_bind);
Expand Down Expand Up @@ -727,8 +715,6 @@ zyre_node_recv_api (zyre_node_t *self)
else
if (streq (command, "PEERS"))
zsock_send (self->pipe, "p", zhash_keys (self->peers));
#ifdef ZYRE_BUILD_DRAFT_API
// DRAFT-API: Security
else
if (streq (command, "REQUIRE PEER")) {
char *uuidstr = zmsg_popstr (request);
Expand All @@ -744,7 +730,6 @@ zyre_node_recv_api (zyre_node_t *self)
zstr_free (&endpoint);
zstr_free (&public_key);
}
#endif
else
if (streq (command, "GROUP PEERS")) {
char *name = zmsg_popstr (request);
Expand Down Expand Up @@ -919,6 +904,7 @@ zyre_node_remove_peer (zyre_node_t *self, zyre_peer_t *peer)
// Clean this peer in our gossip table if needed
if (self->gossip_bind)
zstr_sendx (self->gossip, "UNPUBLISH", zyre_peer_identity (peer), NULL);
#endif

// Restart election if leaving peer was leader in a group
const char *group_name = (const char *) zlist_first (self->own_groups);
Expand Down Expand Up @@ -951,7 +937,6 @@ zyre_node_remove_peer (zyre_node_t *self, zyre_peer_t *peer)
}
group_name = (const char *) zlist_next (self->own_groups);
}
#endif

if (self->verbose)
zsys_info ("(%s) EXIT name=%s endpoint=%s",
Expand Down Expand Up @@ -1135,7 +1120,6 @@ zyre_node_recv_peer (zyre_node_t *self)
zlist_t *groups = zre_msg_groups (msg);
const char *name = (const char *) zlist_first (groups);
while (name) {
#ifdef ZYRE_BUILD_DRAFT_API
zyre_group_t *group = zyre_node_join_peer_group (self, peer, name);
if (zyre_group_contest (zyre_node_require_peer_group (self, name))) {
// Start election and if there's an active election, abort it
Expand All @@ -1157,9 +1141,6 @@ zyre_node_recv_peer (zyre_node_t *self)
self->name, name, zuuid_str (self->uuid));
zyre_group_send (group, &election_msg);
}
#else
zyre_node_join_peer_group (self, peer, name);
#endif
name = (const char *) zlist_next (groups);
}
// Now take peer's status from HELLO, after joining groups
Expand Down

0 comments on commit dedeb67

Please sign in to comment.