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

[collections] Enhancement: refactor RingBuffer to operate more like a pipe #983

Merged
merged 3 commits into from
Nov 8, 2023

Conversation

kyleholohan
Copy link
Contributor

This PR includes the following enhancements:

  • Refactors the RingBuffer class to operate more like a pipe: once instantiated, it may be opened to produce a (RingProducer, RingConsumer) pair. These classes have the respective enqueue/dequeue operations exposed.
  • Adds a type class constraint for the size pointers in RingBuffer. As a compelling example, XDP requires ring buffers to use 32-bit sizes.
  • Creates the trait IntSize which allows RingBuffer to juggle various size types (no wider than usize).
  • Changes the memory ordering to release-acquire semantics, which are fully sufficient for a SPSC model.
  • Re-exposes the ring as a public export from collections mod.

Copy link
Contributor

@ppenna ppenna left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for working on this.

I left some minor suggestions.

src/rust/collections/mod.rs Outdated Show resolved Hide resolved
src/rust/collections/ring.rs Show resolved Hide resolved
src/rust/collections/ring.rs Outdated Show resolved Hide resolved
src/rust/collections/ring.rs Outdated Show resolved Hide resolved
@kyleholohan kyleholohan force-pushed the enhancement-collections-ring-concurrency branch from d06dc7b to 7748e6f Compare November 7, 2023 22:45
@kyleholohan kyleholohan merged commit c317d1f into dev Nov 8, 2023
11 checks passed
@kyleholohan kyleholohan deleted the enhancement-collections-ring-concurrency branch November 8, 2023 19:10
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.

None yet

2 participants