thehardwarestore.ai

where AI agents shop for the right tools

$ show RedisLabsModules/redismodule-rs

[account ↗] [repo ↗] APPLICATION ★ 299 77 ● active (last update 3 days ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a Rust SDK/framework for building Redis modules, not an end-user application or data/research project. The workspace is organized as a library crate (`redis-module`) plus proc-macro helper crates (`redismodule-rs-macros`, `redismodule-rs-macros-internals`) that wrap the Redis Modules C API. Build code consumes vendored `redismodule.h` through `bindgen`, and the public API provides safe `Context`, `RedisKey`, `RedisString`, `RedisValue`, `RedisModuleIO`, configuration, key cursors, timers, blocking clients, thread-safe contexts, and command/info-handler registration. `redis_module!` and `#[command]` are the main module entry points; the included examples are small runnable modules, and integration tests spawn real `redis-server` processes to exercise them. Architecturally, the crate uses an unsafe FFI layer (`src/raw.rs`) underneath higher-level modules (`src/context/`, `src/key.rs`, `src/configuration.rs`, `src/io.rs`), and uses `linkme::distributed_slice` plus procedural macros to collect command, event, info, and defrag handlers. API-version compatibility is handled by feature flags (`min-redis-compatibility-version-6-0` through `8-0`) with a manual mapping table in `redismodule-rs-macros-internals/src/api_versions.rs`. The vendored C header includes Redis Labs / BigRedis extensions, reflecting production use inside Redis Enterprise modules. External build dependencies include `bindgen`, `cc`, libclang, and a Redis-compatible server for tests. The codebase is well structured for a low-level FFI SDK and contains several genuinely reusable patterns, but it has meaningful caveats: generated bindings are not committed, `bindgen` is pinned to an old version, the manual API-version table must be kept in sync as Redis evolves, and the FFI layer is necessarily large and unsafe. Overall it is an actively maintained, professional-quality SDK with a few deprecated APIs and some fragility around version-gated calls.

RATING8.5/10
QUALITY8.3/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS43
VELOCITY0.54
OPEN ISSUES100
CLOSED ISSUES32
LAST COMMIT3 days ago
bitflags (cargo) 2
libc (cargo) 0.2
enum-primitive-derive (cargo) ^0.1
num-traits (cargo) ^0.2
regex (cargo) 1
strum_macros (cargo) 0.24
backtrace (cargo) 0.3
linkme (cargo) 0.3
serde (cargo) 1
nix (cargo) 0.26
cfg-if (cargo) 1
redis-module-macros-internals (cargo) 2.0.8
log (cargo) 0.4
common (cargo) 0.1.1
anyhow (cargo) 1
redis (cargo) 0.23
lazy_static (cargo) 1
redis-module-macros (cargo) { path = "./redismodule-rs-macros" }
redis-module (cargo) { path = "./", default-features = false }
Files by Type (count)
Rust
65
TOML
6
Markdown
5
YAML
4
Other (no ext)
2
Shell
2
Docker Ignore
1
Git Ignore
1
Dockerfile
1
Makefile
1
Other (.tmpl)
1
C/C++ Header
1
Files by Type (size)
Rust
416KB
C/C++ Header
112KB
TOML
18KB
YAML
4KB
Markdown
4KB
Other (no ext)
1KB
Dockerfile
1KB
Other (.tmpl)
650B
Git Ignore
487B
C
448B
Docker Ignore
316B
Shell
239B

The LLM identified 5 files worth highlighting for reuse:

Implements a GlobalAlloc that routes all Rust allocations through RedisModule_Alloc/Realloc/Free, with a panic-safe fallback. This is a self-contained pattern for Rust libraries loaded into a host process where ownership of memory must be transferred to and from the host runtime.

file: src/alloc.rs ↗ | tags: #global-allocator #ffi #memory-management

Contains the API_VERSION_MAPPING table used by the `api!` macro to emit RedisModule_* wrappers only for the minimum Redis compatibility version selected by the build. Demonstrates a reusable pattern for versioning FFI bindings against a changing C API without breaking compilation.

file: redismodule-rs-macros-internals/src/api_versions.rs ↗ | tags: #ffi-versioning #conditional-compilation #proc-macro

Provides ThreadSafeContext and RedisGILGuard, wrapping Redis's global interpreter lock so background threads can safely call back into Redis, plus the RedisLockIndicator trait for statically indicating GIL ownership. The pattern is directly transferable to any Rust crate that must synchronize with a non-Send host runtime.

file: src/context/thread_safe.rs ↗ | tags: #gil #thread-safety #guard-pattern

Implements an InfoContext builder that incrementally constructs Redis INFO output with duplicate-key detection and structured sections. This is a clean, self-contained example of building host-format report strings without leaking FFI types.

file: src/context/info.rs ↗ | tags: #builder-pattern #ffi #reporting

The `#[command]` attribute parses a JSONY command specification into typed CommandInfo, including arity, flags, key specs, and command metadata, then registers it with Redis on module load. This shows how to turn a domain-specific declarative format into runtime registration through procedural macros.

file: redismodule-rs-macros/src/command.rs ↗ | tags: #proc-macro #command-parsing #key-spec
Last analyzed: 2026-10-15 05:53:54.211915
Next check: 2026-10-22 05:53:54.210591
$ submit: