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

window svc channels struct #4977

Merged
merged 2 commits into from
Feb 14, 2025
Merged

Conversation

bw-solana
Copy link

@bw-solana bw-solana commented Feb 13, 2025

Problem

We pass around a ton of channels from TVU --> Window Service --> Repair & Ancestor Hashes. It makes the code hard to read and also exceeds the recommended params per function in several spots.

Additionally, this will make it easier to add some sub-structs to repair service to make it more digestible (next on my list).

Summary of Changes

No behavioral change expected. Three main things were done:

  1. Create some structs to hold service specific channels for ease of passing around.
  2. eliminate 3 clippy allows #[allow(clippy::too_many_arguments)]
  3. reduce a bunch of imports in window service

@bw-solana bw-solana marked this pull request as ready for review February 13, 2025 19:34
@bw-solana bw-solana requested a review from steviez February 13, 2025 19:34
Copy link

@steviez steviez left a comment

Choose a reason for hiding this comment

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

Just one nit, lemme know what you think.

It could also be nice to attach some comments to each channel, but I'd be happy to merge this without; don't want to punish a good deed as this is good cleanup as-is

core/src/repair/ancestor_hashes_service.rs Show resolved Hide resolved
@@ -433,12 +466,9 @@ impl RepairService {
&blockstore,
&exit,
&repair_socket,
&repair_request_quic_sender,
&repair_service_channels.repair_channels,
Copy link

Choose a reason for hiding this comment

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

nit: It looks like the caller takes an owned RepairServiceChannels.

  • For Self::run(), we are passing a reference
  • For AncestorHashesService::new(), we are passing the owned channels

For the sake of "symmetry", I think it'd be nice for these to match. I think you could pass owned here as well, since Rust can de-structure the struct implicitly

Copy link
Author

Choose a reason for hiding this comment

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

yeah, symmetry good 👍

@bw-solana bw-solana requested a review from steviez February 14, 2025 18:12
Copy link

@steviez steviez left a comment

Choose a reason for hiding this comment

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

LGTM

@bw-solana bw-solana merged commit cfaf849 into anza-xyz:master Feb 14, 2025
39 of 44 checks passed
@bw-solana bw-solana deleted the repair_channels branch February 14, 2025 18:27
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