refactor(buffer): consolidate load_average_history with time_series_buffer#315
Merged
Merged
Conversation
…uffer Extract common ring buffer logic into detail::time_series_ring_buffer<Sample> template class to eliminate code duplication between time_series_buffer<T> and load_average_history. Changes: - Add time_series_ring_buffer<Sample> as internal base implementation - Refactor time_series_buffer<T> to use the new base class - Refactor load_average_history to use the new base class - Add missing <stdexcept> header include This reduces ~90% code duplication while maintaining the same public API. All existing tests pass. Closes #311
Use common::Result<T>::err() to propagate errors from the base ring buffer class instead of attempting to convert error codes.
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
…uffer (#315) * refactor(buffer): consolidate load_average_history with time_series_buffer Extract common ring buffer logic into detail::time_series_ring_buffer<Sample> template class to eliminate code duplication between time_series_buffer<T> and load_average_history. Changes: - Add time_series_ring_buffer<Sample> as internal base implementation - Refactor time_series_buffer<T> to use the new base class - Refactor load_average_history to use the new base class - Add missing <stdexcept> header include This reduces ~90% code duplication while maintaining the same public API. All existing tests pass. Closes #311 * fix(buffer): correct error propagation in get_latest method Use common::Result<T>::err() to propagate errors from the base ring buffer class instead of attempting to convert error codes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract common ring buffer logic into
detail::time_series_ring_buffer<Sample>template class to eliminate ~90% code duplication betweentime_series_buffer<T>andload_average_history.Changes
time_series_ring_buffer<Sample>as internal base implementation indetailnamespacetime_series_buffer<T>to use the new base classload_average_historyto use the new base class<stdexcept>header includeBenefits
Test Plan
Closes #311