pub struct Conn { /* private fields */ }Expand description
Connection to remote Tarantool server
Implementations§
Source§impl Conn
impl Conn
Sourcepub fn new(
addr: impl ToSocketAddrs,
options: ConnOptions,
triggers: Option<Rc<dyn ConnTriggers>>,
) -> Result<Self, Error>
pub fn new( addr: impl ToSocketAddrs, options: ConnOptions, triggers: Option<Rc<dyn ConnTriggers>>, ) -> Result<Self, Error>
Create a new connection.
The connection is established on demand, at the time of the first request. It can be re-established automatically after a disconnect (see reconnect_after option). The returned conn object supports methods for making remote requests, such as select, update or delete.
See also: ConnOptions
Sourcepub fn wait_connected(&self, timeout: Option<Duration>) -> Result<bool, Error>
pub fn wait_connected(&self, timeout: Option<Duration>) -> Result<bool, Error>
Wait for connection to be active or closed.
Returns:
Ok(true): if activeOk(true): if closedErr(...TimedOut...): on timeout
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Show whether connection is active or closed.
Sourcepub fn ping(&self, options: &Options) -> Result<(), Error>
pub fn ping(&self, options: &Options) -> Result<(), Error>
Execute a PING command.
options– the supported option istimeout
Sourcepub fn call<T>(
&self,
fn_name: &str,
args: &T,
options: &Options,
) -> Result<Option<Tuple>, Error>where
T: ToTupleBuffer + ?Sized,
pub fn call<T>(
&self,
fn_name: &str,
args: &T,
options: &Options,
) -> Result<Option<Tuple>, Error>where
T: ToTupleBuffer + ?Sized,
Call a remote stored procedure.
conn.call("func", &("1", "2", "3")) is the remote-call equivalent of func('1', '2', '3').
That is, conn.call is a remote stored-procedure call.
The return from conn.call is whatever the function returns.
Sourcepub fn call_async<A, R>(&self, fn_name: &str, args: A) -> Result<Promise<R>>where
A: ToTupleBuffer,
R: for<'de> Decode<'de> + 'static,
pub fn call_async<A, R>(&self, fn_name: &str, args: A) -> Result<Promise<R>>where
A: ToTupleBuffer,
R: for<'de> Decode<'de> + 'static,
Call a remote stored procedure without yielding.
If enqueuing a request succeeded a Promise is returned which will be
kept once a response is received.
Sourcepub fn eval<T>(
&self,
expr: &str,
args: &T,
options: &Options,
) -> Result<Option<Tuple>, Error>where
T: ToTupleBuffer + ?Sized,
pub fn eval<T>(
&self,
expr: &str,
args: &T,
options: &Options,
) -> Result<Option<Tuple>, Error>where
T: ToTupleBuffer + ?Sized,
Evaluates and executes the expression in Lua-string, which may be any statement or series of statements.
An execute privilege is required; if the user does not have it, an administrator may grant it with
box.schema.user.grant(username, 'execute', 'universe').
To ensure that the return from eval is whatever the Lua expression returns, begin the Lua-string with the
word return.
Sourcepub fn eval_async<A, R>(&self, expr: &str, args: A) -> Result<Promise<R>>where
A: ToTupleBuffer,
R: for<'de> Decode<'de> + 'static,
pub fn eval_async<A, R>(&self, expr: &str, args: A) -> Result<Promise<R>>where
A: ToTupleBuffer,
R: for<'de> Decode<'de> + 'static,
Executes a series of lua statements on a remote host without yielding.
If enqueuing a request succeeded a Promise is returned which will be
kept once a response is received.