OxL Reference

kw saga

Reserved keyword

The list of words: §1.4

Syntax

ebnf
Saga        = "saga" Ident "(" [ Params ] ")" "->" Type "{" SStep { "->" SStep } "}" ;

Grammar: App. A

Defined in

  • 11.1 Kinds of transactions — Kinds of transactions
  • 11.3 Sagas — A saga is a sequence of steps (the step syntax is as in a chain, §8.4); after a step there MAY be undo x => compensation, where x is the res
  • 12.1 Cluster declaration — A program has at most one cluster.
  • 1.4 Keywords — Reserved (cannot be used as names)
  • 12.7 Dependencies — provide Type = expression (for role r, …)?
  • 18.4 Simulation — In sim the scheduler, network, clocks, randomness and disk failures are deterministic; the result depends only on the seed.

Examples

oxl
saga checkout(cart: Cart) -> Order {
  Inventory.reserve(cart)          undo r => Inventory.release(r.id)
  -> Payments.charge(cart.total)   undo p => Payments.refund(p.id)
  -> Orders.create(cart, it)
}

— 11.3 Sagas

oxl
provide Db = Db.open(App.get().dbUrl)          for role api, saga
provide Payments = PaymentsClient.new(App.get().stripeKey)

impl Orders { dep db: Db; dep pay: Payments }

— 12.7 Dependencies

Related diagnostics

saga-decl, saga-idempotency, actor-not-hosted, cluster-auth, cluster-decl, cluster-needs, cluster-seeds, placement-conflict, saga-without-role, service-not-served, topic-without-journal, unknown-role, duplicate-provide, missing-provide

See also