moonzero · control plane v0.15.0 · 49 packages · 4 targets · Apache-2.0 docs / routing / rpcconf GitHub

10 / ROUTING

rpcconf

The server and client blocks: the timeout, both CPU thresholds, authentication, and one flag per interceptor, all loading from a config document with their defaults.

struct RpcServerMiddlewaresConf

struct

fn RpcServerMiddlewaresConf::new( trace~ : Bool = true, recover~ : Bool = true, stat~ : Bool = true, prometheus~ : Bool = true, breaker~ : Bool = true, shedding~ : Bool = true, timeout~ : Bool = true, auth~ : Bool = true) -> RpcServerMiddlewaresConf

fnThe full server chain, which is what the reference implementation defaults to.

extend RpcServerMiddlewaresConf with @json.FromJson::

item

extend RpcServerMiddlewaresConf with Debug::

item

extend RpcServerMiddlewaresConf with Eq::

item

struct RpcClientMiddlewaresConf

struct

fn RpcClientMiddlewaresConf::new( trace~ : Bool = true, log~ : Bool = true, prometheus~ : Bool = true, breaker~ : Bool = true, timeout~ : Bool = true) -> RpcClientMiddlewaresConf

fnThe full client chain.

extend RpcClientMiddlewaresConf with @json.FromJson::

item

extend RpcClientMiddlewaresConf with Debug::

item

extend RpcClientMiddlewaresConf with Eq::

item

struct RpcServerConf

struct

fn RpcServerConf::new( name~ : String = "rpc", host~ : String = "0.0.0.0", port~ : Int32 = rpc_port, timeout_ms~ : Int32 = 2000, cpu_threshold~ : Int64 = 900L, cpu_threshold_overload~ : Int64 = 950L, auth~ : Bool = false, health~ : Bool = true, middlewares~ : RpcServerMiddlewaresConf = RpcServerMiddlewaresConf::new()) -> RpcServerConf

fnBuild an RPC server config with the reference implementation's defaults: the family's rpc port, a 2s timeout, 90% CPU as the shed threshold and 95% as the overload threshold.

extend RpcServerConf with Debug::

item

extend RpcServerConf with Eq::

item

fn RpcServerConf::from_json(src : String) -> RpcServerConf raise Refused

fnLoad an RpcServerConf from a JSON config string, filling omitted fields from the new() defaults — the lenient loader matching the reference implementation's ,optional/,default= config tags.

fn RpcServerConf::from_yaml(src : String) -> RpcServerConf raise Refused

fnLoad an RpcServerConf from a YAML config string, with the same default-filling semantics as from_json.

struct RpcClientConf

struct

fn RpcClientConf::new( target~ : String = "", endpoints~ : Array[String] = [], timeout_ms~ : Int32 = 2000, non_block~ : Bool = false, middlewares~ : RpcClientMiddlewaresConf = RpcClientMiddlewaresConf::new()) -> RpcClientConf

fnA client config with a 2s call timeout and the full interceptor chain.

extend RpcClientConf with Debug::

item

extend RpcClientConf with Eq::

item

fn RpcClientConf::from_json(src : String) -> RpcClientConf raise Refused

fnLoad an RpcClientConf from a JSON config string, filling omitted fields from the new() defaults.

fn RpcClientConf::from_yaml(src : String) -> RpcClientConf raise Refused

fnLoad an RpcClientConf from a YAML config string.