Introduce autoerr
This commit is contained in:
@@ -1414,8 +1414,7 @@ impl CaConn {
|
||||
// TODO refactor, should only execute this when required:
|
||||
let conf_poll_conf = conf.poll_conf();
|
||||
if let ChannelState::MakingSeriesWriter(st2) = &mut conf.state {
|
||||
let dt = stnow.duration_since(SystemTime::UNIX_EPOCH).unwrap();
|
||||
let beg = TsNano::from_ns(SEC * dt.as_secs() + dt.subsec_nanos() as u64);
|
||||
let beg = TsNano::from_system_time(stnow);
|
||||
let binwriter = BinWriter::new(
|
||||
beg,
|
||||
conf.conf.min_quiets(),
|
||||
|
||||
@@ -9,8 +9,8 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
async-channel = "2.1.1"
|
||||
futures-util = "0.3.30"
|
||||
smallvec = "1.13.2"
|
||||
autoerr = "0.0.3"
|
||||
log = { path = "../log" }
|
||||
err = { path = "../../daqbuf-err", package = "daqbuf-err" }
|
||||
netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" }
|
||||
items_0 = { path = "../../daqbuf-items-0", package = "daqbuf-items-0" }
|
||||
items_2 = { path = "../../daqbuf-items-2", package = "daqbuf-items-2" }
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
use crate::binwritergrid::BinWriterGrid;
|
||||
use crate::log::*;
|
||||
use crate::rtwriter::MinQuiets;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use items_2::binning::container_events::ContainerEvents;
|
||||
use netpod::log::*;
|
||||
use netpod::ttl::RetentionTime;
|
||||
use netpod::DtMs;
|
||||
use netpod::ScalarType;
|
||||
@@ -19,15 +17,16 @@ macro_rules! trace_ingest { ($($arg:tt)*) => ( if false { trace!($($arg)*); } )
|
||||
macro_rules! trace_tick { ($($arg:tt)*) => ( if false { trace!($($arg)*); } ) }
|
||||
macro_rules! trace_tick_verbose { ($($arg:tt)*) => ( if false { trace!($($arg)*); } ) }
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "SerieswriterBinwriter")]
|
||||
pub enum Error {
|
||||
SeriesLookupError,
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
Binning(#[from] items_2::binning::timeweight::timeweight_events::Error),
|
||||
UnsupportedBinGrid(DtMs),
|
||||
BinWriterGrid(#[from] crate::binwritergrid::Error),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "SerieswriterBinwriter"),
|
||||
enum variants {
|
||||
SeriesLookupError,
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
Binning(#[from] items_2::binning::timeweight::timeweight_events::Error),
|
||||
UnsupportedBinGrid(DtMs),
|
||||
BinWriterGrid(#[from] crate::binwritergrid::Error),
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BinWriter {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use items_2::binning::container_bins::ContainerBins;
|
||||
use items_2::binning::container_events::ContainerEvents;
|
||||
use items_2::binning::timeweight::timeweight_events::BinnedEventsTimeweight;
|
||||
@@ -21,14 +19,15 @@ macro_rules! trace_ingest { ($($arg:tt)*) => ( if false { trace!($($arg)*); } )
|
||||
macro_rules! trace_tick { ($($arg:tt)*) => ( if false { trace!($($arg)*); } ) }
|
||||
macro_rules! trace_tick_verbose { ($($arg:tt)*) => ( if false { trace!($($arg)*); } ) }
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "SerieswriterBinwriterGrid")]
|
||||
pub enum Error {
|
||||
SeriesLookupError,
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
Binning(#[from] items_2::binning::timeweight::timeweight_events::Error),
|
||||
UnsupportedBinGrid(DtMs),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "SerieswriterBinwriterGrid"),
|
||||
enum variants {
|
||||
SeriesLookupError,
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
Binning(#[from] items_2::binning::timeweight::timeweight_events::Error),
|
||||
UnsupportedBinGrid(DtMs),
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BinWriterGrid {
|
||||
|
||||
@@ -6,3 +6,7 @@ pub mod msptool;
|
||||
pub mod ratelimitwriter;
|
||||
pub mod rtwriter;
|
||||
pub mod writer;
|
||||
|
||||
mod log {
|
||||
pub use log::*;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use crate::writer::EmittableType;
|
||||
use crate::writer::SeriesWriter;
|
||||
use core::fmt;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use netpod::log::*;
|
||||
use netpod::DtNano;
|
||||
use netpod::TsNano;
|
||||
@@ -13,7 +11,6 @@ use std::marker::PhantomData;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_rt_decision {
|
||||
($det:expr, $($arg:tt)*) => {
|
||||
if $det {
|
||||
@@ -22,11 +19,12 @@ macro_rules! trace_rt_decision {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "RateLimitWriter")]
|
||||
pub enum Error {
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "RateLimitWriter"),
|
||||
enum variants {
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WriteRes {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use crate::log::*;
|
||||
use crate::ratelimitwriter::RateLimitWriter;
|
||||
use crate::writer::EmittableType;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use netpod::log::*;
|
||||
use netpod::ScalarType;
|
||||
use netpod::Shape;
|
||||
use netpod::TsNano;
|
||||
@@ -13,7 +11,6 @@ use std::collections::VecDeque;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_emit {
|
||||
($det:expr, $($arg:tt)*) => {
|
||||
if $det {
|
||||
@@ -22,13 +19,14 @@ macro_rules! trace_emit {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "SerieswriterRtwriter")]
|
||||
pub enum Error {
|
||||
SeriesLookupError,
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
RateLimitWriter(#[from] crate::ratelimitwriter::Error),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "SerieswriterRtwriter"),
|
||||
enum variants {
|
||||
SeriesLookupError,
|
||||
SeriesWriter(#[from] crate::writer::Error),
|
||||
RateLimitWriter(#[from] crate::ratelimitwriter::Error),
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MinQuiets {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
use core::fmt;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use log::*;
|
||||
use netpod::TsNano;
|
||||
use scywr::iteminsertqueue::QueryItem;
|
||||
@@ -12,6 +10,21 @@ use std::time::Instant;
|
||||
|
||||
macro_rules! trace_emit { ($det:expr, $($arg:tt)*) => ( if $det { trace!($($arg)*); } ) }
|
||||
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "SerieswriterWriter"),
|
||||
enum variants {
|
||||
DbPgSid(#[from] dbpg::seriesid::Error),
|
||||
ChannelSendError,
|
||||
ChannelRecvError,
|
||||
SeriesLookupError,
|
||||
Db(#[from] dbpg::err::Error),
|
||||
DbSchema(#[from] dbpg::schema::Error),
|
||||
Scy(#[from] scywr::session::Error),
|
||||
ScySchema(#[from] scywr::schema::Error),
|
||||
Series(#[from] dbpg::seriesbychannel::Error),
|
||||
},
|
||||
);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EmitRes {
|
||||
pub items: SmallVec<[QueryItem; 4]>,
|
||||
@@ -27,20 +40,6 @@ pub trait EmittableType: fmt::Debug + Clone {
|
||||
fn into_query_item(self, ts_net: Instant, tsev: TsNano, state: &mut <Self as EmittableType>::State) -> EmitRes;
|
||||
}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "SerieswriterWriter")]
|
||||
pub enum Error {
|
||||
DbPgSid(#[from] dbpg::seriesid::Error),
|
||||
ChannelSendError,
|
||||
ChannelRecvError,
|
||||
SeriesLookupError,
|
||||
Db(#[from] dbpg::err::Error),
|
||||
DbSchema(#[from] dbpg::schema::Error),
|
||||
Scy(#[from] scywr::session::Error),
|
||||
ScySchema(#[from] scywr::schema::Error),
|
||||
Series(#[from] dbpg::seriesbychannel::Error),
|
||||
}
|
||||
|
||||
impl<T> From<async_channel::SendError<T>> for Error {
|
||||
fn from(_value: async_channel::SendError<T>) -> Self {
|
||||
Error::ChannelSendError
|
||||
|
||||
Reference in New Issue
Block a user