Skip to content

cache: add k8s-aligned ringbuffer helpers#21676

Open
yedou37 wants to merge 1 commit into
etcd-io:mainfrom
yedou37:feat-ringBuffer-helper
Open

cache: add k8s-aligned ringbuffer helpers#21676
yedou37 wants to merge 1 commit into
etcd-io:mainfrom
yedou37:feat-ringBuffer-helper

Conversation

@yedou37
Copy link
Copy Markdown
Contributor

@yedou37 yedou37 commented Apr 28, 2026

Add Len, ReplaceLatest, RemoveLess, and ensureCapacity functions to ringBuffer, and cover them with unit tests.

These helpers are not used in etcd today, but they keep the ringBuffer implementation aligned with the k8s snapshot ring work discussed at: kubernetes/kubernetes#138338 (comment)

@k8s-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yedou37
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Copy Markdown

Hi @yedou37. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Add Len, ReplaceLatest, RemoveLess, and ensureCapacity to ringBuffer, and cover them with focused unit tests.

These helpers are not used in etcd today, but they keep the ringBuffer implementation aligned with the k8s snapshot ring work discussed at:
kubernetes/kubernetes#138338 (comment)

Signed-off-by: YeRongyu <yedou37@zju.edu.cn>
@Jefftree
Copy link
Copy Markdown
Member

/ok-to-test

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.33%. Comparing base (e775342) to head (6451452).
⚠️ Report is 78 commits behind head on main.

Additional details and impacted files

see 79 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #21676      +/-   ##
==========================================
+ Coverage   68.48%   70.33%   +1.85%     
==========================================
  Files         432      426       -6     
  Lines       35540    35215     -325     
==========================================
+ Hits        24339    24768     +429     
+ Misses       9789     9056     -733     
+ Partials     1412     1391      -21     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e775342...6451452. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants