#time-series-database #time-series #protocols

sonnerie-api

A client api to Sonnerie, a timeseries database

9 unstable releases (3 breaking)

Uses old Rust 2015

0.4.1 Dec 14, 2018
0.4.0 Nov 26, 2018
0.3.0 Oct 20, 2018
0.2.3 Sep 18, 2018
0.1.1 Sep 7, 2018

#43 in #time-series-database

BSD-2-Clause

48KB
1.5K SLoC

This library serves as an API frontend to sonnerie.

Refer to that crate for more information.

As this crate provides a Rust API for Sonnerie, it is also documented.


lib.rs:

This is a simple client API for Sonnerie, a timeseries database.

It lets you do a variety of insertions and reads.

Example

extern crate sonnerie_api;
fn main() -> std::io::Result<()>
{
    let stream = std::net::TcpStream::connect("localhost:5599")?;
    let mut client = sonnerie_api::Client::new(stream)?;
    // read a series (a read transaction is automatically created and closed)
    // start a write transaction
    client.begin_write()?;
    client.create_series("fibonacci", "u")?;
    client.add_value(
        "fibonacci",
        &"2018-01-06T00:00:00".parse().unwrap(),
        13.0,
    )?;
    let results: Vec<(sonnerie_api::NaiveDateTime, Vec<sonnerie_api::OwnedColumn>)> =
        client.read_series("fibonacci")?;
    for row in &results
    {
        // interpret each column as an integer
        for col in &row.1 { let _: u32 = col.from(); }
    }
    // save the transaction
    client.commit()?;
    Ok(())
}

Dependencies

~1MB
~19K SLoC