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

Wrap txpool sender #438

Merged
merged 3 commits into from
Jun 26, 2022
Merged

Wrap txpool sender #438

merged 3 commits into from
Jun 26, 2022

Conversation

rakita
Copy link
Contributor

@rakita rakita commented Jun 24, 2022

Wrap txpool mpsc::Sender around Sender structure that gives us better ergonomic in calling functionalities from txpool,

related to: #429

@rakita rakita self-assigned this Jun 24, 2022
@rakita rakita added the enhancement New feature or request label Jun 24, 2022
Copy link
Contributor

@ControlCplusControlV ControlCplusControlV left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -26,6 +27,65 @@ pub trait TxPoolDb:
}
}

#[derive(Clone, Deref, DerefMut)]
pub struct Sender(mpsc::Sender<TxPoolMpsc>);
Copy link
Member

@Voxelot Voxelot Jun 24, 2022

Choose a reason for hiding this comment

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

[nit] I think we could increase the simplicity even further by making this abstraction avoid channel terminology as much as possible. Focusing on emphasizing the capabilities and intention of this facade, vs the mechanics of how it interacts with other components at a lower level.

Suggested change
pub struct Sender(mpsc::Sender<TxPoolMpsc>);
pub struct TxPoolClient(mpsc::Sender<TxPoolMpsc>);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this naming, will make the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is moving away from channel terminology a good thing when this is just a wrapper and channels are async primitives? As with Client, we are adding new abstraction naming when in essence it is mpsc::Sender inside.
I made the change here, but while coding the naming felt weird. 288ccef

@Voxelot
Copy link
Member

Voxelot commented Jun 24, 2022

thanks for cleaning up the .await.await's 😂

@rakita rakita enabled auto-merge (squash) June 26, 2022 08:51
@rakita rakita merged commit 485b098 into master Jun 26, 2022
@rakita rakita deleted the rakita/txpool_sender branch June 26, 2022 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fuel-txpool
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants