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

method ClusterApi.pick

One node that serves name: the least loaded one (by: .LeastLoad), or the first (.First); prefer: .SameZone limits the choice to this node's zone when there is a node in it (§12.3).

Example:

oxl✓ проверяется в CI
fn main() io {
  match cluster.pick("Bank", by: .LeastLoad, prefer: .SameZone) {
    ClusterMember m => print("use {m.id.name}")
    none => print("nobody serves Bank")
  }
}
Вывод
nobody serves Bank
pub(api) fn pick(name: str, by: PickBy = .LeastLoad, prefer: Prefer = .Any) -> ClusterMember?

С версии. 1.0.0-beta

Параметры

ИмяТип
namestr
byPickBy = .LeastLoad
preferPrefer = .Any

Возвращает

ClusterMember?

Эффекты

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

Определено в: std/core/node.oxl:539

См. также