kw shards
Contextual keyword — cluster declaration (§12.1)
The list of words: §1.4
Syntax
RoleClause = "serves" IdentList | "hosts" IdentList | "runs" ( "sagas" | "leader" "(" StrLit ")" )
| "journal" | "shards" IntLit | "replication" IntLit | "replicas" Expr
| "needs" Expr | "expose" IntLit { Expr } ;Grammar: App. A
Defined in
- 12.1 Cluster declaration — A program has at most one cluster.
- 12.4 Shards — The built-in storage is divided into shards virtual shards (set once).
- 1.4 Keywords — Reserved (cannot be used as names)
- 6.5 Errors — There are no exceptions.
- 12.8 Built-in storage and tables — The storage is on every node of the journal role, replication is Raft per shard.
- 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).
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
Related diagnostics
actor-not-hosted, cluster-auth, cluster-decl, cluster-needs, cluster-seeds, placement-conflict, saga-without-role, service-not-served, topic-without-journal, unknown-role, fail-type, question-context, unhandled-error, query-not-sql