Crate exar [−] [src]
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); }
Macros
| tab_separated! |
Generates a tab separated string from a list of string slices |
Structs
| Collection |
Exar DB's collection of events, containing the reference to the log and index files. |
| CollectionConfig |
Exar DB's collection configuration. |
| Connection |
Exar DB's database connection, which contains a reference to a collection wrapped into an Arc/Mutex. It allows publishing and subscribing to the underling collection of events. |
| Database |
Exar DB's main component, containing the database configuration and the references to the collections of events created. It is used to create new connections. |
| DatabaseConfig |
Exar DB's configuration. |
| Event |
Exar DB's event. |
| EventStream |
Exar DB's event stream. |
| Interval |
An interval. |
| Log |
Exar DB's log file abstraction. |
| Logger |
Exar DB's event logger. |
| PartialCollectionConfig |
Exar DB's partial collection configuration. Holds overrides for the main database configuration. |
| PartialScannersConfig |
Exar DB's partial scanners configuration. Holds overrides for the main database configuration. |
| Query |
Exar DB's subscription query. |
| Scanner |
Exar DB's log file scanner. |
| ScannerThread |
Exar DB's log file scanner thread. |
| ScannersConfig |
Exar DB's scanners configuration. |
| Subscription |
Exar DB's subscription. |
| TabSeparatedParser |
A parser for tab-separated strings |
| ValidationError |
A validation error. |
Enums
| DatabaseError |
A list specifying categories of database error. |
| EventStreamError |
A list specifying categories of event stream error. |
| EventStreamMessage |
Exar DB's event stream message. |
| ParseError |
A list specifying categories of parse error. |
| RoutingStrategy |
A list specifying categories of routing strategy. |
| ScannerAction |
Traits
| FromTabSeparatedStr |
A trait for deserializing a type from a tab-separated string slice. |
| Merge |
A trait for merging a type. |
| ToTabSeparatedString |
A trait for serializing a type to a tab-separated string. |
| Validation |
A trait for validating a type. |
| WriteLine |
A trait for writing a line into a stream. |