Skip to main content

Core concepts

This section builds the mental model behind Nodus. If Getting started showed you how to run a cluster, this section explains what the pieces are and why they behave as they do — so the API stops being a set of methods and becomes a coherent picture.

Everything in Nodus hangs off a single running handle, INodusNode. The concepts below map one-to-one to the capability areas on that handle.

The one handle, six areas

A product holds one INodusNode, and each capability is a first-class area on it. There is no "advanced" tier and no triple-hop to reach a capability. You get the handle once, from the entry point, and everything is reachable from it.

One INodusNode handle with its capability areas — Cluster, Leadership, Messaging, Events, and Health & Gossip — each a first-class facade reached directly from the handle.

Each area is a thin facade over the core services, so the same running node exposes membership, leadership, messaging, events, health, and gossip without any further wiring.

How a cluster is put together

A Nodus cluster is a peer-to-peer mesh. There is no central coordinator process: every member holds a direct TCP connection to every other member, heartbeats flow continuously between them, and exactly one member holds leadership for the current epoch.

A peer-to-peer cluster: node-1, node-2, and node-3 each hold a direct TCP connection to every other with heartbeats flowing continuously, and node-1 holds leadership for epoch 1.

Every node runs the same engine. There is no "server" role that is special infrastructure — the leader is simply a member the cluster has agreed to designate, and any member can become leader on failover.

The five concepts

The five concepts below each answer one question and map to one node area. Read them in order, starting with membership.

ConceptThe question it answersNode areaRead
MembershipWho is in the cluster right now, and how do they join and leave?node.ClusterMembership
Leader electionWhich single member coordinates, and what happens when it fails?node.LeadershipLeader election
MessagingHow does one node address another, send it work, and get a reply?node.MessagingMessaging
Cluster eventsHow does one node announce something to everyone at once?node.EventsCluster events
Health and gossipHow do nodes tell "slow" from "gone", and share state cheaply?node.Health, node.GossipHealth and gossip

How the concepts reinforce each other

The areas are not independent — they are layered on the same connections:

  • Membership is maintained by the health subsystem: a node becomes a member when it handshakes in, and leaves membership when heartbeats stop and the suspicion window elapses.
  • Leader election runs over membership: an election considers the reachable members, and every membership change (a join or a leave) can trigger a fresh election.
  • Messaging and cluster events ride the same pipelined-TCP transport the heartbeats do — direct messaging for one-to-one traffic, the event bus for one-to-many.
  • Gossip rides on the heartbeat traffic itself, so a product can piggyback its own state summary without opening a second protocol.

How the concepts layer on the same connections: the pipelined-TCP transport carries heartbeats, direct messaging, and cluster events; heartbeat and failure detection maintain membership, which leader election runs over; and gossip rides on the heartbeat traffic.

Start with Membership — it is the ground the other concepts stand on.

Next steps

  • Membership — who is in the cluster, and how join and leave work.
  • Leader election — how the cluster agrees on one coordinator.
  • Building a node — how you obtain the INodusNode handle in the first place.