NodeID
Uniquely identifies a node in the distributed system with support for rebirth semantics.Type Definition
Constructors
NewNodeID
Creates a new NodeID with generation 0.WithGeneration
Creates a NodeID with a specific generation.Methods
Rebirth
Creates a new identity for a reborn node. This MUST be used when a node returns after being declared dead.IsRebirthOf
Checks if this NodeID is a rebirth of another NodeID.true if the base matches but this generation is higher
Example:
Equal
Checks if two NodeIDs are equal.String
Returns a human-readable representation.{base:016x}.g{generation}
Confidence
Represents a value in the range [0.0, 1.0] with bounds enforced at construction.Type Definition
Constants
Constructors
NewConfidence
Creates a new Confidence from a raw value.MustConfidence
Creates a Confidence or panics if invalid.ClampedConfidence
Creates a Confidence, clamping to valid range [0.0, 1.0].ConfidenceZero / ConfidenceOne
Convenience constructors for minimum and maximum confidence.Methods
Value
Returns the raw confidence value.IsZero / IsOne
Checks if confidence is effectively zero or one.Equal
Checks if two confidences are equal within tolerance.Less
Checks if this confidence is less than another.String
Returns a human-readable representation.{value*100:.2f}%
Belief
Represents a probability distribution over node liveness states.Type Definition
BeliefState
The dominant state of a belief distribution.Constants
Constructors
NewBelief
Creates a new Belief from raw confidence values.MustBelief
Creates a Belief or panics if invalid.UnknownBelief
Creates a belief of pure uncertainty (initial state).CertainlyAlive / CertainlyDead
Creates beliefs of absolute certainty. Use with caution.CertainlyDead() triggers irreversible death semantics.
Methods
Alive / Dead / Unknown
Returns the confidence for each state.IsCertainAlive / IsCertainDead
Checks if the belief exceeds the certainty threshold (0.95).Dominant
Returns the dominant state (highest confidence).StateUnknown if no clear winner (difference < DominantMargin)
Example:
IsValid
Checks that the belief invariant holds.true if alive + dead + unknown ≈ 1.0
Equal
Checks if two beliefs are equal.String
Returns a human-readable representation.[A:{alive}% D:{dead}% U:{unknown}%] → {dominant_state}
Example: