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

HistoryBuffer Add pop_oldest #377

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Ryder-C
Copy link

@Ryder-C Ryder-C commented Aug 31, 2023

Motivation

There currently is no interface for removing elements from the HistoryBuffer.

Added

  • HistoryBuffer.pop_oldest()
  • HistoryBuffer.filled() getter to replace filled member variable
  • Unit test for HistoryBuffer.pop_oldest()

Changed

  • HistoryBuffer.len() to be a getter rather than computed on call.
  • HistoryBuffer.write()
  • HistoryBuffer.recent()
  • HistoryBuffer.oldest_ordered()
  • OldestOrdered.next()

Warning

HistoryBuffer.as_slice() no longer has the same meaning. The slice returned may contain unused values.

@Dirbaio
Copy link
Member

Dirbaio commented Oct 30, 2023

what's the use case for this? It seems to me there's a lot of overlap with Deque here. IMO if you need push/pop you should use Deque, and HistoryBuffer should be used only when you want to do "statistics" on the last N values, not as a queue you pop things from.

@Dirbaio Dirbaio marked this pull request as draft October 31, 2023 15:40
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.

3 participants