fn done
End of step k. The last step (last) commits: in one transaction with the check of the cancel marker, so a cancelled saga
never completes forward (answer 9).
Example:
service Ledger {
@public @idempotent rpc openAcct(id: u64) -> u64
}
impl Ledger {
rpc openAcct(id) => id + 100
}
saga flow(a: u64) -> u64 {
Ledger.openAcct(a)
-> Ledger.openAcct(a)
}
fn main() io, net, time, db {
match flow(1) {
u64 v => print("done {v}")
CompensationFailed _ => print("stuck")
NetError _ => print("net error")
}
print("active: {std.saga.list(.Active).len()}")
}Вывод
done 101 active: 0
pub(api) fn done<T>(k: i64, last: bool, v: T) -> T | Timeout net, db, timeС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
k | i64 |
last | bool |
v | T |
Возвращает
T
Ошибки
Timeout@error- `Timeout` when the saga was cancelled before it could commit.
Эффекты
net, db, time
Определено в: std/saga/saga.oxl:488