OxL Reference

data Client

Client of service S: S.at(node) and S.connect(addr, tls: …) return one, its methods are the rpcs of S (client.get(id) has the same result as S.get(id): T | Errors | NetError).

Example:

oxl✓ checked in CI
service Bank {
  @public rpc balance(id: u64) -> i64
}

impl Bank {
  rpc balance(id) => 0
}

// `Bank.at(node)` calls the service on one particular node
fn ask(n: NodeId) -> i64 | NetError net {
  Bank.at(n).balance(1)
}
pub(api) data Client<S>

Since. 1.0.0-beta

Fields

pub(api) kind: i64

0 = routed by the cluster (S.m()), 1 = a node (at), 2 = an external address (connect).

pub(api) target: str

Node name (kind 1) or address (kind 2) the client talks to.

Defined in: std/core/rpc.oxl:317

See also