Skip to content
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

Remove BatchContainer::{copy, copy_range}. #508

Merged

Conversation

frankmcsherry
Copy link
Member

This PR replaces BatchContainer::copy with a PushInto requirement. We could leave the copy method while insisting on the PushInto implementation, if that provides more clarity about when we are specifically copying back a ReadItem, but it felt best to use the one idiom we have for implementing pushing into a container, vs having multiple implementations around (which we had).

BatchContainer::copy_range was removed because no one is using it. No harm adding it back, but in that case perhaps we instead want to support PushInto for a range type (or some wrapper around one).

@@ -510,7 +500,7 @@ pub mod containers {
use crate::trace::IntoOwned;

/// A general-purpose container resembling `Vec<T>`.
pub trait BatchContainer: 'static {
pub trait BatchContainer: for<'a> PushInto<Self::ReadItem<'a>> + 'static {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in person: We could opt out of requiring BatchContainer to be PushInto<...> which would permit implementing containers that cannot be pushed at. For the moment, the change as implemented is probably the right thing to do, but in the future we could split the trait into ReadBatchContainer and BatchContainer where the former does not expose any functionality to modify the contents of the container. There's a similar idea in flatcontainer: antiguru/flatcontainer#27

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I think this is a non-regression in the sense that copy prevents a read-only container also, and the main change is that in this PR that logic must be done through PushInto, and .. idk perhaps it's hard to use it for the implementation. But .. as long as it works for our current containers, great and it seems easy to roll back at any point.

@frankmcsherry frankmcsherry merged commit be698bc into TimelyDataflow:master May 31, 2024
7 checks passed
@frankmcsherry frankmcsherry deleted the remove_batchcontainer_copy branch May 31, 2024 14:52
@frankmcsherry
Copy link
Member Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants