pub struct Session { /* private fields */ }
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(
client: TSIServiceSyncClient<Box<dyn TInputProtocol>, Box<dyn TOutputProtocol>>,
) -> Session
pub fn new( client: TSIServiceSyncClient<Box<dyn TInputProtocol>, Box<dyn TOutputProtocol>>, ) -> Session
Examples found in repository?
examples/main.rs (line 16)
8fn main() -> Result<(), Error> {
9 // create client 4 ways
10 // let client = Client::new("localhost", "6667").create();
11 // let client = Client::new("localhost", "6667").enable_rpc_compaction().create();
12 // let client = Client::default().enable_rpc_compaction().create()?;
13 let client = Client::default().create()?;
14
15 // open a session
16 let mut session = Session::new(client);
17
18 // config session
19 let mut config_map = HashMap::new();
20 config_map.insert("", "");
21
22 // session
23 // .user("root")
24 // .password("root")
25 // .fetch_size(2048)
26 // .zone_id("UTC+8")
27 // .config("", "")
28 // .config_map(config_map)
29 // .open()?;
30
31 // using default config
32 session.open()?;
33
34 let res = session.query("SHOW TIMESERIES root")?;
35 println!("{:#?}", res);
36 pretty::result_set(res);
37
38 session.close()?;
39
40 Ok(())
41}
pub fn user(&mut self, user: &str) -> &mut Session
pub fn password(&mut self, password: &str) -> &mut Session
pub fn zone_id(&mut self, zone_id: &str) -> &mut Session
pub fn fetch_size(&mut self, fetch_size: i32) -> &mut Session
pub fn protocol_version(&mut self, user: &str) -> &mut Session
pub fn config(&mut self, key: &str, value: &str) -> &mut Session
pub fn config_map(&mut self, map: HashMap<&str, &str>) -> &mut Session
pub fn is_success(&self, status: &TSStatus) -> bool
Sourcepub fn open(&mut self) -> Result<&mut Session>
pub fn open(&mut self) -> Result<&mut Session>
Examples found in repository?
examples/main.rs (line 32)
8fn main() -> Result<(), Error> {
9 // create client 4 ways
10 // let client = Client::new("localhost", "6667").create();
11 // let client = Client::new("localhost", "6667").enable_rpc_compaction().create();
12 // let client = Client::default().enable_rpc_compaction().create()?;
13 let client = Client::default().create()?;
14
15 // open a session
16 let mut session = Session::new(client);
17
18 // config session
19 let mut config_map = HashMap::new();
20 config_map.insert("", "");
21
22 // session
23 // .user("root")
24 // .password("root")
25 // .fetch_size(2048)
26 // .zone_id("UTC+8")
27 // .config("", "")
28 // .config_map(config_map)
29 // .open()?;
30
31 // using default config
32 session.open()?;
33
34 let res = session.query("SHOW TIMESERIES root")?;
35 println!("{:#?}", res);
36 pretty::result_set(res);
37
38 session.close()?;
39
40 Ok(())
41}
pub fn is_open(&self) -> bool
Sourcepub fn close(&mut self) -> Result<()>
pub fn close(&mut self) -> Result<()>
Examples found in repository?
examples/main.rs (line 38)
8fn main() -> Result<(), Error> {
9 // create client 4 ways
10 // let client = Client::new("localhost", "6667").create();
11 // let client = Client::new("localhost", "6667").enable_rpc_compaction().create();
12 // let client = Client::default().enable_rpc_compaction().create()?;
13 let client = Client::default().create()?;
14
15 // open a session
16 let mut session = Session::new(client);
17
18 // config session
19 let mut config_map = HashMap::new();
20 config_map.insert("", "");
21
22 // session
23 // .user("root")
24 // .password("root")
25 // .fetch_size(2048)
26 // .zone_id("UTC+8")
27 // .config("", "")
28 // .config_map(config_map)
29 // .open()?;
30
31 // using default config
32 session.open()?;
33
34 let res = session.query("SHOW TIMESERIES root")?;
35 println!("{:#?}", res);
36 pretty::result_set(res);
37
38 session.close()?;
39
40 Ok(())
41}
Sourcepub fn set_storage_group(&mut self, storage_group: &str) -> Result<()>
pub fn set_storage_group(&mut self, storage_group: &str) -> Result<()>
Set a storage group
Sourcepub fn delete_storage_group(&mut self, storage_group: &str) -> Result<()>
pub fn delete_storage_group(&mut self, storage_group: &str) -> Result<()>
Delete a storage group.
Sourcepub fn delete_storage_groups(
&mut self,
storage_groups: Vec<String>,
) -> Result<()>
pub fn delete_storage_groups( &mut self, storage_groups: Vec<String>, ) -> Result<()>
Delete storage groups.
Sourcepub fn create_time_series(
&mut self,
ts_path: String,
data_type: i32,
encoding: i32,
compressor: i32,
) -> Result<()>
pub fn create_time_series( &mut self, ts_path: String, data_type: i32, encoding: i32, compressor: i32, ) -> Result<()>
Create single time-series
Sourcepub fn create_multi_time_series(
&mut self,
ts_path_vec: Vec<String>,
data_type_vec: Vec<i32>,
encoding_vec: Vec<i32>,
compressor_vec: Vec<i32>,
) -> Result<()>
pub fn create_multi_time_series( &mut self, ts_path_vec: Vec<String>, data_type_vec: Vec<i32>, encoding_vec: Vec<i32>, compressor_vec: Vec<i32>, ) -> Result<()>
Create multiple time-series
Sourcepub fn delete_time_series(&mut self, path_vec: Vec<String>) -> Result<()>
pub fn delete_time_series(&mut self, path_vec: Vec<String>) -> Result<()>
Delete multiple time series
Sourcepub fn check_time_series_exist(&mut self, path: &str)
pub fn check_time_series_exist(&mut self, path: &str)
Check whether a specific time-series exists
Sourcepub fn delete_data(
&mut self,
path_vec: Vec<String>,
timestamp: i64,
) -> Result<()>
pub fn delete_data( &mut self, path_vec: Vec<String>, timestamp: i64, ) -> Result<()>
Delete all data <= time in multiple time-series
Sourcepub fn insert_string_records(
&mut self,
device_ids: Vec<String>,
measurements_list: Vec<Vec<String>>,
values_list: Vec<Vec<String>>,
timestamps: Vec<i64>,
) -> Result<TSStatus>
pub fn insert_string_records( &mut self, device_ids: Vec<String>, measurements_list: Vec<Vec<String>>, values_list: Vec<Vec<String>>, timestamps: Vec<i64>, ) -> Result<TSStatus>
Insert string records
Sourcepub fn insert_record(
&mut self,
device_id: String,
measurements: Vec<String>,
values: Vec<u8>,
timestamp: i64,
) -> Result<TSStatus>
pub fn insert_record( &mut self, device_id: String, measurements: Vec<String>, values: Vec<u8>, timestamp: i64, ) -> Result<TSStatus>
Insert record
Sourcepub fn insert_records(
&mut self,
device_ids: Vec<String>,
measurements_list: Vec<Vec<String>>,
values_list: Vec<Vec<u8>>,
timestamps: Vec<i64>,
) -> Result<TSStatus>
pub fn insert_records( &mut self, device_ids: Vec<String>, measurements_list: Vec<Vec<String>>, values_list: Vec<Vec<u8>>, timestamps: Vec<i64>, ) -> Result<TSStatus>
Insert records
Sourcepub fn insert_records_of_one_device(
&mut self,
device_id: String,
measurements_list: Vec<Vec<String>>,
values_list: Vec<Vec<u8>>,
timestamps: Vec<i64>,
) -> Result<TSStatus>
pub fn insert_records_of_one_device( &mut self, device_id: String, measurements_list: Vec<Vec<String>>, values_list: Vec<Vec<u8>>, timestamps: Vec<i64>, ) -> Result<TSStatus>
Insert records of one device
Sourcepub fn insert_tablet(
&mut self,
device_id: String,
measurements: Vec<String>,
values: Vec<u8>,
timestamps: Vec<u8>,
types: Vec<i32>,
size: i32,
) -> Result<TSStatus>
pub fn insert_tablet( &mut self, device_id: String, measurements: Vec<String>, values: Vec<u8>, timestamps: Vec<u8>, types: Vec<i32>, size: i32, ) -> Result<TSStatus>
Insert tablet
Sourcepub fn insert_tablets(
&mut self,
device_ids: Vec<String>,
measurements_list: Vec<Vec<String>>,
values_list: Vec<Vec<u8>>,
timestamps_list: Vec<Vec<u8>>,
types_list: Vec<Vec<i32>>,
size_list: Vec<i32>,
) -> Result<TSStatus>
pub fn insert_tablets( &mut self, device_ids: Vec<String>, measurements_list: Vec<Vec<String>>, values_list: Vec<Vec<u8>>, timestamps_list: Vec<Vec<u8>>, types_list: Vec<Vec<i32>>, size_list: Vec<i32>, ) -> Result<TSStatus>
Insert tablets
Sourcepub fn set_time_zone(&mut self, time_zone: &str) -> Result<()>
pub fn set_time_zone(&mut self, time_zone: &str) -> Result<()>
Set time zone
Sourcepub fn query(&mut self, sql: &str) -> Result<TSExecuteStatementResp>
pub fn query(&mut self, sql: &str) -> Result<TSExecuteStatementResp>
Examples found in repository?
examples/main.rs (line 34)
8fn main() -> Result<(), Error> {
9 // create client 4 ways
10 // let client = Client::new("localhost", "6667").create();
11 // let client = Client::new("localhost", "6667").enable_rpc_compaction().create();
12 // let client = Client::default().enable_rpc_compaction().create()?;
13 let client = Client::default().create()?;
14
15 // open a session
16 let mut session = Session::new(client);
17
18 // config session
19 let mut config_map = HashMap::new();
20 config_map.insert("", "");
21
22 // session
23 // .user("root")
24 // .password("root")
25 // .fetch_size(2048)
26 // .zone_id("UTC+8")
27 // .config("", "")
28 // .config_map(config_map)
29 // .open()?;
30
31 // using default config
32 session.open()?;
33
34 let res = session.query("SHOW TIMESERIES root")?;
35 println!("{:#?}", res);
36 pretty::result_set(res);
37
38 session.close()?;
39
40 Ok(())
41}
Sourcepub fn get_time_zone(&mut self) -> Result<String>
pub fn get_time_zone(&mut self) -> Result<String>
Get time zone
Sourcepub fn get_properties(&mut self) -> Result<ServerProperties>
pub fn get_properties(&mut self) -> Result<ServerProperties>
Get properties
Sourcepub fn cancel_operation(&mut self, query_id: i64) -> Result<TSStatus>
pub fn cancel_operation(&mut self, query_id: i64) -> Result<TSStatus>
Cancel operation
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl !Send for Session
impl !Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more