kw rpc
Reserved keyword
The list of words: §1.4
Syntax
RpcSig = "rpc" Ident "(" [ Params ] ")" "->" Type ;Rpc = "rpc" Ident "(" [ IdentList ] ")" ( Block | "=>" Expr ) ;Grammar: App. A
Defined in
- 10.2 rpc attributes — Defaults for all rpcs are set in cluster { defaults { …
- 10.1 Services — A service declares a contract
- 10.3 Streams — The type is stream<T, E = never>.
- 13.4 Authorisation and policies — The subject of a policy
- 4.9 Attributes — Syntax: @name or @name(arguments) before a declaration, field, parameter or rpc.
- 10.4 Broadcast — local fan-out — Broadcast<T> delivers every published item to all current subscribers.
- 10.6 Pipelines — A pipeline is a linear chain of steps, each of which runs on its own node; data is passed from node to node directly, the caller receives on
- 1.4 Keywords — Reserved (cannot be used as names)
Examples
policy Orders {
allow get(id) if caller.isUser(db.find(Order, id)?.userId)
allow list, recent if caller.has(role: .Support)
allow * if caller.service("billing")
deny delete unless caller.has(role: .Admin) && caller is .User(mfa: true, ..)
}
@public rpc health() -> Ok
@allow(role: .Admin) rpc purge() -> Ok
@internal rpc create(…) -> Order— 13.4 Authorisation and policies
let prices = Broadcast<Tick>(buffer: TICK_BUFFER, slow: .DropOldest, replay: 1)
scope {
spawn { for await t in Exchange.feed() { prices.publish(t) } }
spawn { for await t in prices.subscribe() { ui.render(t) } }
spawn { for await t in prices.subscribe() { stats.add(t) } }
}
impl Market {
rpc ticks() -> stream<Shared<Tick>, Lagged> => prices.subscribe() // for every client
}— 10.4 Broadcast — local fan-out
Related diagnostics
attribute-not-applicable, cache-not-readonly, invalid-window, retry-not-idempotent, rpc-attr, duplicate-impl, impl-signature-mismatch, missing-impl, missing-rpc-impl, unknown-rpc, yield-outside-stream, data-rights, missing-policy, unknown-policy-target