use std::time::Duration;
use tokio::time::sleep;
use detcd::client::Builder;
use detcd::history::{History, HistoryType};
use detector::{Meta, MetaKey};
#[tokio::main]
async fn main() {
println!("{:?}", run1().await);
}
async fn run1() -> Result<(), detcd::Error> {
let client = Builder::new().build(&["localhost:2379"]).await?;
let mut history = History::<Meta, MetaKey>::new(client, HistoryType::Metas("default".to_string()));
loop {
match history.event().await {
Ok(e) => println!("{:?}", e),
Err(old) => {
println!("olds: {:?}", old);
sleep(Duration::from_secs(3)).await;
}
}
}
}