#![allow(dead_code, missing_docs)]
use differential_dataflow::operators::arrange::Arranged;
use differential_dataflow::operators::arrange::TraceAgent;
use differential_dataflow::trace::implementations::merge_batcher_col::ColumnatedMergeBatcher;
use differential_dataflow::trace::wrappers::enter::TraceEnter;
use differential_dataflow::trace::wrappers::frontier::TraceFrontier;
use mz_repr::Diff;
use mz_storage_types::errors::DataflowError;
use timely::dataflow::ScopeParent;
pub use crate::row_spine::{RowRowSpine, RowSpine, RowValSpine};
pub use crate::typedefs::spines::{ColKeySpine, ColValSpine};
pub(crate) mod spines {
use std::rc::Rc;
use differential_dataflow::trace::implementations::ord_neu::{
OrdKeyBatch, OrdKeyBuilder, OrdValBatch, OrdValBuilder,
};
use differential_dataflow::trace::implementations::spine_fueled::Spine;
use differential_dataflow::trace::implementations::{Layout, Update};
use differential_dataflow::trace::rc_blanket_impls::RcBuilder;
use timely::container::columnation::Columnation;
use crate::containers::stack::StackWrapper;
use crate::row_spine::OffsetOptimized;
use crate::typedefs::{KeyBatcher, KeyValBatcher};
pub type ColValSpine<K, V, T, R> = Spine<
Rc<OrdValBatch<MzStack<((K, V), T, R)>>>,
KeyValBatcher<K, V, T, R>,
RcBuilder<OrdValBuilder<MzStack<((K, V), T, R)>>>,
>;
pub type ColKeySpine<K, T, R> = Spine<
Rc<OrdKeyBatch<MzStack<((K, ()), T, R)>>>,
KeyBatcher<K, T, R>,
RcBuilder<OrdKeyBuilder<MzStack<((K, ()), T, R)>>>,
>;
pub struct MzStack<U: Update> {
phantom: std::marker::PhantomData<U>,
}
impl<U: Update> Layout for MzStack<U>
where
U::Key: Columnation + 'static,
U::Val: Columnation + 'static,
U::Time: Columnation,
U::Diff: Columnation,
{
type Target = U;
type KeyContainer = StackWrapper<U::Key>;
type ValContainer = StackWrapper<U::Val>;
type UpdContainer = StackWrapper<(U::Time, U::Diff)>;
type OffsetContainer = OffsetOptimized;
}
}
pub type KeyValSpine<K, V, T, R> = ColValSpine<K, V, T, R>;
pub type KeyValAgent<K, V, T, R> = TraceAgent<KeyValSpine<K, V, T, R>>;
pub type KeyValEnter<K, V, T, R, TEnter> =
TraceEnter<TraceFrontier<KeyValAgent<K, V, T, R>>, TEnter>;
pub type KeySpine<K, T, R> = ColKeySpine<K, T, R>;
pub type KeyAgent<K, T, R> = TraceAgent<KeySpine<K, T, R>>;
pub type KeyEnter<K, T, R, TEnter> = TraceEnter<TraceFrontier<KeyAgent<K, T, R>>, TEnter>;
pub type RowValAgent<V, T, R> = TraceAgent<RowValSpine<V, T, R>>;
pub type RowValArrangement<S, V> = Arranged<S, RowValAgent<V, <S as ScopeParent>::Timestamp, Diff>>;
pub type RowValEnter<V, T, R, TEnter> = TraceEnter<TraceFrontier<RowValAgent<V, T, R>>, TEnter>;
pub type RowRowAgent<T, R> = TraceAgent<RowRowSpine<T, R>>;
pub type RowRowArrangement<S> = Arranged<S, RowRowAgent<<S as ScopeParent>::Timestamp, Diff>>;
pub type RowRowEnter<T, R, TEnter> = TraceEnter<TraceFrontier<RowRowAgent<T, R>>, TEnter>;
pub type RowAgent<T, R> = TraceAgent<RowSpine<T, R>>;
pub type RowArrangement<S> = Arranged<S, RowAgent<<S as ScopeParent>::Timestamp, Diff>>;
pub type RowEnter<T, R, TEnter> = TraceEnter<TraceFrontier<RowAgent<T, R>>, TEnter>;
pub type ErrSpine<T, R> = ColKeySpine<DataflowError, T, R>;
pub type ErrAgent<T, R> = TraceAgent<ErrSpine<T, R>>;
pub type ErrEnter<T, TEnter> = TraceEnter<TraceFrontier<ErrAgent<T, Diff>>, TEnter>;
pub type KeyErrSpine<K, T, R> = ColValSpine<K, DataflowError, T, R>;
pub type RowErrSpine<T, R> = RowValSpine<DataflowError, T, R>;
pub type KeyBatcher<K, T, D> = ColumnatedMergeBatcher<K, (), T, D>;
pub type KeyValBatcher<K, V, T, D> = ColumnatedMergeBatcher<K, V, T, D>;