Module cartridge.rpc
Remote procedure calls between cluster instances.
Functions
get_candidates (role_name[, opts]) | List instances suitable for performing a remote call. |
call (role_name, fn_name[, args[, opts]]) | Perform a remote procedure call. |
Local Functions
get_connection (role_name[, opts]) | Connect to an instance with an enabled role. |
Functions
- get_candidates (role_name[, opts])
-
List instances suitable for performing a remote call.
Parameters:
- role_name string
- opts
- leader_only optional boolean Filter instances which are leaders now. (default: false)
- healthy_only optional boolean Filter instances which have membership status healthy. (added in v1.1.0-11, default: true)
Returns:
-
{string,...}
URIs
- call (role_name, fn_name[, args[, opts]])
-
Perform a remote procedure call.
Find a suitable healthy instance with an enabled role and
perform a
net.box
conn:call
on it.Parameters:
- role_name string
- fn_name string
- args table (optional)
- opts
- prefer_local optional boolean Don't perform a remote call if possible. When the role is enabled locally and current instance is healthy the remote netbox call is substituted with a local Lua function call. When the option is disabled it never tries to perform call locally and always uses netbox connection, even to connect self. (default: true)
- leader_only optional boolean Perform a call only on the replica set leaders. (default: false)
- uri
optional string
Force a call to be performed on this particular uri.
Disregards member status and
opts.prefer_local
. Conflicts withopts.leader_only = true
. (added in v1.2.0-63) - remote_only
(deprecated) Use
prefer_local
instead. - timeout
passed to
net.box
conn:call
options. - buffer
passed to
net.box
conn:call
options.
Returns:
conn:call()
resultOr
- nil
- table Error description