Skip to content

Remove &mut from some TraceReader calls. #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/operators/arrange/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
fn cursor_through(&mut self, frontier: AntichainRef<Tr::Time>) -> Option<(Tr::Cursor, <Tr::Cursor as Cursor<Tr::Key, Tr::Val, Tr::Time, Tr::R>>::Storage)> {
self.trace.borrow_mut().trace.cursor_through(frontier)
}
fn map_batches<F: FnMut(&Self::Batch)>(&mut self, f: F) { self.trace.borrow_mut().trace.map_batches(f) }
fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F) { self.trace.borrow().trace.map_batches(f) }
}

impl<Tr> TraceAgent<Tr>
Expand Down
2 changes: 1 addition & 1 deletion src/trace/implementations/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
}
fn get_physical_compaction(&mut self) -> &[Product<RootTimestamp,()>] { &self.spine.get_physical_compaction() }

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, f: F) {
fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F) {
self.spine.map_batches(f)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/trace/implementations/spine_fueled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ where
}
fn get_physical_compaction(&mut self) -> &[T] { &self.physical_frontier[..] }

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, mut f: F) {
fn map_batches<F: FnMut(&Self::Batch)>(&self, mut f: F) {
for batch in self.merging.iter().rev() {
match *batch {
Some(MergeState::Merging(ref batch1, ref batch2, _, _)) => { f(batch1); f(batch2); },
Expand Down
2 changes: 1 addition & 1 deletion src/trace/implementations/spine_fueled_neu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ where
}
fn get_physical_compaction(&mut self) -> AntichainRef<T> { self.physical_frontier.borrow() }

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, mut f: F) {
fn map_batches<F: FnMut(&Self::Batch)>(&self, mut f: F) {
for batch in self.merging.iter().rev() {
match batch {
MergeState::Double(MergeVariant::InProgress(batch1, batch2, _)) => { f(batch1); f(batch2); },
Expand Down
2 changes: 1 addition & 1 deletion src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub trait TraceReader {
/// This is currently used only to extract historical data to prime late-starting operators who want to reproduce
/// the stream of batches moving past the trace. It could also be a fine basis for a default implementation of the
/// cursor methods, as they (by default) just move through batches accumulating cursors into a cursor list.
fn map_batches<F: FnMut(&Self::Batch)>(&mut self, f: F);
fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F);

/// Reads the upper frontier of committed times.
///
Expand Down
2 changes: 1 addition & 1 deletion src/trace/wrappers/enter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ where
type Batch = BatchEnter<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Batch, TInner>;
type Cursor = CursorEnter<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Cursor, TInner>;

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, mut f: F) {
fn map_batches<F: FnMut(&Self::Batch)>(&self, mut f: F) {
self.trace.map_batches(|batch| {
f(&Self::Batch::make_from(batch.clone()));
})
Expand Down
2 changes: 1 addition & 1 deletion src/trace/wrappers/enter_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where
type Batch = BatchEnter<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Batch, TInner,F>;
type Cursor = CursorEnter<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Cursor, TInner,F>;

fn map_batches<F2: FnMut(&Self::Batch)>(&mut self, mut f: F2) {
fn map_batches<F2: FnMut(&Self::Batch)>(&self, mut f: F2) {
let logic = self.logic.clone();
self.trace.map_batches(|batch| {
f(&Self::Batch::make_from(batch.clone(), logic.clone()));
Expand Down
2 changes: 1 addition & 1 deletion src/trace/wrappers/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ where
type Batch = BatchFilter<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Batch, F>;
type Cursor = CursorFilter<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Cursor, F>;

fn map_batches<F2: FnMut(&Self::Batch)>(&mut self, mut f: F2) {
fn map_batches<F2: FnMut(&Self::Batch)>(&self, mut f: F2) {
let logic = self.logic.clone();
self.trace
.map_batches(|batch| f(&Self::Batch::make_from(batch.clone(), logic.clone())))
Expand Down
2 changes: 1 addition & 1 deletion src/trace/wrappers/freeze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ where
type Batch = BatchFreeze<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Batch, F>;
type Cursor = CursorFreeze<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Cursor, F>;

fn map_batches<F2: FnMut(&Self::Batch)>(&mut self, mut f: F2) {
fn map_batches<F2: FnMut(&Self::Batch)>(&self, mut f: F2) {
let func = &self.func;
self.trace.map_batches(|batch| {
f(&Self::Batch::make_from(batch.clone(), func.clone()));
Expand Down
2 changes: 1 addition & 1 deletion src/trace/wrappers/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ where
type Batch = BatchFrontier<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Batch>;
type Cursor = CursorFrontier<Tr::Key, Tr::Val, Tr::Time, Tr::R, Tr::Cursor>;

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, mut f: F) {
fn map_batches<F: FnMut(&Self::Batch)>(&self, mut f: F) {
let frontier = self.frontier.borrow();
self.trace.map_batches(|batch| f(&Self::Batch::make_from(batch.clone(), frontier)))
}
Expand Down
4 changes: 2 additions & 2 deletions src/trace/wrappers/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ where
::std::cell::RefCell::borrow_mut(&self.wrapper).trace.cursor_through(frontier)
}

fn map_batches<F: FnMut(&Self::Batch)>(&mut self, f: F) {
::std::cell::RefCell::borrow_mut(&self.wrapper).trace.map_batches(f)
fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F) {
::std::cell::RefCell::borrow(&self.wrapper).trace.map_batches(f)
}
}

Expand Down