#timeseries #database #protocol

sonnerie-api

A client api to Sonnerie, a timeseries database

9 unstable releases (3 breaking)

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

#145 in Database interfaces

Download history 5/week @ 2019-01-16 5/week @ 2019-01-23 1/week @ 2019-01-30 1/week @ 2019-02-06 1/week @ 2019-02-13 13/week @ 2019-02-20 19/week @ 2019-02-27 11/week @ 2019-03-06 1/week @ 2019-03-13 33/week @ 2019-03-20 10/week @ 2019-03-27 9/week @ 2019-04-03 4/week @ 2019-04-10 1/week @ 2019-04-17 11/week @ 2019-04-24

63 downloads per month
Used in 1 crate

BSD-2-Clause

46KB
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
~15K SLoC