OxL Reference

src/main.oxl

oxl
use self.counter { Gate }
use std.time { every }

fn main() io, net, time {
  print("node {cluster.self().name} is up")
  // A leader task runs on exactly one node of the roles that declare `runs leader("traffic")`
  // and moves to another node when that one fails.
  cluster.leader("traffic") {
    var step = 0
    every(2s) {
      step += 1
      match Gate.add(7, 1) {
        i64 v => print("step {step}: counter 7 = {v}")
        NetError _ => print("step {step}: counter 7 is not available yet")
      }
    }
  }
}

Source: examples/counter-cluster/src/main.oxl