Dmitriy Pleshevskiy
bd08317388
* protocol: extract response type * deps: drop lazy_static and regex * protocol: extract request commands * protocol: create a struct for... ...formatting and parsing sonic protocol * protocol: refac flush command * commands: introduce dest, refac push and count * commands: refac all commands * commands: add convinient methods * doc: add documentation for each new structs * doc: change examples in the readme * commands: implement from trait for count and flush * commands: change pag logic
28 lines
733 B
Rust
28 lines
733 B
Rust
#![allow(dead_code)]
|
|
|
|
pub use sonic_channel::*;
|
|
|
|
pub const HOST: &str = "localhost:36999";
|
|
pub const PASS: &str = "SecretPassword1234";
|
|
|
|
pub fn ingest_start() -> IngestChannel {
|
|
IngestChannel::start(HOST, PASS).expect("The Sonic server must be running")
|
|
}
|
|
|
|
pub fn search_start() -> SearchChannel {
|
|
SearchChannel::start(HOST, PASS).expect("The Sonic server must be running")
|
|
}
|
|
|
|
pub fn control_start() -> ControlChannel {
|
|
ControlChannel::start(HOST, PASS).expect("The Sonic server must be running")
|
|
}
|
|
|
|
pub fn consolidate() {
|
|
control_start().consolidate().unwrap();
|
|
}
|
|
|
|
pub fn flush_bucket(collection: &str, bucket: &str) {
|
|
ingest_start()
|
|
.flush(FlushRequest::bucket(collection, bucket))
|
|
.unwrap();
|
|
}
|