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

P2P: async buffer #109

Merged
merged 4 commits into from
May 24, 2024
Merged

P2P: async buffer #109

merged 4 commits into from
May 24, 2024

Conversation

Boog900
Copy link
Member

@Boog900 Boog900 commented Apr 16, 2024

This adds an async buffer that works as a queue which supports arbitrary weights for values.

This is used between the block downloader and Cuprate.

@Boog900
Copy link
Member Author

Boog900 commented Apr 16, 2024

ready @hinto-janai @SyntheticBird45

Copy link
Member

@SyntheticBird45 SyntheticBird45 left a comment

Choose a reason for hiding this comment

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

I may be a bad reviewer on this one since I'm not comfortable with async implementations, but I didn't found anything strange.

@hinto-janai
Copy link
Contributor

Will review tomorrow but some questions:

  • Could this be in cuprate_helper::asynch?
  • What does weight mean in this context? What does it do?
  • Is there no other data structure like this? Do we have to make/maintain one?

@Boog900
Copy link
Member Author

Boog900 commented Apr 17, 2024

Could this be in cuprate_helper::asynch

I don't think so, this is more than just a helper function/ type

What does weight mean in this context? What does it do?

It's used to bound the channel, you specify a max weight and a weight for each item. For the block downloader the weight will be the size, in bytes, of the downloaded batch of blocks.

Is there no other data structure like this? Do we have to make/maintain one?

I couldn't find one, I don't think this is too much to maintain.

p2p/async-buffer/src/lib.rs Show resolved Hide resolved
p2p/async-buffer/src/lib.rs Show resolved Hide resolved
p2p/async-buffer/src/lib.rs Outdated Show resolved Hide resolved
p2p/async-buffer/src/lib.rs Show resolved Hide resolved
p2p/async-buffer/tests/basic.rs Show resolved Hide resolved
p2p/async-buffer/src/lib.rs Show resolved Hide resolved
p2p/async-buffer/src/lib.rs Show resolved Hide resolved
@Boog900 Boog900 requested a review from hinto-janai May 22, 2024 21:27
@Boog900 Boog900 changed the title async buffer P2P: async buffer May 22, 2024
@Boog900 Boog900 merged commit e8b20e6 into main May 24, 2024
7 checks passed
@Boog900 Boog900 deleted the async-buffer branch May 24, 2024 01:16
@hinto-janai hinto-janai added the A-p2p Related to P2P. label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-p2p Related to P2P.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants