Logical clocks, vector clocks, happens-before analysis, and causal buffers for MoonBit.
let events = sample_out_of_order_events()
let buffer = CausalBuffer::new().push(events[0]).push(events[1]).flush_ready()
println(buffer.to_json())moon add SCL-NN/moontracekitpub(all) struct CausalBuffer {
delivered : VectorClock
pending : Array[CausalEvent]
max_pending : Int
dropped : Int
}fn CausalEvent::new(id : String, origin : String, clock : VectorClock, payload : String) -> CausalEventpub(all) struct ClockEntry {
node : String
counter : Int
}pub(all) struct LamportClock {
node : String
counter : Int
}Logical clocks, vector clocks, happens-before analysis, and causal buffers for MoonBit.