OxL Справочник OxL
РусскийEnglish

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:

oxl✓ проверяется в CI
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)

С версии. 1.0.0-beta

Параметры

ИмяТип
namestr
bodyfn() F

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/cluster/cluster.oxl:122

См. также