fn leader
Registers the leader task name (§12.6) and returns at once. On a single node this node is the leader of every task,
so body starts in the background scope of the node (no election, the runs leader(name) role clause is not
checked, D-2906).
Example:
use std.time { every }
use std.cluster
fn main() io, time {
cluster.leader("cleanup") {
every(60s) { print("cleaning") }
}
}pub(api) fn leader<effect F>(name: str, body: fn() F)Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
name | str |
body | fn() F |
Effects
none declared (pure unless the body says otherwise)
Defined in: std/cluster/cluster.oxl:122