View Source partisan_membership_set (partisan v5.0.0-beta.14)

This module represents the cluster membership view for this node.

When a node joins the cluster it is added to the set. Conversely when a node leaves the cluster it is removed from the set. A node that crashes or gets disconnected will remain in the set so that Partisan can try to re-connect with the node when it restarts or becomes reachable again.

implementation

Implementation

The set is implemented as a CRDT set of partisan:node_spec() objects. More specifically a state_orset.

Notice that because the set stores partisan:node_spec() objects and not node(), the set can have multiple partisan:node_spec() objects for the same node.

This can occur when the set contains one or more stale specifications.

stale-specifications

Stale Specifications

A stale specification exists due to the following reasons:

  • A node crashes (without leaving the cluster) and returns bearing different IP Addresses (the value of the node specification's listen_addrs property). This is common in cloud orchestration scenarios where instances have dynamic IP addresses.
  • A node crashes (without leaving the cluster) and returns bearing different values for the node specification properties channels and/or parallelism. For example, this can happen in the case the Partisan configuration has changed when using a rolling update strategy i.e. a gradual update process that allows you to update a cluster one node at a time to minimise downtime.

Link to this section Summary

Link to this section Types

-opaque t()

Link to this section Functions

Link to this function

add(NodeSpec, Actor, T0)

View Source
-spec add(partisan:node_spec(), Actor :: partisan:actor(), t()) -> t().
-spec decode(binary()) -> t().
-spec encode(t()) -> binary().
-spec equal(t(), t()) -> boolean().
-spec merge(t(), t()) -> t().
-spec new() -> t().
Link to this function

remove(NodeSpec, Actor, T)

View Source
-spec remove(partisan:node_spec(), Actor :: partisan:actor(), t()) -> t().
-spec to_list(t()) -> [partisan:node_spec()].