use super::super::data::{Stream, Type};
use super::super::error::ExecError;
use super::super::exec::{Edge, GraphCx, SelectorCx};
use super::super::registry::{GraphFn, GraphId, SelectFn, gid};
#[derive(Debug)]
pub(crate) struct StoreGraph;
#[derive(Debug)]
pub(crate) struct Store1;
pub(crate) static STORE: StoreGraph = StoreGraph;
pub(crate) static STORE1: Store1 = Store1;
impl GraphFn for StoreGraph {
fn run(&self, cx: &mut GraphCx<'_, '_, '_>, inputs: &[Edge]) -> Result<(), ExecError> {
for &input in inputs {
cx.set_destination(&[input], gid::STORE1, None)?;
}
Ok(())
}
}
impl SelectFn for Store1 {
fn select(&self, _: &mut SelectorCx<'_, '_, '_>, input: &Stream<'_>, _: &[GraphId]) -> GraphId {
if input.ty() == Type::String {
gid::STRING_STORE
} else {
gid::SERIAL_STORE
}
}
}