Import channel scan code into retrieval-rs

This commit is contained in:
Dominik Werder
2021-05-31 12:31:35 +02:00
parent 0ad59af010
commit fc81763737
14 changed files with 841 additions and 337 deletions

View File

@@ -1,10 +1,24 @@
use err::Error;
use netpod::log::*;
use netpod::{Channel, NodeConfigCached};
use std::time::Duration;
use tokio_postgres::{Client, NoTls};
pub mod scan;
pub mod search;
pub async fn delay_us(mu: u64) {
tokio::time::sleep(Duration::from_micros(mu)).await;
}
pub async fn delay_io_short() {
delay_us(1000).await;
}
pub async fn delay_io_medium() {
delay_us(2000).await;
}
pub async fn create_connection(node_config: &NodeConfigCached) -> Result<Client, Error> {
let d = &node_config.node_config.cluster.database;
let uri = format!("postgresql://{}:{}@{}:{}/{}", d.user, d.pass, d.host, 5432, d.name);