Ingest swissfel ca until before electric test

This commit is contained in:
Dominik Werder
2023-01-06 16:09:25 +01:00
parent ec205ee9df
commit a5c927538e
7 changed files with 179 additions and 36 deletions
-4
View File
@@ -45,7 +45,6 @@ struct SearchBatch {
#[derive(Debug)]
pub struct FindIocRes {
pub channel: String,
pub query_addr: Option<SocketAddrV4>,
pub response_addr: Option<SocketAddrV4>,
pub addr: Option<SocketAddrV4>,
pub dt: Duration,
@@ -392,8 +391,6 @@ impl FindIocStream {
let dt = tsnow.saturating_duration_since(batch.ts_beg);
let res = FindIocRes {
channel: ch.into(),
// TODO associate a batch with a specific query address.
query_addr: None,
response_addr: Some(src.clone()),
addr: Some(addr),
dt,
@@ -463,7 +460,6 @@ impl FindIocStream {
}
for ((sid, ch), dt) in sids.into_iter().zip(chns).zip(dts) {
let res = FindIocRes {
query_addr: None,
response_addr: None,
channel: ch,
addr: None,
+3 -7
View File
@@ -60,8 +60,8 @@ pub async fn ca_search(opts: CaIngestOpts, channels: &Vec<String>) -> Result<(),
const TEXT: tokio_postgres::types::Type = tokio_postgres::types::Type::TEXT;
pg_client
.prepare_typed(
"insert into ioc_by_channel_log (facility, channel, queryaddr, responseaddr, addr) values ($1, $2, $3, $4, $5)",
&[TEXT, TEXT, TEXT, TEXT, TEXT],
"insert into ioc_by_channel_log (facility, channel, responseaddr, addr) values ($1, $2, $3, $4)",
&[TEXT, TEXT, TEXT, TEXT],
)
.await
.unwrap()
@@ -154,14 +154,10 @@ pub async fn ca_search(opts: CaIngestOpts, channels: &Vec<String>) -> Result<(),
if do_block {
info!("blacklisting {item:?}");
} else {
let queryaddr = item.query_addr.map(|x| x.to_string());
let responseaddr = item.response_addr.map(|x| x.to_string());
let addr = item.addr.map(|x| x.to_string());
pg_client
.execute(
&qu_insert,
&[&opts.backend(), &item.channel, &queryaddr, &responseaddr, &addr],
)
.execute(&qu_insert, &[&opts.backend(), &item.channel, &responseaddr, &addr])
.await
.unwrap();
}