1 unstable release
Uses old Rust 2015
0.1.0 | Aug 1, 2016 |
---|
#3 in #exar-db
Used in 4 crates
105KB
2K
SLoC
Exar DB's Core
An event store with streaming support, it uses flat-file based collections.
lib.rs
:
Exar DB
Exar DB is an event store with streaming support which uses a flat-file for each collection of events
Database Initialization
extern crate exar;
use exar::*;
let config = DatabaseConfig::default();
let mut db = Database::new(config);
Publishing events
extern crate exar;
use exar::*;
let config = DatabaseConfig::default();
let mut db = Database::new(config);
let collection_name = "test";
let connection = db.connect(collection_name).unwrap();
match connection.publish(Event::new("payload", vec!["tag1", "tag2"])) {
Ok(event_id) => println!("Published event with ID: {}", event_id),
Err(err) => panic!("Unable to publish event: {}", err)
};
Querying events
extern crate exar;
use exar::*;
let config = DatabaseConfig::default();
let mut db = Database::new(config);
let collection_name = "test";
let connection = db.connect(collection_name).unwrap();
let query = Query::live().offset(0).limit(10).by_tag("tag1");
let event_stream = connection.subscribe(query).unwrap();
for event in event_stream {
println!("Received event: {}", event);
}
Dependencies
~1.1–1.7MB
~30K SLoC