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

fn phop

on role in the tail of a pipeline (D-5110): a node with the role runs the step; a node without it hands the pipeline over. The value that enters the step is already in the journal (pdurable of the same step); the hand-over names the role in s/{id}/w and releases the lease, so a node with that role (its servePipe loop) claims the entry and resumes at this step. Without any live node that has the role the step stays local (nothing could ever run it).

Example:

oxl✓ проверяется в CI
use std.saga { phop, Handoff }

fn tail(v: i64) -> i64 | Handoff | Timeout io, net, db, time {
  match phop("gpu", v) {
    i64 x => x + 1
    Handoff h => h
    Timeout t => t
  }
}

fn main() io, net, db, time {
  print("{tail(1)!}")
}
Вывод
2
pub(api) fn phop<T: Serializable>(role: str, v: T) -> T | Handoff | Timeout  net, db, time

С версии. 1.0.0-beta

Параметры

ИмяТип
rolestr
vT

Возвращает

T

Ошибки

  • Handoff @error
  • Timeout @error
  • `Handoff` (not a failure; the tail continues elsewhere), `Timeout`.

Эффекты

net, db, time

Определено в: std/saga/saga.oxl:1280

См. также