Add String place-holder event type, public facing error message
This commit is contained in:
@@ -9,7 +9,7 @@ use bytes::Bytes;
|
||||
use err::Error;
|
||||
use futures_core::Stream;
|
||||
use futures_util::StreamExt;
|
||||
use items::numops::{BoolNum, NumOps};
|
||||
use items::numops::{BoolNum, NumOps, StringNum};
|
||||
use items::{
|
||||
Appendable, Clearable, EventsNodeProcessor, Framable, FrameType, PushableIndex, Sitemty, TimeBinnableType,
|
||||
};
|
||||
@@ -161,6 +161,7 @@ fn make_num_pipeline(
|
||||
ScalarType::F32 => match_end!(f32, byte_order, shape, agg_kind, query, node_config),
|
||||
ScalarType::F64 => match_end!(f64, byte_order, shape, agg_kind, query, node_config),
|
||||
ScalarType::BOOL => match_end!(BoolNum, byte_order, shape, agg_kind, query, node_config),
|
||||
ScalarType::STRING => match_end!(StringNum, byte_order, shape, agg_kind, query, node_config),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use err::Error;
|
||||
use futures_core::Stream;
|
||||
use futures_util::future::FutureExt;
|
||||
use futures_util::StreamExt;
|
||||
use items::numops::{BoolNum, NumOps};
|
||||
use items::numops::{BoolNum, NumOps, StringNum};
|
||||
use items::scalarevents::ScalarEvents;
|
||||
use items::streams::{Collectable, Collector};
|
||||
use items::{
|
||||
@@ -189,6 +189,7 @@ where
|
||||
ScalarType::F32 => match_end!(f, f32, byte_order, scalar_type, shape, agg_kind, node_config),
|
||||
ScalarType::F64 => match_end!(f, f64, byte_order, scalar_type, shape, agg_kind, node_config),
|
||||
ScalarType::BOOL => match_end!(f, BoolNum, byte_order, scalar_type, shape, agg_kind, node_config),
|
||||
ScalarType::STRING => match_end!(f, StringNum, byte_order, scalar_type, shape, agg_kind, node_config),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use err::Error;
|
||||
use futures_core::Stream;
|
||||
use futures_util::StreamExt;
|
||||
use items::eventsitem::EventsItem;
|
||||
use items::numops::{BoolNum, NumOps};
|
||||
use items::numops::{BoolNum, NumOps, StringNum};
|
||||
use items::plainevents::{PlainEvents, ScalarPlainEvents};
|
||||
use items::scalarevents::ScalarEvents;
|
||||
use items::waveevents::{WaveEvents, WaveNBinner, WavePlainProc, WaveXBinner};
|
||||
@@ -48,6 +48,20 @@ impl NumFromBytes<BoolNum, BigEndian> for BoolNum {
|
||||
}
|
||||
}
|
||||
|
||||
impl NumFromBytes<StringNum, LittleEndian> for StringNum {
|
||||
fn convert(_buf: &[u8], _big_endian: bool) -> StringNum {
|
||||
netpod::log::error!("TODO NumFromBytes for StringNum");
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl NumFromBytes<StringNum, BigEndian> for StringNum {
|
||||
fn convert(_buf: &[u8], _big_endian: bool) -> StringNum {
|
||||
netpod::log::error!("TODO NumFromBytes for StringNum");
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_num_from_bytes_end {
|
||||
($nty:ident, $nl:expr, $end:ident, $ec:ident) => {
|
||||
impl NumFromBytes<$nty, $end> for $nty {
|
||||
@@ -402,6 +416,11 @@ impl EventsItemStream {
|
||||
let cont = ScalarEvents::<i8>::empty();
|
||||
ret = Some(EventsItem::Plain(PlainEvents::Scalar(ScalarPlainEvents::I8(cont))));
|
||||
}
|
||||
ScalarType::STRING => {
|
||||
// TODO
|
||||
let cont = ScalarEvents::<String>::empty();
|
||||
ret = Some(EventsItem::Plain(PlainEvents::Scalar(ScalarPlainEvents::String(cont))));
|
||||
}
|
||||
},
|
||||
Shape::Wave(_) => todo!(),
|
||||
Shape::Image(..) => todo!(),
|
||||
@@ -444,6 +463,7 @@ impl EventsItemStream {
|
||||
}
|
||||
}
|
||||
ScalarType::BOOL => todo!(),
|
||||
ScalarType::STRING => todo!(),
|
||||
},
|
||||
Shape::Wave(_) => todo!(),
|
||||
Shape::Image(_, _) => todo!(),
|
||||
|
||||
@@ -126,8 +126,8 @@ impl PlainEventsJsonQuery {
|
||||
|
||||
pub fn from_url(url: &Url) -> Result<Self, Error> {
|
||||
let pairs = get_url_query_pairs(url);
|
||||
let beg_date = pairs.get("begDate").ok_or(Error::with_msg("missing begDate"))?;
|
||||
let end_date = pairs.get("endDate").ok_or(Error::with_msg("missing endDate"))?;
|
||||
let beg_date = pairs.get("begDate").ok_or(Error::with_public_msg("missing begDate"))?;
|
||||
let end_date = pairs.get("endDate").ok_or(Error::with_public_msg("missing endDate"))?;
|
||||
let ret = Self {
|
||||
range: NanoRange {
|
||||
beg: beg_date.parse::<DateTime<Utc>>()?.to_nanos(),
|
||||
@@ -138,23 +138,23 @@ impl PlainEventsJsonQuery {
|
||||
.get("diskIoBufferSize")
|
||||
.map_or("4096", |k| k)
|
||||
.parse()
|
||||
.map_err(|e| Error::with_msg(format!("can not parse diskIoBufferSize {:?}", e)))?,
|
||||
.map_err(|e| Error::with_public_msg(format!("can not parse diskIoBufferSize {:?}", e)))?,
|
||||
report_error: pairs
|
||||
.get("reportError")
|
||||
.map_or("false", |k| k)
|
||||
.parse()
|
||||
.map_err(|e| Error::with_msg(format!("can not parse reportError {:?}", e)))?,
|
||||
.map_err(|e| Error::with_public_msg(format!("can not parse reportError {:?}", e)))?,
|
||||
timeout: pairs
|
||||
.get("timeout")
|
||||
.map_or("10000", |k| k)
|
||||
.parse::<u64>()
|
||||
.map(|k| Duration::from_millis(k))
|
||||
.map_err(|e| Error::with_msg(format!("can not parse timeout {:?}", e)))?,
|
||||
.map_err(|e| Error::with_public_msg(format!("can not parse timeout {:?}", e)))?,
|
||||
do_log: pairs
|
||||
.get("doLog")
|
||||
.map_or("false", |k| k)
|
||||
.parse()
|
||||
.map_err(|e| Error::with_msg(format!("can not parse doLog {:?}", e)))?,
|
||||
.map_err(|e| Error::with_public_msg(format!("can not parse doLog {:?}", e)))?,
|
||||
};
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::eventchunker::{EventChunkerConf, EventFull};
|
||||
use err::Error;
|
||||
use futures_core::Stream;
|
||||
use futures_util::StreamExt;
|
||||
use items::numops::{BoolNum, NumOps};
|
||||
use items::numops::{BoolNum, NumOps, StringNum};
|
||||
use items::{EventsNodeProcessor, Framable, RangeCompletableItem, Sitemty, StreamItem};
|
||||
use netpod::query::RawEventsQuery;
|
||||
use netpod::{AggKind, ByteOrder, ByteSize, Channel, FileIoBufferSize, NanoRange, NodeConfigCached, ScalarType, Shape};
|
||||
@@ -133,6 +133,7 @@ macro_rules! pipe1 {
|
||||
ScalarType::F32 => pipe2!(f32, $end, $shape, $agg_kind, $event_blobs),
|
||||
ScalarType::F64 => pipe2!(f64, $end, $shape, $agg_kind, $event_blobs),
|
||||
ScalarType::BOOL => pipe2!(BoolNum, $end, $shape, $agg_kind, $event_blobs),
|
||||
ScalarType::STRING => pipe2!(StringNum, $end, $shape, $agg_kind, $event_blobs),
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -164,8 +165,8 @@ pub async fn make_event_pipe(
|
||||
Err(e) => return Err(e)?,
|
||||
};
|
||||
let entry = match entry_res {
|
||||
MatchingConfigEntry::None => return Err(Error::with_msg("no config entry found"))?,
|
||||
MatchingConfigEntry::Multiple => return Err(Error::with_msg("multiple config entries found"))?,
|
||||
MatchingConfigEntry::None => return Err(Error::with_public_msg("no config entry found"))?,
|
||||
MatchingConfigEntry::Multiple => return Err(Error::with_public_msg("multiple config entries found"))?,
|
||||
MatchingConfigEntry::Entry(entry) => entry,
|
||||
};
|
||||
let shape = match entry.to_shape() {
|
||||
@@ -215,8 +216,8 @@ pub async fn get_applicable_entry(
|
||||
Err(e) => return Err(e)?,
|
||||
};
|
||||
let entry = match entry_res {
|
||||
MatchingConfigEntry::None => return Err(Error::with_msg("no config entry found"))?,
|
||||
MatchingConfigEntry::Multiple => return Err(Error::with_msg("multiple config entries found"))?,
|
||||
MatchingConfigEntry::None => return Err(Error::with_public_msg("no config entry found"))?,
|
||||
MatchingConfigEntry::Multiple => return Err(Error::with_public_msg("multiple config entries found"))?,
|
||||
MatchingConfigEntry::Entry(entry) => entry,
|
||||
};
|
||||
Ok(entry.clone())
|
||||
|
||||
Reference in New Issue
Block a user