Struct tarantool::net_box::Conn

source ·
pub struct Conn { /* private fields */ }
Expand description

Connection to remote Tarantool server

Implementations§

source§

impl Conn

source

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

source

pub fn wait_connected(&self, timeout: Option<Duration>) -> Result<bool, Error>

Wait for connection to be active or closed.

Returns:

  • Ok(true): if active
  • Ok(true): if closed
  • Err(...TimedOut...): on timeout
source

pub fn is_connected(&self) -> bool

Show whether connection is active or closed.

source

pub fn close(&self)

Close a connection.

source

pub fn ping(&self, options: &Options) -> Result<(), Error>

Execute a PING command.

  • options – the supported option is timeout
source

pub fn call<T>( &self, function_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.

source

pub fn call_async<A, R>(&self, func: &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.

source

pub fn eval<T>( &self, expression: &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.

source

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.

source

pub fn space(&self, name: &str) -> Result<Option<RemoteSpace>, Error>

Search space by name on remote server

source

pub fn execute<P>( &self, sql: &str, bind_params: &P, options: &Options ) -> Result<Vec<Tuple>, Error>
where P: ToTupleBuffer + ?Sized,

Remote execute of sql query.

Trait Implementations§

source§

impl Drop for Conn

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Conn

§

impl !Send for Conn

§

impl !Sync for Conn

§

impl Unpin for Conn

§

impl !UnwindSafe for Conn

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.