Fix warnings

This commit is contained in:
Dominik Werder
2025-03-07 11:46:51 +01:00
parent ab84858e1b
commit f8b3c1533b
39 changed files with 1208 additions and 886 deletions

View File

@@ -14,7 +14,6 @@ use httpclient::IntoBody;
use httpclient::Requ;
use httpclient::StreamResponse;
use httpclient::ToJsonBody;
use items_2::accounting::AccountingEvents;
use netpod::log::*;
use netpod::req_uri_to_url;
use netpod::ttl::RetentionTime;
@@ -23,7 +22,6 @@ use netpod::NodeConfigCached;
use netpod::ScalarType;
use netpod::Shape;
use netpod::TsMs;
use query::api4::AccountingIngestedBytesQuery;
use query::api4::AccountingToplistQuery;
use scyllaconn::accounting::toplist::UsageData;
use serde::Deserialize;
@@ -57,6 +55,7 @@ impl AccountedIngested {
self.shapes.push(shape);
}
#[allow(unused)]
fn sort_by_counts(&mut self) {
let mut tmp: Vec<_> = self
.counts
@@ -70,6 +69,7 @@ impl AccountedIngested {
self.reorder_by_index_list(&tmp);
}
#[allow(unused)]
fn sort_by_bytes(&mut self) {
let mut tmp: Vec<_> = self.bytes.iter().map(|&x| x).enumerate().map(|(i, x)| (x, i)).collect();
tmp.sort_unstable();
@@ -85,6 +85,7 @@ impl AccountedIngested {
self.shapes = tmp.iter().map(|&x| self.shapes[x].clone()).collect();
}
#[allow(unused)]
fn truncate(&mut self, len: usize) {
self.names.truncate(len);
self.counts.truncate(len);
@@ -273,12 +274,13 @@ async fn fetch_data(
_ncc: &NodeConfigCached,
) -> Result<Toplist, Error> {
let list_len_max = 10000000;
let _ = list_len_max;
if let Some(scyqu) = &shared_res.scyqueue {
let x = scyqu
.accounting_read_ts(rt, ts)
.await
.map_err(|e| Error::with_msg_no_trace(e.to_string()))?;
let mut ret = resolve_usages(x, &shared_res.pgqueue).await?;
let ret = resolve_usages(x, &shared_res.pgqueue).await?;
// ret.dim0.sort_by_bytes();
// ret.dim1.sort_by_bytes();
// ret.dim0.truncate(list_len_max);

View File

@@ -83,7 +83,7 @@ impl EventDataHandler {
.await
.map_err(|_| EventDataError::InternalError)?;
let (evsubq,) = nodenet::conn::events_parse_input_query(frames).map_err(|_| EventDataError::QueryParse)?;
debug!("{:?}", evsubq);
info!("{:?}", evsubq);
let logspan = if evsubq.log_level() == "trace" {
trace!("emit trace span");
tracing::span!(tracing::Level::INFO, "log_span_trace")

View File

@@ -5,6 +5,7 @@ use std::collections::BTreeMap;
use std::sync::Mutex;
use std::time::SystemTime;
#[allow(unused)]
pub struct Dummy(u32);
pub enum CachePortal<V> {

View File

@@ -11,19 +11,13 @@ use quinn::EndpointConfig;
use quinn::Incoming;
use rustls::pki_types::pem::PemObject;
use rustls::server::ProducesTickets;
use std::future::Future;
use std::net::SocketAddr;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Context;
use std::task::Poll;
use std::time::Duration;
use taskrun::tokio;
const EARLY_DATA_MAX: u32 = u32::MAX * 0;
macro_rules! info { ($($arg:expr),*) => ( if true { log::debug!($($arg),*); } ); }
macro_rules! debug { ($($arg:expr),*) => ( if true { log::debug!($($arg),*); } ); }
#[derive(Debug)]
@@ -38,11 +32,11 @@ impl ProducesTickets for TicketerCustom {
60 * 60 * 24
}
fn encrypt(&self, plain: &[u8]) -> Option<Vec<u8>> {
fn encrypt(&self, _plain: &[u8]) -> Option<Vec<u8>> {
todo!()
}
fn decrypt(&self, cipher: &[u8]) -> Option<Vec<u8>> {
fn decrypt(&self, _cipher: &[u8]) -> Option<Vec<u8>> {
todo!()
}
}
@@ -111,6 +105,7 @@ impl Http3Support {
Ok(ret)
}
#[allow(unused)]
async fn new_plain_quic(bind_addr: SocketAddr) -> Result<Self, Error> {
let key = PemObject::from_pem_file("key.pem")?;
let cert = PemObject::from_pem_file("cert.pem")?;
@@ -160,6 +155,7 @@ impl Http3Support {
}
}
#[allow(unused)]
async fn handle_incoming_inner_1(inc: Incoming, addr_remote: SocketAddr) -> Result<(), Error> {
debug!("handle_incoming_inner_1 new incoming {:?}", addr_remote);
let conn1 = inc.accept()?.await?;
@@ -184,6 +180,7 @@ impl Http3Support {
Ok(())
}
#[allow(unused)]
async fn handle_incoming_inner_2(inc: Incoming, addr_remote: SocketAddr) -> Result<(), Error> {
let selfname = "handle_incoming_inner_2";
debug!("{} new incoming {:?}", selfname, addr_remote);

View File

@@ -123,7 +123,8 @@ pub async fn host(ncc: NodeConfigCached, service_version: ServiceVersion) -> Res
}
// let rawjh = taskrun::spawn(nodenet::conn::events_service(node_config.clone()));
let (pgqueue, pgworker) = PgWorker::new(&ncc.node_config.cluster.database).await?;
let pgworker_jh = taskrun::spawn(async move {
// TODO use
let _pgworker_jh = taskrun::spawn(async move {
let x = pgworker.work().await;
match x {
Ok(()) => {}
@@ -143,7 +144,8 @@ pub async fn host(ncc: NodeConfigCached, service_version: ServiceVersion) -> Res
error!("{e}");
RetrievalError::TextError(e.to_string())
})?;
let scylla_worker_jh = taskrun::spawn(async move {
// TODO use
let _scylla_worker_jh = taskrun::spawn(async move {
let x = scylla_worker.work().await;
match x {
Ok(()) => {}

View File

@@ -9,7 +9,6 @@ use httpclient::Requ;
use httpclient::StreamResponse;
use netpod::ProxyConfig;
use netpod::ReqCtx;
use netpod::ServiceVersion;
use std::collections::BTreeMap;
pub struct BackendListHandler {}

View File

@@ -427,7 +427,8 @@ impl IndexChannelHttpFunction {
async fn index(req: Requ, do_print: bool, node_config: &NodeConfigCached) -> Result<String, Error> {
// TODO avoid double-insert on central storage.
let (pgc, pgjh) = dbconn::create_connection(&node_config.node_config.cluster.database).await?;
// TODO
let (pgc, _pgjh) = dbconn::create_connection(&node_config.node_config.cluster.database).await?;
// TODO remove update of static columns when older clients are removed.
let sql = "insert into map_pulse_files (channel, split, timebin, pulse_min, pulse_max, hostname, ks) values ($1, $2, $3, $4, $5, $6, $7) on conflict (channel, split, timebin) do update set pulse_min = $4, pulse_max = $5, upc1 = map_pulse_files.upc1 + 1, hostname = $6";
let insert_01 = pgc.prepare(sql).await?;
@@ -1012,7 +1013,8 @@ impl MapPulseLocalHttpFunction {
})
.unwrap_or_else(|| String::from("missing x-req-from"));
let ts1 = Instant::now();
let (conn, pgjh) = dbconn::create_connection(&node_config.node_config.cluster.database).await?;
// TODO
let (conn, _pgjh) = dbconn::create_connection(&node_config.node_config.cluster.database).await?;
let sql = "select channel, hostname, timebin, split, ks from map_pulse_files where hostname = $1 and pulse_min <= $2 and (pulse_max >= $2 or closed = 0)";
let rows = conn.query(sql, &[&node_config.node.host, &(pulse as i64)]).await?;
let cands: Vec<_> = rows
@@ -1552,6 +1554,8 @@ impl MarkClosedHttpFunction {
pub async fn mark_closed(node_config: &NodeConfigCached) -> Result<(), Error> {
let (conn, pgjh) = dbconn::create_connection(&node_config.node_config.cluster.database).await?;
// TODO
let _ = &pgjh;
let sql = "select distinct channel from map_pulse_files order by channel";
let rows = conn.query(sql, &[]).await?;
let chns: Vec<_> = rows.iter().map(|r| r.get::<_, String>(0)).collect();