lattice_core/replica_id
A globally unique identifier for a replica (node) in a distributed system.
Replica IDs are opaque wrappers around strings. Use new to create one
from a string and to_string to extract the underlying value. The opaque
type prevents accidental use of arbitrary strings where a replica ID is
expected.
Example
import lattice_core/replica_id
let rid = replica_id.new("node-a")
replica_id.to_string(rid) // -> "node-a"
Types
Values
pub fn compare(a: ReplicaId, b: ReplicaId) -> order.Order
Compare two ReplicaId values lexicographically.
Delegates to string.compare on the underlying strings. Used for
deterministic tie-breaking (e.g., in LWW-Register merge when timestamps
are equal).
pub fn decoder() -> decode.Decoder(ReplicaId)
A decoder for ReplicaId values in JSON.
Decodes a JSON string and wraps it in a ReplicaId. Useful as a building
block in from_json decoders across the library.