differential_dataflow/trace/cursor/wrappers/
enter.rs1use timely::progress::timestamp::Refines;
4
5use crate::lattice::Lattice;
6use crate::trace::implementations::BatchContainer;
7use crate::trace::wrappers::enter::BatchEnter;
8use crate::trace::Navigable;
9use crate::trace::cursor::Cursor;
10
11impl<B, TInner> Navigable for BatchEnter<B, TInner>
12where
13 B: Navigable,
14 TInner: Refines<<B::Cursor as Cursor>::Time>+Lattice,
15{
16 type Cursor = BatchCursorEnter<B::Cursor, TInner>;
17
18 fn cursor(&self) -> Self::Cursor {
19 BatchCursorEnter::new(self.inner().cursor())
20 }
21}
22
23pub struct BatchCursorEnter<C, TInner> {
25 phantom: ::std::marker::PhantomData<TInner>,
26 cursor: C,
27}
28
29impl<C, TInner> BatchCursorEnter<C, TInner> {
30 fn new(cursor: C) -> Self {
31 BatchCursorEnter {
32 phantom: ::std::marker::PhantomData,
33 cursor,
34 }
35 }
36}
37
38impl<TInner, C: Cursor> Cursor for BatchCursorEnter<C, TInner>
39where
40 TInner: Refines<C::Time>+Lattice,
41{
42 type Storage = BatchEnter<C::Storage, TInner>;
43
44 type Key<'a> = C::Key<'a>;
45 type ValOwn = C::ValOwn;
46 type Val<'a> = C::Val<'a>;
47 type KeyContainer = C::KeyContainer;
48 type ValContainer = C::ValContainer;
49 type DiffContainer = C::DiffContainer;
50 type Diff = C::Diff;
51 type DiffGat<'a> = C::DiffGat<'a>;
52 type TimeContainer = Vec<TInner>;
53 type Time = <Vec<TInner> as BatchContainer>::Owned;
54 type TimeGat<'a> = <Vec<TInner> as BatchContainer>::ReadItem<'a>;
55
56 #[inline] fn key_valid(&self, storage: &Self::Storage) -> bool { self.cursor.key_valid(storage.inner()) }
57 #[inline] fn val_valid(&self, storage: &Self::Storage) -> bool { self.cursor.val_valid(storage.inner()) }
58
59 #[inline] fn key<'a>(&self, storage: &'a Self::Storage) -> Self::Key<'a> { self.cursor.key(storage.inner()) }
60 #[inline] fn val<'a>(&self, storage: &'a Self::Storage) -> Self::Val<'a> { self.cursor.val(storage.inner()) }
61
62 #[inline] fn get_key<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Key<'a>> { self.cursor.get_key(storage.inner()) }
63 #[inline] fn get_val<'a>(&self, storage: &'a Self::Storage) -> Option<Self::Val<'a>> { self.cursor.get_val(storage.inner()) }
64
65 #[inline]
66 fn map_times<L: FnMut(&TInner, Self::DiffGat<'_>)>(&mut self, storage: &Self::Storage, mut logic: L) {
67 self.cursor.map_times(storage.inner(), |time, diff| {
68 logic(&TInner::to_inner(C::owned_time(time)), diff)
69 })
70 }
71
72 #[inline] fn step_key(&mut self, storage: &Self::Storage) { self.cursor.step_key(storage.inner()) }
73 #[inline] fn seek_key(&mut self, storage: &Self::Storage, key: Self::Key<'_>) { self.cursor.seek_key(storage.inner(), key) }
74
75 #[inline] fn step_val(&mut self, storage: &Self::Storage) { self.cursor.step_val(storage.inner()) }
76 #[inline] fn seek_val(&mut self, storage: &Self::Storage, val: Self::Val<'_>) { self.cursor.seek_val(storage.inner(), val) }
77
78 #[inline] fn rewind_keys(&mut self, storage: &Self::Storage) { self.cursor.rewind_keys(storage.inner()) }
79 #[inline] fn rewind_vals(&mut self, storage: &Self::Storage) { self.cursor.rewind_vals(storage.inner()) }
80}