Crates.io | lightstream |
lib.rs | lightstream |
version | 0.1.0 |
created_at | 2025-09-04 00:29:35.980836+00 |
updated_at | 2025-09-04 00:29:35.980836+00 |
description | Composable, zero-copy Arrow IPC and native data streaming for Rust with SIMD-aligned I/O, async support, and memory-mapping. |
homepage | |
repository | |
max_upload_size | |
id | 1823412 |
size | 1,511,842 |
When building high-performance, full-stack, data-driven applications, I repeatedly hit the same barriers.
I wanted a crate that would:
Lightstream is the result: an extension to Minarrow that adds native streaming and I/O. It enables raw bytestream construction, reading and writing IPC and TLV formats, CSV/Parquet writers, and a high-performance 64-byte SIMD memory-mapped IPC reader.
Bypassing library machinery and going straight to the wire
Streaming Arrow IPC tables over network sockets with zero-copy buffers
Defining custom binary transport protocols
Zero-copy ingestion with mmap for ultra-fast analytics
Control data alignment at source - SIMD-aligned Arrow IPC writers/readers
Async data pipelines with backpressure-aware sinks and streams
Building custom data transport layers and transfer protocols
Lightstream provides composable building blocks for high-performance data I/O in Rust:
Vec64
ensures deterministic SIMD without hot-loop re-allocations.Layer | Provided by Lightstream | Replaceable |
---|---|---|
Framing | TlvFrame , IpcMessage |
✅ |
Buffering | StreamBuffer |
✅ |
Encoding/Decoding | FrameEncoder , FrameDecoder |
✅ |
Streaming | GenByteStream , Sink |
✅ |
Formats | IPC, Parquet, CSV, TLV | ✅ |
Each layer is trait-based with a reference implementation. Swap in your own framing, buffering, or encoding logic without re-implementing the stack.
use lightstream::models::streams::framed_byte_stream::FramedByteStream; use lightstream::models::decoders::ipc::table_stream::TableStreamDecoder; use lightstream::models::readers::ipc::table_stream_reader::TableStreamReader;
let framed = FramedByteStream::new(socket, TableStreamDecoder::default()); let mut reader = TableStreamReader::new(framed);
while let Some(table) = reader.next_table().await? { println!("Received table: {:?}", table.name); }
pub struct MyFramer;
impl FrameDecoder for MyFramer {
type Frame = Vec
let stream = FramedByteStream::new(socket, MyFramer);
use minarrow::{arr_i32, arr_str32, FieldArray, Table}; use lightstream::io::table_writer::TableWriter; use lightstream::enums::IPCMessageProtocol; use tokio::fs::File;
#[tokio::main] async fn main() -> std::io::Result<()> { let col1 = FieldArray::from_inner("numbers", arr_i32![1, 2, 3]); let col2 = FieldArray::from_inner("letters", arr_str32!["x", "y", "z"]); let table = Table::new("demo".into(), vec![col1, col2].into());
let file = File::create("demo.arrow").await?;
let schema = table.schema().to_vec();
let mut writer = TableWriter::new(file, schema, IPCMessageProtocol::File)?;
writer.write_table(table).await?;
writer.finish().await?;
Ok(())
}
parquet
– Parquet writermmap
– Memory-mapped fileszstd
– Zstd compression (IPC + Parquet)snappy
– Snappy compression (IPC + Parquet)This project is licensed under the MIT Licence. See the LICENCE
file for full terms, and THIRD_PARTY_LICENSES
for Apache-licensed dependencies.
This project is not affiliated with Apache Arrow or the Apache Software Foundation.
It serialises the public Arrow format via a custom implementation (Minarrow), while reusing Flatbuffers schemas from Arrow-RS for schema type generation.