feat: vendor the bigredis swap-prefetch API - #478
Merged
Conversation
`RedisModule_SwapPrefetchKey` schedules a key to be swapped in from disk and fires a callback once it lands; `RedisModule_IsKeyInRam` reports whether that is needed at all. Together they let a module read a bigredis keyspace without blocking on disk I/O. Both are RLEC extensions, and the vendored `redismodule.h` did not carry them even though it already carries the rest of the bigredis block. Copy the declarations verbatim from RediSearch's header and keep them in the same position relative to the `RedisModule_Big*` block, so a future re-vendor diffs cleanly. The three flag constants are emitted as `c_int` rather than bindgen's default `u32`, since they are passed as `SwapPrefetchKey`'s `int flags` argument. This reuses the arm that already does the same for `REDISMODULE_NOTIFY_*`. Callers reach these through `redis_module::raw`, as they do the rest of the bigredis block; no safe wrapper is added. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kei-nan
approved these changes
Aug 7, 2026
chesedo
added a commit
to RediSearch/RediSearch
that referenced
this pull request
Aug 11, 2026
Moves the `redis-module` pin onto the current tip of redismodule-rs master. The reason for the bump is RedisLabsModules/redismodule-rs#478, which vendors the bigredis swap-prefetch API — `RedisModule_SwapPrefetchKey`, `RedisModule_IsKeyInRam`, the `RedisModuleSwapPrefetchCB` typedef and the `REDISMODULE_SWAP_PREFETCH_FLAG_*` constants — into that crate's `redismodule.h`, so consumers no longer have to hand-declare them. RediSearchEnterprise is the consumer that needs this; nothing in this workspace uses the new symbols yet. The range also picks up #475, which swaps `to_str().unwrap()` for `to_string_lossy()` in `redis_command!` and `redis_event_handler!`. No crate here uses either macro, so it is inert for this workspace. The rev is duplicated in `workspace_hack/Cargo.toml`, which cargo-hakari generates. No manifest changed upstream between the two revs, so feature unification is unaffected and the update is a pure rev substitution. RediSearchEnterprise pins the same dependency and the two strings must stay byte-identical. Cargo derives source identity from the literal rev, so abbreviating one side would resolve the same commit through two sources and pull in two copies of the crate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
4 tasks
pull Bot
pushed a commit
to Stars1233/RediSearch
that referenced
this pull request
Aug 11, 2026
build(deps): bump redis-module to f4d68b9 Moves the `redis-module` pin onto the current tip of redismodule-rs master. The reason for the bump is RedisLabsModules/redismodule-rs#478, which vendors the bigredis swap-prefetch API — `RedisModule_SwapPrefetchKey`, `RedisModule_IsKeyInRam`, the `RedisModuleSwapPrefetchCB` typedef and the `REDISMODULE_SWAP_PREFETCH_FLAG_*` constants — into that crate's `redismodule.h`, so consumers no longer have to hand-declare them. RediSearchEnterprise is the consumer that needs this; nothing in this workspace uses the new symbols yet. The range also picks up RediSearch#475, which swaps `to_str().unwrap()` for `to_string_lossy()` in `redis_command!` and `redis_event_handler!`. No crate here uses either macro, so it is inert for this workspace. The rev is duplicated in `workspace_hack/Cargo.toml`, which cargo-hakari generates. No manifest changed upstream between the two revs, so feature unification is unaffected and the update is a pure rev substitution. RediSearchEnterprise pins the same dependency and the two strings must stay byte-identical. Cargo derives source identity from the literal rev, so abbreviating one side would resolve the same commit through two sources and pull in two copies of the crate. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Vendors
RedisModule_SwapPrefetchKey,RedisModule_IsKeyInRam, theRedisModuleSwapPrefetchCBtypedef and the threeREDISMODULE_SWAP_PREFETCH_FLAG_*constants, and wires both pointers up inRedisModule_InitAPI.Together these let a module read a bigredis keyspace without blocking on disk I/O:
IsKeyInRamreports whether a key is resident,SwapPrefetchKeyschedules a swap-in and fires a callback once it lands. Both are RLEC extensions our vendored header did not carry, even though it already carries the rest of the bigredis block. RediSearchEnterprise hand-declares them downstream today.Two notes for review:
src/redismodule.hand sit in the same position relative to theRedisModule_Big*block, so a future re-vendor diffs cleanly. The declaration order and the reversedREDISMODULE_GET_APIorder are both upstream's, preserved rather than tidied.build.rsgains oneint_macromapping so the flag constants emit asc_intrather than bindgen's defaultu32, since they are passed asSwapPrefetchKey'sint flagsargument. Same arm that already handlesREDISMODULE_NOTIFY_*.No safe wrapper is added — callers reach these through
redis_module::raw, as with the rest of the bigredis block.🤖 Generated with Claude Code