class

Clustering

Inherits Reference < Object

Constants

Log = ::Log.for(self)

Constructors

new(uri : String | URI, name : String = ULID.generate, discovery : HoundDog::Discovery | Nil = nil, etcd_host : String = ENV["ETCD_HOST"]? || "localhost", etcd_port : Int32 = ENV["ETCD_PORT"]?.try(&.to_i?) || 2379)
Source

Class methods

election_key
Source
meta_namespace
Source
readiness_key
Source
service_namespace
Source

Instance methods

cluster_change

Leader publishes a new version upon nodes joining/leaving the cluster

Source
cluster_consistent?

When there's an event under the readiness namespace, node creates a hash from node to version. If all the nodes are at the same version, the cluster is consistent.

Source
cluster_version

The version the current node is stable against

Source
consume_stabilization_events

Consume stabilization events until fiber channel empty

Ensures that the node will have only the latest version

Source
discovery

Provides cluster node discovery

Source
etcd_client

Generate a new Etcd client

Source
handle_readiness_event

The leader calls the on_stable callback if...

  • cluster's version state is consistent
  • consistent state has not already been confirmed to be consistent
Source
handle_version_change(value)

Leader has published a new version to etcd

Source
leader?

Whether node is the cluster leader

Source
leader_node

Attains the current leader node

Source
name(*args, **options)
Source
name(*args, **options, &)
Source
node_versions
Source
nodes(*args, **options)
Source
nodes(*args, **options, &)
Source
retry_on_missing_lease

Retry a query if a lease is missing for at most the maximum requested lease TTL

Source
service(*args, **options)
Source
service(*args, **options, &)
Source
stabilize

Performed to align nodes in the cluster

Source
start

Starts the node's clustering processes.

  • discovery (via hound-dog)
  • election_watcher (election event consumer)
  • readiness_watcher (cluster node version event consumer)
  • version_watcher (version change event consumer)
  • consume_stabilization_events (created by version_watcher)
Source
start(on_stable : String -> Nil | Nil = nil, &stabilize : Array(HoundDog::Service::Node) -> Bool)

Like above. Accepts a block that will be called with cluster nodes during stabilization events

If stabilize callback is true, the node is marked as ready.

Source
stop

Unregisters node from the cluster and ceases event handling

Source
uri(*args, **options)
Source
uri(*args, **options, &)
Source