module std.cluster
std.cluster — the node and its cluster (§12.3, single node: D-2906).
Example:
use std.cluster
fn main() io {
let me = cluster.selfInfo()
print("{me.isSelf} {cluster.members().len()} {cluster.now() < cluster.now()}")
}Вывод
true 1 true
Функции
leader | Registers the leader task name (§12.6) and returns at once. |
lock | Runs body under the distributed lock key (§12.6). |
lockFenced | Like lock; body receives the fencing token. |
members | The members that are alive or merely suspected (§12.3 cluster.members()). |
node | The id of the node called name. |
nodes | All nodes the membership knows, this one included, with their state ("alive", "suspect", "dead", "left"). |
now | Hybrid logical clock stamp of a new event (§12.6, §17.3). |
observe | Merges a stamp received from outside the cluster channel; false when it is more than the allowed drift ahead. |
self | The id of this node. |
selfInfo | This node as the registry sees it (roles, zone, labels, address, version, schema hash, load). |
shards | The shard groups of the cluster. |