Crates.io | tsfile-writer |
lib.rs | tsfile-writer |
version | 0.2.1 |
source | src |
created_at | 2022-06-16 15:41:22.962964 |
updated_at | 2022-07-06 12:55:46.971403 |
description | A simple TsFile writer in rust with a sync sender to import tsfiles to Apache IoTDB instances |
homepage | |
repository | https://github.com/JulianFeinauer/tsfile-rust/tree/main/tsfile-writer |
max_upload_size | |
id | 607522 |
size | 254,689 |
This is a not yet feature complete Writer for TsFiles Version 3 (as defined from the Apache IoTDB Project). Currently not all features of TsFiles are supported. Most notably:
But generally, the TsFiles written with this client are 100% compatible with TsFiles written in Java.
To write a TsFile just do something like
// Create the Schema
// Two devices with two sensors each
let schema = TsFileSchemaBuilder::new()
.add(
"d1",
DeviceBuilder::new()
.add(
"s1",
TSDataType::INT64,
TSEncoding::PLAIN,
CompressionType::UNCOMPRESSED,
)
.add(
"s2",
TSDataType::FLOAT,
TSEncoding::PLAIN,
CompressionType::UNCOMPRESSED,
)
.build(),
)
.add(
"d2",
DeviceBuilder::new()
.add(
"s1",
TSDataType::INT64,
TSEncoding::PLAIN,
CompressionType::UNCOMPRESSED,
)
.add(
"s2",
TSDataType::FLOAT,
TSEncoding::PLAIN,
CompressionType::UNCOMPRESSED,
)
.build(),
)
.build();
// Create the writer
let mut writer = TsFileWriter::new(
"target/benchmark2.tsfile",
schema,
Default::default(),
)
.unwrap();
// Write multiple timeseries at once
writer.write_many("d1",1, vec![
DataPoint::new("s1", IoTDBValue::LONG(i)),
DataPoint::new("s2", IoTDBValue::FLOAT(i as f32)),
]);
// Write single series
writer.write("d2", "s1", 1, IoTDBValue::LONG(i));
writer.write("d2", "s2", 1, IoTDBValue::FLOAT(i as f32));
This is a very simple implementation of a "Sync-Client" for the Apache IoTDB Server.
This means, this tool behaves like an IoTDB Server with start-sync-client.sh
running.
I.e. it will send tsfiles to the respective reveiving server using Apache IoTDBs Sync Protocol.
IntoIterator<Item=DataPoint<'a>>
as argument instead of only Vec<DataPoint<'a>>
sync_sender
)Result<_, TsFileError>
to basically every operation