kw cluster
Reserved keyword
The list of words: §1.4
Syntax
Cluster = "cluster" Ident "{" { ClusterClause } "}" ;Grammar: App. A
Defined in
- 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).
- 10.5 Topics — cluster-wide fan-out — A topic is a distributed broadcast with storage in the built-in storage.
- 12.3 Routing and neighbour discovery — A call of service S
- 2.4 Entry points and start-up order — A program is a package that contains at least one of
- 12.1 Cluster declaration — A program has at most one cluster.
- 5.7 Lambdas and closures — .field and .method(args) in argument position are shorthand for a lambda with one parameter.
- 6.5 Errors — There are no exceptions.
- 10.2 rpc attributes — Defaults for all rpcs are set in cluster { defaults { …
Examples
let 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
let inc = x => x + 1
let add = (a: i32, b: i32) => a + b
users.map(.name) // = u => u.name
users.filter(.isActive()) // = u => u.isActive()
retryWith(3) { fetch() } // a closure as the last argument
cluster.lock("k", ttl: LOCK_TTL) { migrate() }Related diagnostics
topic-without-journal, no-entry-point, actor-not-hosted, cluster-auth, cluster-decl, cluster-needs, cluster-seeds, placement-conflict, saga-without-role, service-not-served, unknown-role, fail-type, question-context, unhandled-error