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

exchange: remove one layer of boxing #456

Merged
merged 2 commits into from
Mar 17, 2022

Conversation

petrosagg
Copy link
Contributor

@petrosagg petrosagg commented Mar 16, 2022

We were previously forced to use a boxed trait object because we were unable to name the type of the constructed closure.

This patch fixes it by introducing a custom ParallelizationHasher trait that the ParallelizationContractCore expects with a blanket implementation for all closures taking two arguments. This is to maintain backwards compatibility with any code thatpasses a closure directly to ExchangeCore::new.

Then a wrapper type DataHasher<F> is introduced that allows us to both specialize the ParallelizationHasher implementation for single argument closures and at the same time name the type which is what we need to remove one layer of boxed trait objects.

UPDATE: After discussion with @frankmcsherry and @antiguru it turns out that we'd rather remove the ability to distribute records based on time, which makes it even easier to remove the box. This PR is now changed to reflect that.

We were previously forced to use a boxed trait object because we were
unable to name the type of the constructed closure.

This patch fixes it by introducing a custom `ParallelizationHasher`
trait that the `ParallelizationContractCore` expects with a blanket
implementation for all closures taking two arguments. This is to
maintain backwards compatibility with any code that passes a closure
directly to `ExchangeCore::new`.

Then a wrapper type `DataHasher<F>` is introduced that allows us to both
specialize the `ParallelizationHasher` implementation for single
argument closures and at the same time name the type which is what we
need to remove one layer of boxed trait objects.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
@frankmcsherry frankmcsherry merged commit 7e313ee into TimelyDataflow:master Mar 17, 2022
@github-actions github-actions bot mentioned this pull request Oct 29, 2024
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