[−][src]Struct rusty_tarantool::tarantool::Client
API to tarantool.
Create client by call build() on ClientConfig.
Examples
let client = ClientConfig::new(addr, "rust", "rust").set_timeout_time_ms(1000).set_reconnect_time_ms(10000).build();
Implementations
impl Client
[src]
pub fn new(config: ClientConfig) -> Client
[src]
manually create client by consume Client Config
pub fn get_status(&self) -> ClientStatus
[src]
return client status
pub fn subscribe_to_notify_stream(
&self
) -> impl Stream<Item = ClientStatus, Error = ()>
[src]
&self
) -> impl Stream<Item = ClientStatus, Error = ()>
return notify stream with connection statuses
pub fn send_command(
&self,
req: CommandPacket
) -> impl Future<Item = TarantoolResponse, Error = Error>
[src]
&self,
req: CommandPacket
) -> impl Future<Item = TarantoolResponse, Error = Error>
send any command you manually create, this method is low level and not intended to be used
pub fn call_fn<T>(
&self,
function: &str,
params: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
[src]
&self,
function: &str,
params: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
call tarantool stored procedure
params mast be serializable to MsgPack tuple by Serde - rust tuple or vector or struct (by default structs serialized as tuple)
order of fields in serializes tuple is order od parameters of procedure
Examples
lua function on tarantool
function test(a,b)
return a,b,11
end
rust code
let resp = client.call_fn("test", &(("aa", "aa"), 1))
.and_then(move |response| {
println!("response2: {:?}", response);
let s: (Vec<String>, Vec<u64>) = response.decode_pair()?;
println!("resp value={:?}", s);
assert_eq!((vec!["aa".to_string(), "aa".to_string()], vec![1]), s);
Ok(())
})
pub fn call_fn1<T1>(
&self,
function: &str,
param1: &T1
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
[src]
&self,
function: &str,
param1: &T1
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
call tarantool stored procedure with one parameter
pub fn call_fn2<T1, T2>(
&self,
function: &str,
param1: &T1,
param2: &T2
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
[src]
&self,
function: &str,
param1: &T1,
param2: &T2
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
call tarantool stored procedure with two parameters
Examples
let response_future = client.call_fn2("test", &("param11", "param12") , &2)
.and_then(|response| {
let res : ((String,String), (u64,), (Option<u64>,)) = response.decode_trio()?;
Ok(res)
}) ;
pub fn call_fn3<T1, T2, T3>(
&self,
function: &str,
param1: &T1,
param2: &T2,
param3: &T3
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
T3: Serialize,
[src]
&self,
function: &str,
param1: &T1,
param2: &T2,
param3: &T3
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
T3: Serialize,
call tarantool stored procedure with three parameters
pub fn call_fn4<T1, T2, T3, T4>(
&self,
function: &str,
param1: &T1,
param2: &T2,
param3: &T3,
param4: &T4
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
T3: Serialize,
T4: Serialize,
[src]
&self,
function: &str,
param1: &T1,
param2: &T2,
param3: &T3,
param4: &T4
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
T3: Serialize,
T4: Serialize,
call tarantool stored procedure with four parameters
pub fn call_fn5<T1, T2, T3, T4, T5>(
&self,
function: &str,
param1: &T1,
param2: &T2,
param3: &T3,
param4: &T4,
param5: &T5
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
T3: Serialize,
T4: Serialize,
T5: Serialize,
[src]
&self,
function: &str,
param1: &T1,
param2: &T2,
param3: &T3,
param4: &T4,
param5: &T5
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T1: Serialize,
T2: Serialize,
T3: Serialize,
T4: Serialize,
T5: Serialize,
call tarantool stored procedure with five parameters
pub fn select<T>(
&self,
space: i32,
index: i32,
key: &T,
offset: i32,
limit: i32,
iterator: i32
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
[src]
&self,
space: i32,
index: i32,
key: &T,
offset: i32,
limit: i32,
iterator: i32
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
call "select" from tarantool
- space - i32 space id
- index - i32 index id
- key - key part used for select, may be sequence (vec or tuple)
- offset - i32 select offset
- limit - i32 limit of rows
- iterator - type of iterator
pub fn insert<T>(
&self,
space: i32,
tuple: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
[src]
&self,
space: i32,
tuple: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
insert tuple to space
- space - space id
- tuple - sequence of fields(can be vec or rust tuple)
pub fn replace<T>(
&self,
space: i32,
tuple: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
[src]
&self,
space: i32,
tuple: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
replace tuple in space by primary key
- space - space id
- tuple - sequence of fields(can be vec or rust tuple)
Examples
let tuple_replace= (3,"test_insert","replace");
client.replace(SPACE_ID, &tuple_replace)
pub fn replace_raw(
&self,
space: i32,
tuple_raw: Vec<u8>
) -> impl Future<Item = TarantoolResponse, Error = Error>
[src]
&self,
space: i32,
tuple_raw: Vec<u8>
) -> impl Future<Item = TarantoolResponse, Error = Error>
replace tuple in space by primary key - raw method if you have already serialized msgpack
- space - space id
- tuple - sequence of fields stored as msgpack
Examples
let tuple_replace= (3,"test_insert","replace");
let raw_buf = serialize_to_vec_u8(&tuple_replace).unwrap();
client.replace_raw(SPACE_ID, raw_buf)
pub fn update<T, T2>(
&self,
space: i32,
key: &T2,
args: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
T2: Serialize,
[src]
&self,
space: i32,
key: &T2,
args: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
T2: Serialize,
update row in tarantool
- space - space id
- key - sequence of fields(rust tuple or vec)
- args - sequence of update operations, for example (('=',2,"test_update"),)
Examples
let tuple= (3,"test_insert");
let update_op= (('=',2,"test_update"),);
client.update(SPACE_ID, &tuple, &update_op)
pub fn upsert<T, T2, T3>(
&self,
space: i32,
key: &T2,
def: &T3,
args: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
T2: Serialize,
T3: Serialize,
[src]
&self,
space: i32,
key: &T2,
def: &T3,
args: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
T2: Serialize,
T3: Serialize,
upsert row in tuple
Examples
let key= (4,"test_upsert");
let update_op= (('=',2,"test_update_upsert"),);
client.upsert(SPACE_ID,&key, &key,&update_op)
pub fn delete<T>(
&self,
space: i32,
key: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
[src]
&self,
space: i32,
key: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
pub fn eval<T>(
&self,
expression: String,
args: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
[src]
&self,
expression: String,
args: &T
) -> impl Future<Item = TarantoolResponse, Error = Error> where
T: Serialize,
pub fn ping(&self) -> impl Future<Item = TarantoolResponse, Error = Error>
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl !UnwindSafe for Client
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,