-
Notifications
You must be signed in to change notification settings - Fork 43
instance_uri() method for config module #4120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would like to define a behavior of the method in a more formal way. APIlocal config = require('config')
config:instance_uri([uri_type[, opts]]) SynopsisAn advertise URI of the given instance. The function returns an URI suitable to connect to the given instance from within the cluster1. Arguments
Return valueReturns an URI in the following format (or {
login = <string>,
password = <string>,
uri = <host:port>,
params = {
transport = one-of('plain', 'ssl'),
ssl_ca_file = <string>,
ssl_cert_file = <string>,
ssl_ciphers = <string>,
ssl_key_file = <string>,
ssl_password = <string>,
ssl_password_file = <string>,
},
}
If the URI can't be determied, This format is suitable to directly pass into DescriptionThe idea of the function is to pick up information from flowchart TD
lookup_uri{"iproto.advertise.<uri_type>.uri"}
set_advertise_uri_params["res.uri = iproto.advertise.<uri_type>.uri\nres.params = iproto.advertise.<uri_type>.params"]
set_listen_uri_params["res.uri = iproto.listen[i].uri\nres.params = iproto.listen[i].params"]
i_0[i = 0]
incr[i = i + 1]
has_next{"i < len(iproto.listen)"}
set_nil["res = nil"]
is_not_suitable{"parse(iproto.listen[i]).ipv4 == '0.0.0.0' ||\nparse(iproto.listen[i]).ipv6 == '::' ||\nparse(iproto.listen[i]).service == '0'"}
has_login{"iproto.advertise.<uri_type>.login"}
set_login[res.login = iproto.advertise.<uri_type>.login]
has_password{"iproto.advertise.<uri_type>.password"}
set_password["res.password = iproto.advertise.<uri_type>.password"]
dont_need_password{"res.login == 'guest'"}
has_credentials_password{"credentials.users.<res.login>.password"}
set_credentials_password["res.password = credentials.users.<res.login>.password"]
return_0((return))
return_1((return))
return_2((return))
return_3((return))
return_4((return))
return_5((return))
style set_advertise_uri_params text-align:left
style set_listen_uri_params text-align:left
style is_not_suitable text-align:left
lookup_uri -- exists --> set_advertise_uri_params
lookup_uri -- missed --> i_0
i_0 --> has_next
has_next -- yes --> is_not_suitable
is_not_suitable -- no --> set_listen_uri_params
is_not_suitable -- yes --> incr
incr --> has_next
has_next -- no --> set_nil
set_nil --> return_0
set_advertise_uri_params --> has_login
set_listen_uri_params --> has_login
has_login -- missed --> return_1
has_login -- exists --> set_login
set_login --> has_password
has_password -- exists --> set_password
has_password -- missed --> dont_need_password
set_password --> return_2
dont_need_password -- yes --> return_3
dont_need_password -- no --> has_credentials_password
has_credentials_password -- exists --> set_credentials_password
has_credentials_password -- missed --> return_4
set_credentials_password --> return_5
Let's define If If If the steps above can't find a suitable URI, If If Footnotes
|
Related dev. issue(s): tarantool/tarantool#9842
Product: Tarantool
Since: 3.1
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/config/
SME: @ ImeevMA
Details
The configuration module's
instance_uri()
method returns the URI ofthe instance that is used to create a replicaset or sharding cluster.
This method takes two arguments:
peer
or null to return the URI that is used to create thereplicaset, or
sharding
to return the URI that is used to createthe sharding cluster;
options
, which only supportoptions.instance
, to specify theinstance whose URI should be returned; by default, the URI of the
instance on which the function is executed is returned.
Requested by @ ImeevMA in tarantool/tarantool@1826ca7.
The text was updated successfully, but these errors were encountered: