kw within
Contextual keyword — chain suffixes (§8.4)
The list of words: §1.4
Syntax
Suffix = "within" Binary | "retry" Binary [ "on" Type ] [ "backoff" Binary ] ;Grammar: App. A
Defined in
- 8.4 Chains — A chain links asynchronous steps so that either the whole chain is executed or the first unhandled error is returned.
- 12.6 Distributed computation — cluster.shards(src) is for sharded tables and actors; map runs close to the data, the function MUST be transferable (§7.3).
- 1.2 Statement termination — A statement is terminated by ; or by a line break.
- 1.4 Keywords — Reserved (cannot be used as names)
- 5.2 Precedence and associativity — Precedence and associativity
- 8.6 Cancellation and deadlines — Cancellation is cooperative
Examples
let page = Users.get(id)
-> (Orders.recent(it.id), Recs.for(it.id))
-> (orders, recs) => Page{ orders, recs }
~> Audit.log("page", id)
!> Timeout => Page.empty()
within PAGE_DEADLINE
retry 2
let html = await pagelet byRegion = cluster.shards(db.Order)
.map(o => (o.region, o.total)) // executed on the shard owners
.reduceBy(.0, (a, b) => a + b) // partial aggregation, then merge
within REPORT_DEADLINE
cluster.leader("nightly-report") { every(REPORT_PERIOD) { buildReport() } }
cluster.lock("user:{uid}", ttl: LOCK_TTL) { migrateUser(uid) }— 12.6 Distributed computation
Related diagnostics
it-outside-chain, chained-comparison