Add exact Redis Stream trimming support - #104
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a caller-controlled switch to choose between Redis Stream approximate trimming (MAXLEN ~) and exact trimming (MAXLEN =) when writing stream entries via RedisAdapter, while keeping approximate trimming as the default for backward compatibility and throughput.
Changes:
- Extend
RA_ArgsAddwithapproximateTrim(defaulttrue) to allow opting into exactMAXLEN =trimming. - Thread the new option through all stream-write paths (
addSingleValue,addSingleDouble,addSingleList). - Add a Redis-backed test validating exact retention behavior and document the new argument in the API docs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test.cpp | Adds ExactTrim test validating strict retention when approximateTrim=false. |
| RedisAdapterTempl.hpp | Passes approximateTrim through templated stream write helpers to xaddTrim. |
| RedisAdapter.hpp | Adds RA_ArgsAdd::approximateTrim and wires it through addSingleList overloads + helper declaration. |
| RedisAdapter.cpp | Wires approximateTrim through the addSingleDouble stream write path. |
| mock/MockRedisAdapter.hpp | Keeps mock RA_ArgsAdd in sync with the real adapter’s argument struct. |
| docs/api.md | Documents the new RA_ArgsAdd.approximateTrim behavior and default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wsulli
approved these changes
Aug 7, 2026
8 tasks
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
RA_ArgsAdd::approximateTrimoption for Redis Stream writesMAXLEN ~behavior by defaultMAXLEN =trimmingargument
Motivation
Image streams can contain multi-megabyte entries, so Redis's approximate trim
may materially exceed a configured memory budget. The AreaDetector Redis data
plane uses this option to retain exactly 16 recent frames while keeping the
existing behavior unchanged for all current callers.
Verification
exact final entries
real-camera comparison and concurrent PVA/video fanout