Malachi.Cluster.LeaseMachine (malachi v0.22.7)

View Source

A ra (Raft) state machine that replicates a Malachi.Cluster.Lease.

apply/3 delegates to the pure Lease.apply/3, feeding it the ra command metadata's system_time (the leader's clock, stamped once and replicated in the log) as now. The machine never reads a clock itself: that would be non-deterministic and break Raft - so every replica applies the same command at the same now and reaches the same lease state. One dedicated ra cluster backs the cluster's lease.

Versioned through Malachi.Cluster.MachineVersion, which also keeps an unknown command from raising here: Lease.apply/3 has no catch-all clause.