threefold.rmb #
RMB
Reliable Message Bus
Can talk to ZOS'es, ...
requirements
We need client to rmb-rs
compile rmb-rs (see below)
rmb-peer --mnemonics '$(cat mnemonic.txt)' --relay wss://relay.dev.grid.tf:443 --substrate wss://tfchain.dev.grid.tf:443
#
export TFCHAINSECRET='something here'
rmb-peer --mnemonics'$TFCHAINSECRET' --relay wss://relay.dev.grid.tf:443 --substrate wss://tfchain.dev.grid.tf:443
for developers
more info see https://github.com/threefoldtech/rmb-rs the message format of RMB itself https://github.com/threefoldtech/rmb-rs/blob/main/proto/types.proto
TODO: implement each endpoint on the zerohub here at client
TODO: the original code comes from code/github/threefoldtech/farmerbot/farmerbot/system/zos.v
fn new #
fn new(args_ RMBClientArgs) !RMBClient
params relay_url string TFNetType, default not specified, can chose unspecified, main, test, dev, qa tfchain_url string= e.g. "wss://relay.dev.grid.tf:443" OPTIONAL tfchain_mnemonic string= e.g. "wss://tfchain.dev.grid.tf:443" OPTIONAL
enum TFNetType #
enum TFNetType {
unspecified
main
test
dev
qa
}
struct RMBClient #
struct RMBClient {
pub mut:
relay_url string
tfchain_url string
tfchain_mnemonic string
redis &redisclient.Redis @[str: skip]
}
fn (RMBClient) get_storage_pools #
fn (mut z RMBClient) get_storage_pools(dst u32) ![]ZosPool
get storage pools from a zos, the argument is u32 address of the zos
fn (RMBClient) get_zos_statistics #
fn (mut z RMBClient) get_zos_statistics(dst u32) !ZosResourcesStatistics
get zos statistic from a node, nodeid is the parameter
fn (RMBClient) get_zos_system_version #
fn (mut z RMBClient) get_zos_system_version(dst u32) !string
fn (RMBClient) get_zos_wg_ports #
fn (mut z RMBClient) get_zos_wg_ports(dst u32) ![]u16
Todo: point to documentation where it explains what this means, what is zos_wg_port and why do we need it
fn (RMBClient) rmb_request #
fn (mut z RMBClient) rmb_request(cmd string, dst u32, payload string) !RmbResponse
cmd is e.g.
fn (RMBClient) zos_has_public_ipaddr #
fn (mut z RMBClient) zos_has_public_ipaddr(dst u32) !bool
if true the ZOS has a public ip address
struct RMBClientArgs #
struct RMBClientArgs {
pub:
nettype TFNetType
relay_url string
tfchain_url string
}
struct RmbError #
struct RmbError {
pub mut:
code int
message string
}
struct RmbMessage #
struct RmbMessage {
pub mut:
ver int = 1
cmd string
src string
ref string
exp u64
dat string
dst []u32
ret string
now u64
shm string
}
struct RmbResponse #
struct RmbResponse {
pub mut:
ver int = 1
ref string // todo: define
dat string
dst string // todo: define what is this
now u64
shm string // todo: what is this?
err RmbError
}
struct ZosPool #
struct ZosPool {
pub mut:
name string
pool_type PoolType
size int
used int
}
struct ZosResources #
struct ZosResources {
pub mut:
cru u64
sru u64
hru u64
mru u64
ipv4u u64
}
struct ZosResourcesStatistics #
struct ZosResourcesStatistics {
pub mut:
total ZosResources
used ZosResources
system ZosResources
}