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:
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)!}")
}Output
2
pub(api) fn phop<T: Serializable>(role: str, v: T) -> T | Handoff | Timeout net, db, timeSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
role | str |
v | T |
Returns
T
Errors
Effects
net, db, time
Defined in: std/saga/saga.oxl:1294