Update deps, log, error return

This commit is contained in:
Dominik Werder
2025-06-03 12:29:07 +02:00
parent 1ddf18276f
commit 9d20359126
16 changed files with 203 additions and 140 deletions

View File

@@ -167,18 +167,18 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "autoerr"
version = "0.0.3"
version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "980f0fd954ab9bdb2440aac932951f01455dff9cae664bdaca4d98aeb75b1116"
checksum = "be8cd7d4dbe9d1f58cb80acbda5d1dccd35701f4ef5cfa37492b153e49dedc51"
dependencies = [
"autoerr-impl",
]
[[package]]
name = "autoerr-impl"
version = "0.0.3"
version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "745e965b2d8ddc2d25707087e42b550f67f9391366802185b0a3d8ac4a4511f7"
checksum = "7166e8bc0a13b079544c28a8144e006c560b52ff836b453240ae1b251b8cb57d"
dependencies = [
"proc-macro2",
"quote",
@@ -266,7 +266,7 @@ version = "0.0.2"
dependencies = [
"async-channel",
"daqbuf-err",
"log 0.0.1",
"log 0.0.2",
"taskrun",
]
@@ -314,9 +314,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]]
name = "cc"
version = "1.2.24"
version = "1.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7"
checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951"
dependencies = [
"shlex",
]
@@ -371,9 +371,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.38"
version = "4.5.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000"
checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f"
dependencies = [
"clap_builder",
"clap_derive",
@@ -381,9 +381,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.38"
version = "4.5.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120"
checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51"
dependencies = [
"anstream",
"anstyle",
@@ -723,7 +723,7 @@ dependencies = [
[[package]]
name = "daqingest"
version = "0.3.0-aa.4"
version = "0.3.0-aa.5"
dependencies = [
"async-channel",
"autoerr",
@@ -738,7 +738,7 @@ dependencies = [
"futures-util",
"ingest-linux",
"libc",
"log 0.0.1",
"log 0.0.2",
"netfetch",
"scywr",
"serde",
@@ -823,7 +823,7 @@ dependencies = [
"daqbuf-netpod",
"daqbuf-series",
"futures-util",
"log 0.0.1",
"log 0.0.2",
"md-5",
"serde",
"serde_json",
@@ -1244,12 +1244,12 @@ dependencies = [
[[package]]
name = "hyper-util"
version = "0.1.12"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710"
checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8"
dependencies = [
"bytes",
"futures-util",
"futures-core",
"http",
"http-body",
"hyper",
@@ -1411,7 +1411,7 @@ version = "0.0.1"
dependencies = [
"autoerr",
"libc",
"log 0.0.1",
"log 0.0.2",
"taskrun",
]
@@ -1484,9 +1484,9 @@ checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
[[package]]
name = "lock_api"
version = "0.4.12"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
dependencies = [
"autocfg",
"scopeguard",
@@ -1494,7 +1494,7 @@ dependencies = [
[[package]]
name = "log"
version = "0.0.1"
version = "0.0.2"
dependencies = [
"tracing",
]
@@ -1594,7 +1594,7 @@ name = "mrucache"
version = "0.0.1"
dependencies = [
"hashbrown 0.15.3",
"log 0.0.1",
"log 0.0.2",
]
[[package]]
@@ -1630,7 +1630,7 @@ dependencies = [
"ingest-linux",
"lazy_static",
"libc",
"log 0.0.1",
"log 0.0.2",
"md-5",
"mrucache",
"pin-project",
@@ -1721,9 +1721,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]]
name = "parking_lot"
version = "0.12.3"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -1731,9 +1731,9 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.10"
version = "0.9.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
dependencies = [
"cfg-if",
"libc",
@@ -1875,9 +1875,9 @@ dependencies = [
[[package]]
name = "prettyplease"
version = "0.2.32"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6"
checksum = "9dee91521343f4c5c6a63edd65e54f31f5c92fe8978c40a4282f8372194c6a7d"
dependencies = [
"proc-macro2",
"syn",
@@ -2128,26 +2128,22 @@ dependencies = [
[[package]]
name = "scylla"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd81aa1c6de67ed43f78a64aa233c547c569979922ab2e6c6d58730f0d53b651"
checksum = "1f4d5b7fe3cb3e140d374238f5f916eb810053562287a01d66ac685e305c166f"
dependencies = [
"arc-swap",
"async-trait",
"byteorder",
"bytes",
"chrono",
"dashmap 5.5.3",
"futures",
"hashbrown 0.14.5",
"itertools 0.14.0",
"lazy_static",
"lz4_flex",
"rand 0.9.1",
"rand_pcg 0.9.0",
"scylla-cql 1.1.0",
"scylla-cql 1.2.0",
"smallvec",
"snap",
"socket2",
"thiserror",
"tokio",
@@ -2176,17 +2172,16 @@ dependencies = [
[[package]]
name = "scylla-cql"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae84054fed47b0a7e757d66aeb4574a4ca9696bf68c25ed6325b0f198c15795b"
checksum = "507db4914c625c86d32c5c00ed1add75eaf966a2d4ba9772b601b2563701df58"
dependencies = [
"async-trait",
"byteorder",
"bytes",
"chrono",
"itertools 0.14.0",
"lz4_flex",
"scylla-macros 1.1.0",
"scylla-macros 1.2.0",
"snap",
"stable_deref_trait",
"thiserror",
@@ -2209,9 +2204,9 @@ dependencies = [
[[package]]
name = "scylla-macros"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e67d343ebea5cc079bfa89ca4b231b432207c3748baaa3b00e5c238e7644e838"
checksum = "8efb4b519ab70556c8d3adfd4f192c635d0c7c72d4f125d2b79713742c98f39d"
dependencies = [
"darling",
"proc-macro2",
@@ -2230,9 +2225,9 @@ dependencies = [
"daqbuf-scydb",
"daqbuf-series",
"futures-util",
"log 0.0.1",
"log 0.0.2",
"pin-project",
"scylla 1.1.0",
"scylla 1.2.0",
"serde",
"smallvec",
"stats",
@@ -2335,7 +2330,7 @@ dependencies = [
"dbpg",
"futures-util",
"itertools 0.14.0",
"log 0.0.1",
"log 0.0.2",
"scywr",
"serde",
"smallvec",
@@ -2416,9 +2411,9 @@ checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b"
[[package]]
name = "socket2"
version = "0.5.9"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef"
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
dependencies = [
"libc",
"windows-sys 0.52.0",
@@ -2450,7 +2445,7 @@ name = "stats"
version = "0.0.1-a.0"
dependencies = [
"daqbuf-ca-proto",
"log 0.0.1",
"log 0.0.2",
"mettrics",
"rand_xoshiro 0.7.0",
"serde",

View File

@@ -1,6 +1,6 @@
[package]
name = "daqingest"
version = "0.3.0-aa.4"
version = "0.3.0-aa.5"
authors = ["Dominik Werder <dominik.werder@gmail.com>"]
edition = "2024"
@@ -20,7 +20,7 @@ futures-util = "0.3"
chrono = "0.4.38"
bytes = "1.10.0"
libc = "0.2"
autoerr = "0.0.3"
autoerr = "0.0"
err = { path = "../../daqbuf-err", package = "daqbuf-err" }
netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" }
taskrun = { path = "../../daqbuffer/crates/taskrun" }

View File

@@ -22,4 +22,4 @@ async-channel = "2.1.1"
md-5 = "0.10.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
autoerr = "0.0.3"
autoerr = "0.0"

View File

@@ -6,14 +6,15 @@ edition = "2021"
[dependencies]
futures-util = "0.3"
async-channel = "2.0.0"
async-channel = "2.3.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bytes = "1.4.0"
bytes = "1.10"
md-5 = "0.10.5"
hex = "0.4.3"
pin-project = "1"
slidebuf = "0.0.1"
autoerr = "0.0"
log = { path = "../log" }
series = { path = "../../daqbuf-series", package = "daqbuf-series" }
stats = { path = "../stats" }

View File

@@ -11,8 +11,6 @@ use crate::zmtp::ZmtpClientOpts;
use crate::zmtp::ZmtpEvent;
use async_channel::Sender;
use dbpg::seriesbychannel::ChannelInfoQuery;
use err::thiserror;
use err::ThisError;
use futures_util::StreamExt;
use netpod::log::*;
use netpod::timeunits::HOUR;
@@ -34,22 +32,18 @@ use std::time::Duration;
use std::time::Instant;
use taskrun::tokio;
#[derive(Debug, ThisError)]
pub enum Error {
#[error("InsertQueueSenderMissing")]
InsertQueueSenderMissing,
#[error("AsyncChannelSend")]
AsyncChannelSend,
#[error("IO({0})")]
IO(#[from] io::Error),
#[error("Msg({0})")]
Msg(String),
#[error("ZmtpProto({0})")]
ZmtpProto(#[from] zmtpproto::Error),
#[error("BadSlice")]
BadSlice,
SystemNet(#[from] ingest_linux::net::Error),
}
autoerr::create_error_v1!(
name(Error, "BsreadClientError"),
enum variants {
InsertQueueSenderMissing,
AsyncChannelSend,
IO(#[from] io::Error),
Msg(String),
ZmtpProto(#[from] zmtpproto::Error),
BadSlice,
SystemNet(#[from] ingest_linux::net::Error),
},
);
impl<T> From<async_channel::SendError<T>> for Error {
fn from(_value: async_channel::SendError<T>) -> Self {

View File

@@ -10,8 +10,6 @@ use crate::zmtp::zmtpproto::SocketType;
use crate::zmtp::zmtpproto::Zmtp;
#[allow(unused)]
use bytes::BufMut;
use err::thiserror;
use err::ThisError;
use futures_util::Future;
use futures_util::FutureExt;
use futures_util::StreamExt;
@@ -25,17 +23,15 @@ use std::task::Context;
use std::task::Poll;
use taskrun::tokio;
#[derive(Debug, ThisError)]
pub enum Error {
#[error("Msg({0})")]
Msg(String),
#[error("TaskJoin")]
TaskJoin,
#[error("BsreadClient({0})")]
BsreadClient(#[from] bsreadclient::Error),
#[error("IO({0})")]
IO(#[from] io::Error),
}
autoerr::create_error_v1!(
name(Error, "ZmtpError"),
enum variants {
Msg(String),
TaskJoin,
BsreadClient(#[from] bsreadclient::Error),
IO(#[from] io::Error),
},
);
#[allow(unused)]
fn test_listen() -> Result<(), Error> {

View File

@@ -5,22 +5,20 @@ use crate::zmtp::zmtpproto;
use crate::zmtp::zmtpproto::SocketType;
use crate::zmtp::zmtpproto::Zmtp;
use crate::zmtp::ZmtpEvent;
use err::thiserror;
use futures_util::StreamExt;
use netpod::log::*;
use netpod::timeunits::SEC;
use std::io;
use taskrun::tokio;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("IO({0})")]
IO(#[from] io::Error),
#[error("Msg({0})")]
Msg(String),
#[error("ZmtpProto({0})")]
ZmtpProto(#[from] zmtpproto::Error),
}
autoerr::create_error_v1!(
name(Error, "BsreadDumpError"),
enum variants {
IO(#[from] io::Error),
Msg(String),
ZmtpProto(#[from] zmtpproto::Error),
},
);
impl From<err::Error> for Error {
fn from(value: err::Error) -> Self {

View File

@@ -5,8 +5,6 @@ use crate::bsread::HeadB;
use crate::zmtp::ZmtpEvent;
use async_channel::Receiver;
use async_channel::Sender;
use err::thiserror;
use err::ThisError;
use futures_util::pin_mut;
use futures_util::Stream;
use netpod::log::*;
@@ -26,27 +24,20 @@ use tokio::io::AsyncWrite;
use tokio::io::ReadBuf;
use tokio::net::TcpStream;
#[derive(Debug, ThisError)]
pub enum Error {
#[error("bad")]
Bad,
#[error("NetBuf({0})")]
NetBuf(#[from] slidebuf::Error),
#[error("zmtp peer is not v3.x")]
ZmtpInitPeerNot3x,
#[error("zmtp peer is not v3.0 or v3.1")]
ZmtpInitPeerUnsupportedVersion,
#[error("zmtp bad mechanism")]
BadPeerMechanism,
#[error("zmtp message too large {0}")]
MsgTooLarge(usize),
#[error("buffer too small, need-min {0} cap {1}")]
BufferTooSmallForNeedMin(usize, usize),
#[error("FromUtf8Error")]
FromUtf8Error(#[from] FromUtf8Error),
#[error("IO")]
IO(#[from] io::Error),
}
autoerr::create_error_v1!(
name(Error, "ZmtpProtocolError"),
enum variants {
Bad,
NetBuf(#[from] slidebuf::Error),
ZmtpInitPeerNot3x,
ZmtpInitPeerUnsupportedVersion,
BadPeerMechanism,
MsgTooLarge(usize),
BufferTooSmallForNeedMin(usize, usize),
FromUtf8Error(#[from] FromUtf8Error),
IO(#[from] io::Error),
},
);
#[derive(Clone, Debug)]
enum ConnState {

View File

@@ -6,6 +6,6 @@ edition = "2024"
[dependencies]
libc = "0.2"
autoerr = "0.0.3"
autoerr = "0.0"
log = { path = "../log" }
taskrun = { path = "../../daqbuffer/crates/taskrun" }

View File

@@ -1,8 +1,8 @@
[package]
name = "log"
version = "0.0.1"
version = "0.0.2"
authors = ["Dominik Werder <dominik.werder@gmail.com>"]
edition = "2021"
edition = "2024"
[lib]
path = "src/log.rs"

View File

@@ -1,17 +1,31 @@
#![allow(unused_imports)]
// pub use tracing::debug;
// pub use tracing::error;
// pub use tracing::info;
// pub use tracing::trace;
// pub use tracing::warn;
pub use direct_debug as debug;
pub use direct_error as error;
pub use direct_info as info;
pub use direct_trace as trace;
pub use direct_warn as warn;
pub use branch_debug as debug;
pub use branch_error as error;
pub use branch_info as info;
pub use branch_trace as trace;
pub use branch_warn as warn;
pub mod log_macros_direct {
use std::sync::LazyLock;
#[allow(unused)]
#[inline(always)]
pub fn is_log_direct() -> bool {
static ONCE: LazyLock<bool> =
LazyLock::new(|| std::env::var("LOG_DIRECT").map_or(false, |x| x.parse().unwrap_or(false)));
*ONCE
}
pub mod log_tracing {
pub use tracing::debug;
pub use tracing::error;
pub use tracing::info;
pub use tracing::trace;
pub use tracing::warn;
// pub use tracing::{self, event, span, Level};
}
pub mod log_direct {
#[allow(unused)]
#[macro_export]
macro_rules! direct_trace {
@@ -66,6 +80,11 @@ pub mod log_macros_direct {
eprintln!(concat!("ERROR ", $fmt), $($arg),*);
};
}
pub use crate::direct_debug as debug;
pub use crate::direct_error as error;
pub use crate::direct_info as info;
pub use crate::direct_trace as trace;
pub use crate::direct_warn as warn;
}
#[allow(unused)]
@@ -82,3 +101,67 @@ macro_rules! log_v2_trace {
// eprintln!("h: {:?}", h);
};
}
pub mod log_macros_branch {
#[allow(unused)]
#[macro_export]
macro_rules! branch_trace {
($($arg:expr),*) => {
if $crate::is_log_direct() {
$crate::log_direct::trace!($($arg),*);
} else {
$crate::log_tracing::trace!($($arg),*);
}
};
}
#[allow(unused)]
#[macro_export]
macro_rules! branch_debug {
($($arg:tt)*) => {
if $crate::is_log_direct() {
$crate::log_direct::debug!($($arg)*);
} else {
$crate::log_tracing::debug!($($arg)*);
}
};
}
#[allow(unused)]
#[macro_export]
macro_rules! branch_info {
($($arg:tt)*) => {
if $crate::is_log_direct() {
$crate::log_direct::info!($($arg)*);
} else {
$crate::log_tracing::info!($($arg)*);
}
};
}
#[allow(unused)]
#[macro_export]
macro_rules! branch_warn {
($($arg:tt)*) => {
if $crate::is_log_direct() {
$crate::log_direct::warn!($($arg)*);
} else {
$crate::log_tracing::warn!($($arg)*);
}
};
}
#[allow(unused)]
#[macro_export]
macro_rules! branch_error {
($($arg:tt)*) => {
if $crate::is_log_direct() {
$crate::log_direct::error!($($arg)*);
} else {
$crate::log_tracing::error!($($arg)*);
}
};
}
pub use branch_debug as debug;
pub use branch_error as error;
pub use branch_info as info;
pub use branch_trace as trace;
pub use branch_warn as warn;
pub use tracing::{self, event, span, Level};
}

View File

@@ -37,7 +37,7 @@ slidebuf = "0.0.1"
dashmap = "6.0.1"
hashbrown = "0.15.2"
smallvec = "1.13.2"
autoerr = "0.0.3"
autoerr = "0.0"
log = { path = "../log" }
series = { path = "../../daqbuf-series", package = "daqbuf-series" }
serieswriter = { path = "../serieswriter" }

View File

@@ -92,7 +92,7 @@ const POLL_READ_TIMEOUT: Duration = Duration::from_millis(1000 * 10);
const DO_RATE_CHECK: bool = false;
const CHANNEL_STATUS_PONG_QUIET: Duration = Duration::from_millis(1000 * 60 * 60);
const METRICS_EMIT_IVL: Duration = Duration::from_millis(1000 * 1);
const USE_BIN_WRITER: bool = true;
const USE_BIN_WRITER: bool = false;
macro_rules! trace3 { ($($arg:expr),*) => ( if false { trace!($($arg),*); } ); }

View File

@@ -11,7 +11,7 @@ scylla = "1.1"
smallvec = "1.11.0"
pin-project = "1.1.5"
bytes = "1.10.0"
autoerr = "0.0.3"
autoerr = "0.0"
serde = { version = "1", features = ["derive"] }
log = { path = "../log" }
stats = { path = "../stats" }

View File

@@ -9,7 +9,7 @@ serde = { version = "1.0", features = ["derive"] }
async-channel = "2.1.1"
futures-util = "0.3.30"
smallvec = "1.13.2"
autoerr = "0.0.3"
autoerr = "0.0"
itertools = "0.14"
log = { path = "../log" }
netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" }

View File

@@ -126,12 +126,17 @@ fn binwriter_nest01_00() {
let msp_exp = T0.ms() / pbp.bin_len().ms() / pbp.patch_len() as u64;
assert_eq!(x.0 as u64, msp_exp);
let x = pbp.msp_lsp(sec(39.9).to_ts_ms());
assert_eq!(binscol[0].msp as u32, x.0);
assert_eq!(binscol[0].off as u32, x.1);
let i = 0;
assert_eq!(binscol[i].msp as u32, x.0);
assert_eq!(binscol[i].off as u32, x.1);
assert_eq!(binscol[i].min, 2.2);
assert_eq!(binscol[i].max, 2.2);
let x = pbp.msp_lsp(sec(40.0).to_ts_ms());
assert_eq!(binscol[1].msp as u32, x.0);
assert_eq!(binscol[1].off as u32, x.1);
assert_eq!(binscol[1].max, 2.0);
let i = 1;
assert_eq!(binscol[i].msp as u32, x.0);
assert_eq!(binscol[i].off as u32, x.1);
assert_eq!(binscol[i].min, 2.0);
assert_eq!(binscol[i].max, 2.0);
}
{
let rt = "MT";