Implementation Status:
-
Binary Encoding
-
Json Encoding
-
Writer interface
- Primitives - null, boolean, int, long, float, byte, double, string
- Complex - Records (support recursive types in its fields is in the works), Enums, Arrays, Maps. TODO(unions, fixed)
-
Supported codecs:
null
,deflate
,snappy
are all supported. -
Reader interface (Implementation is on hold until Writer API and performance stability.)
-
RPC related implementations.
Getting Started
Add the following dependency to your Cargo manifest...
[dependencies]
ravro = { git = "https://github.com/AtherEnergy/ravro" }
// test example taken from `/tests/primitive.rs`
let schema_file = "tests/schemas/bool_schema.avsc";
let bool_schema = AvroSchema::from_file(schema_file).unwrap();
let datafile_name = "tests/encoded/bool_encoded.avro";
let mut data_writer = DataWriter::new(bool_schema, Codec::Deflate).unwrap();
let _ = data_writer.write(true);
let _ = data_writer.write(false);
let avro_encoded_buffer: Vec<u8> = data_writer.take_datafile().unwrap();
// `avro_encoded_buffer` can now be write to file or streamed over RPC
We currently use avro-tools.jar to get .avro
data
output and assert against it. This is until we implement decoding of .avro
files.
So the tool needs to be downloaded for tests to run.
To install the tool issue: ./install_test_util.sh
and then run:
cargo test
to run the test suite.
ravro
is licensed under the terms of the MIT License or the Apache License 2.0, at your choosing.
Code of Conduct
Contribution to the ravro
crate is organized under the terms of the Contributor Covenant, the maintainer of ravro, @creativcoder, promises to intervene to uphold that code of conduct.