Skip to content

refactor: extract SeriesBuffer, add SeriesBufferInner#146

Open
KevinWMatthews wants to merge 6 commits intonominal-io:mainfrom
KevinWMatthews:kevin/refactor-series-buffer
Open

refactor: extract SeriesBuffer, add SeriesBufferInner#146
KevinWMatthews wants to merge 6 commits intonominal-io:mainfrom
KevinWMatthews:kevin/refactor-series-buffer

Conversation

@KevinWMatthews
Copy link
Contributor

@KevinWMatthews KevinWMatthews commented Dec 15, 2025

This PR is an opinionated solution to #139 and is an extension of/alternative to #144 and #145. It details one approach to how data hiding can be enforced more rigorously.

I'm not sure how you all at Nominal prefer to stack PRs, so rather than opening six more PRs I simply stacked commits in a single PR. While this is less noisy for the repo, it can be a bit challenging to review. If you prefer a different workflow, let me know and I can accommodate.

If you like some of these concepts but not all, they can be extracted from the chain and (with some manipulation) landed independently.

The concepts are:

  • extract implementation of points_len() into the PointsTypeExt trait for sharing
  • move SeriesBuffer into a new module, series_buffer.rs
  • move implementation of take() to SeriesBufferGuard
  • add SeriesBufferInner type
  • add with_lock() API to SeriesBuffer and SeriesBufferInner
  • move SeriesBufferInner into inner scope for additional data hiding

I rather like the idea of the with_lock() API, which clearly exposes the lifetime of the mutex guard. This idea was borrowed from:

@KevinWMatthews
Copy link
Contributor Author

Please give this a proper stress test before merging! The current unit tests are a useful sanity check but don't appear to put the system under serious load, and I haven't created a large data set to try to exercise this to production level.

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.

1 participant