kw net
Contextual keyword — the effect list after the return type (§6.2)
The list of words: §1.4
Syntax
Effect = "io" | "net" | "db" | "time" | "rand" | Ident ;Grammar: App. A
Defined in
- 18.4 Simulation — In sim the scheduler, network, clocks, randomness and disk failures are deterministic; the result depends only on the seed.
- 10.2 rpc attributes — Defaults for all rpcs are set in cluster { defaults { …
- 6.2 Effects — The set of effects is written after the return type, comma-separated
- 11.2 Database transaction — The body is executed in a transaction of the database db.
- 1.4 Keywords — Reserved (cannot be used as names)
- 15.1 comptime — A comptime fn is executed only at compile time; comptime { …
- 4.3 Construction and constructors — Literal. T{ f1: e1, f2, ..base }
- 6.5 Errors — There are no exceptions.
Examples
test sim "checkout under faults" seeds 1..=500 {
net.partition(["api"], ["storage"], for: 2s)
net.latency(10ms..300ms)
node.kill("saga-0") after 1s
clock.advance(1h)
assert checkout(cart) is Order | PayError
}@explicit interface Middleware { fn around(ctx: &var Ctx, next: Next) -> Response net, io, time, db }Related diagnostics
attribute-not-applicable, cache-not-readonly, invalid-window, retry-not-idempotent, rpc-attr, effects, atomic-db-effects, cross-shard-tx, comptime-error, not-comptime, bad-init, missing-field, must-close, positional-literal