common.rs 733 B

12345678910111213141516171819202122232425262728
  1. #![allow(dead_code)]
  2. pub use sonic_channel::*;
  3. pub const HOST: &str = "localhost:36999";
  4. pub const PASS: &str = "SecretPassword1234";
  5. pub fn ingest_start() -> IngestChannel {
  6. IngestChannel::start(HOST, PASS).expect("The Sonic server must be running")
  7. }
  8. pub fn search_start() -> SearchChannel {
  9. SearchChannel::start(HOST, PASS).expect("The Sonic server must be running")
  10. }
  11. pub fn control_start() -> ControlChannel {
  12. ControlChannel::start(HOST, PASS).expect("The Sonic server must be running")
  13. }
  14. pub fn consolidate() {
  15. control_start().consolidate().unwrap();
  16. }
  17. pub fn flush_bucket(collection: &str, bucket: &str) {
  18. ingest_start()
  19. .flush(FlushRequest::bucket(collection, bucket))
  20. .unwrap();
  21. }