Skip to content

Conversation

@SkArchon
Copy link
Contributor

@SkArchon SkArchon commented Jan 13, 2026

Description

This PR is based off of the PR here #460, I have opened a new PR as this only contains a subset of the changes, and I do not have access to push to the original authors fork.

This PR only contains the iteration function, which iterates on values.

cc: @ilyatotl, @mangalaman93

Checklist

  • Code compiles correctly and linting passes locally
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

@SkArchon SkArchon requested a review from a team as a code owner January 13, 2026 15:08
@CLAassistant
Copy link

CLAassistant commented Jan 13, 2026

CLA assistant check
All committers have signed the CLA.

@SkArchon
Copy link
Contributor Author

SkArchon commented Jan 13, 2026

@mangalaman93 Please do let me know if this PR is sufficient for merged based on your earlier comment here #460 (review).

I'm assuming based on the CLAssistant, @ilyatotl will need to sign the CLA, if not I might have to squash his commits.

@SkArchon SkArchon changed the title fix: updates fix: iterate on elements Jan 13, 2026
@matthewmcneely
Copy link
Collaborator

@SkArchon While I can appreciate the usefulness of a first class iterator, I'm worried about the increase in overall memory usage this PR will introduce. 16 bytes for the OriginalKey field, which represents a 20% increase in memory use. Not trivial. My guess is this is why the original authors left it out.

Could you not roll-your-own by embedding a Cache inside your own struct? Implement Set and Get and store the keys in a Map, then provide the Iter func from there?

@SkArchon
Copy link
Contributor Author

SkArchon commented Jan 16, 2026

Hi @matthewmcneely, I am happy to remove the OriginalKey attribute, as we don't need it for our use case, I left it in because nothing was mentioned regarding it by the previous reviewer in the original PR. Will this work for you? If so I can update the PR. I would assume I could rename the function it into IterValues.

For context, we want to repopulate the ristretto cache upon restarts of our router (from the previous instance of the ristretto cache), so with evictions and such using the actual ristretto cache makes sense since it will be the source of truth. But on top of this we would also prefer to not do this if possible by having another map and lock on it for Set and Get wrappers since its on the hot path.

@matthewmcneely
Copy link
Collaborator

@SkArchon Happy to review a version without the addition of an Item field.

@SkArchon SkArchon force-pushed the milinda/iterating_elements branch 2 times, most recently from 21be33a to 5112a10 Compare January 18, 2026 19:17
@SkArchon
Copy link
Contributor Author

@matthewmcneely I have updated the PR to have iterations only on values, please do let me know if there are any changes to be made, I also squashed the commit history due to the original author being inactive to accept the CLA.

Copy link
Collaborator

@matthewmcneely matthewmcneely left a comment

Choose a reason for hiding this comment

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

Looking better, thanks!

@SkArchon
Copy link
Contributor Author

Also do let me know if you would like me to mark the conversations as resolved, or to wait for you the reviewer to mark it as resolved.

@matthewmcneely matthewmcneely changed the title fix: iterate on elements feat: add value iterator Jan 19, 2026
@SkArchon
Copy link
Contributor Author

Hi @matthewmcneely, I see that you have resolved your previous review comments, please do let me know what else is needed to get this merged.

@matthewmcneely
Copy link
Collaborator

@SkArchon Can you rebase your fork? I cannot resolve conflicts on forks.

@SkArchon SkArchon force-pushed the milinda/iterating_elements branch from f52c09a to fb3ddb3 Compare January 20, 2026 19:53
@SkArchon
Copy link
Contributor Author

Because of the merge commit I found it easier to squash. Anyway the merge-base is the tip of the main branch now.

@matthewmcneely matthewmcneely merged commit 3e164e4 into dgraph-io:main Jan 21, 2026
2 checks passed
@SkArchon
Copy link
Contributor Author

@matthewmcneely Quick question, would it be possible to have a ristretto release (so this would be included), I see the last release in August 2025.

@matthewmcneely
Copy link
Collaborator

@SkArchon We released v2.4.0 yesterday. Thanks for your contributions.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants