It compiles

This commit is contained in:
Dominik Werder
2021-05-20 20:04:21 +02:00
parent 49af7ce561
commit 30be7d1c44
25 changed files with 424 additions and 663 deletions

View File

@@ -1,4 +1,5 @@
use crate::agg::eventbatch::MinMaxAvgScalarEventBatchStreamItem;
use crate::agg::streams::StreamItem;
use crate::frame::inmem::InMemoryFrameAsyncReadStream;
use crate::frame::makeframe::decode_frame;
use crate::raw::conn::RawConnOut;
@@ -36,7 +37,7 @@ impl<T> Stream for MinMaxAvgScalarEventBatchStreamFromFrames<T>
where
T: AsyncRead + Unpin,
{
type Item = Result<MinMaxAvgScalarEventBatchStreamItem, Error>;
type Item = Result<StreamItem<MinMaxAvgScalarEventBatchStreamItem>, Error>;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
use Poll::*;
@@ -48,38 +49,30 @@ where
Ready(None)
} else {
match self.inp.poll_next_unpin(cx) {
Ready(Some(Ok(frame))) => {
type ExpectedType = RawConnOut;
match decode_frame::<ExpectedType>(&frame) {
Ok(item) => match item {
Ok(item) => {
if false {
match &item {
MinMaxAvgScalarEventBatchStreamItem::EventDataReadStats(stats) => {
info!("✒✒ ✒✒ ✒✒ ✒✒ ✒✒ ✒✒ stats {:?}", stats);
}
_ => {
info!("✒ ✒ ✒ ✒ other kind")
}
}
Ready(Some(Ok(item))) => match item {
StreamItem::Log(item) => Ready(Some(Ok(StreamItem::Log(item)))),
StreamItem::Stats(item) => Ready(Some(Ok(StreamItem::Stats(item)))),
StreamItem::DataItem(frame) => {
type ExpectedType = RawConnOut;
match decode_frame::<ExpectedType>(&frame) {
Ok(item) => match item {
Ok(item) => Ready(Some(Ok(item))),
Err(e) => {
self.errored = true;
Ready(Some(Err(e)))
}
Ready(Some(Ok(item)))
}
},
Err(e) => {
error!(
"MinMaxAvgScalarEventBatchStreamFromFrames ~~~~~~~~ ERROR on frame payload {}",
frame.buf().len(),
);
self.errored = true;
Ready(Some(Err(e)))
}
},
Err(e) => {
error!(
"MinMaxAvgScalarEventBatchStreamFromFrames ~~~~~~~~ ERROR on frame payload {}",
frame.buf().len(),
);
self.errored = true;
Ready(Some(Err(e)))
}
}
}
},
Ready(Some(Err(e))) => {
self.errored = true;
Ready(Some(Err(e)))

View File

@@ -1,5 +1,6 @@
use crate::agg::binnedx::IntoBinnedXBins1;
use crate::agg::eventbatch::MinMaxAvgScalarEventBatchStreamItem;
use crate::agg::streams::StreamItem;
use crate::agg::IntoDim1F32Stream;
use crate::channelconfig::{extract_matching_config_entry, read_local_config};
use crate::eventblobs::EventBlobsComplete;
@@ -45,7 +46,7 @@ async fn raw_conn_handler(stream: TcpStream, addr: SocketAddr, node_config: Node
}
}
pub type RawConnOut = Result<MinMaxAvgScalarEventBatchStreamItem, Error>;
pub type RawConnOut = Result<StreamItem<MinMaxAvgScalarEventBatchStreamItem>, Error>;
async fn raw_conn_handler_inner(
stream: TcpStream,
@@ -95,9 +96,10 @@ async fn raw_conn_handler_inner_try(
.await
{
match k {
Ok(k) => {
frames.push(k);
Ok(StreamItem::DataItem(item)) => {
frames.push(item);
}
Ok(_) => {}
Err(e) => {
return Err((e, netout))?;
}
@@ -162,10 +164,11 @@ async fn raw_conn_handler_inner_try(
let mut e = 0;
while let Some(item) = s1.next().await {
match &item {
Ok(MinMaxAvgScalarEventBatchStreamItem::Values(_)) => {
Ok(StreamItem::DataItem(_)) => {
e += 1;
}
_ => (),
Ok(_) => {}
Err(_) => {}
}
match make_frame::<RawConnOut>(&item) {
Ok(buf) => match netout.write_all(&buf).await {