Skip to content

Remove all Pusher/Puller boxing using GATs#460

Open
petrosagg wants to merge 4 commits intoTimelyDataflow:masterfrom
petrosagg:gats
Open

Remove all Pusher/Puller boxing using GATs#460
petrosagg wants to merge 4 commits intoTimelyDataflow:masterfrom
petrosagg:gats

Conversation

@petrosagg
Copy link
Contributor

Currently the Allocate::allocate method is hardcoded to return a (Vec<Box<dyn Push<Message<T>>>>, Box<dyn Pull<Message<T>>>) pair. Boxing was necessary because the generic T parameter was on the method.

Generic associated types is the missing piece to allow the concrete type to be spelled out and since they are right around the corner for stable Rust I went ahead and implemented it.

This PR removes every single use of a Box<dyn Puller/Pusher> instance in the codebase. It is not mergeable yet because it requires the nightly feature flag but we could discuss it and merge it once GATs are released.


/// A `ParallelizationContractCore` allocates paired `Push` and `Pull` implementors.
pub trait ParallelizationContractCore<T, D> {
pub trait ParallelizationContractCore<G: ScopeParent, D> {
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a regression. Can we leave it as T?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, just fixed that

to_push: None,
pushers,
puller,
pushers: pushers.into_iter().map(|p| Box::new(p) as Box<dyn Push<_>>).collect(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@frankmcsherry This is the only place I kept the trait objects because otherwise Progcaster would have to become generic over the pusher which would then add a generic parameter to Subgraph. I didn't know if that was ok but if it is I can eliminate this last bit of trait object if that sounds good

@petrosagg petrosagg force-pushed the gats branch 2 times, most recently from e602f8e to 2046265 Compare November 4, 2022 11:40
@petrosagg
Copy link
Contributor Author

This PR now compiles on stable!

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
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.

3 participants