<div align="center">

<h1>iotdb-rs</h1>
<h3>(WIP) Apache IotDB Client written in Rust</h3>
[](https://crates.io/crates/iotdb)
[](https://docs.rs/iotdb)
[](https://crates.io/crates/iotdb)
[](https://github.com/francis-du/iotdb-rs/blob/main/LICENSE)
[](https://github.com/francis-du/iotdb-rs/actions?query=workflow%3Acargo-test)
[](https://github.com/francis-du/iotdb-rs/actions?query=workflow%3Acargo-publish)
</div>
---
## Overview
IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific
services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable
features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of
massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.
## How to use
Add `iotdb` to your `Cargo.toml`
```toml
[dependencies]
iotdb = "0.0.4"
```
## Example
```rust
use thrift::Error;
use iotdb::common::{Compressor, DataType, Encoding};
use iotdb::{Config, Session};
fn main() -> Result<(), Error> {
let config = Config::new()
.endpoint("127.0.0.1", "6667")
.user("root")
.password("root")
.zone_id("UTC+8")
// .log_level("debug")
.build();
// open session
let mut session = Session::new(config).open()?;
session.sql("SHOW STORAGE GROUP")?.show();
// session.set_storage_group("root.ln")?;
session.create_time_series(
"root.ln.wf01.wt01.temperature",
DataType::INT64,
Encoding::default(),
Compressor::default(),
)?;
session.create_time_series(
"root.ln.wf01.wt01.humidity",
DataType::INT64,
Encoding::default(),
Compressor::default(),
)?;
session.sql("SHOW TIMESERIES root.ln")?.show();
session.sql("select * from root.ln")?.show();
session.close()?;
Ok(())
}
```
## Run example
1. Download the package from [here](https://archive.apache.org/dist/iotdb)
```shell
curl -O https://archive.apache.org/dist/iotdb/0.11.2/apache-iotdb-0.11.2-bin.zip
```
2. Install and start iotdb server
```shell
cd $IOTDB_HOME && sbin/start-server -c conf -rpc_port 6667
```
3. Install rust toolchain form [here](https://www.rust-lang.org/tools/install)
```shell
4.Run example
```shell
git clone https://github.com/francis-du/iotdb-rs.git
cargo run --example main
```
## LICENSE
[Apache License 2.0](LICENSE)