valkey-bloom-dev
Valkey Bloom Module - Contributor Reference
Not This Skill
- Using BF.ADD/BF.EXISTS/BF.RESERVE in applications -> use valkey
- Valkey server internals -> use valkey-dev
Routing
- BloomObject struct, scaling, sub-filters, tightening ratio, fp_rate, expansion, VALIDATESCALETO -> Architecture (bloom-object)
- BloomFilter struct, bloomfilter crate, seed handling, random vs fixed, item add/check -> Architecture (bloom-filter)
- RDB save/load, AOF rewrite, bincode serialization, BF.LOAD encoding, copy callback -> Architecture (persistence)
- Defrag callbacks, cursor-based defrag, INFO bf metrics, atomic counters -> Architecture (defrag-metrics)
- Memory layout, SipHash, memory limit, validate_size, bloom-memory-usage-limit -> Architecture (bloom-object)
- Module initialization, valid_server_version, HANDLE_IO_ERRORS -> Architecture (bloom-object)
- BF.ADD, BF.MADD, BF.EXISTS, BF.MEXISTS, BF.CARD, BF.INFO, auto-creation -> Commands (command-handlers)
- BF.INFO field queries: CAPACITY, SIZE, FILTERS, ITEMS, ERROR, EXPANSION -> Commands (command-handlers)
- BF.RESERVE, BF.INSERT, BF.LOAD, NOCREATE, argument parsing -> Commands (bf-reserve-insert)
- TIGHTENING/SEED as replication-only args, BF.LOAD deserialization, BUSYKEY -> Commands (bf-reserve-insert)
- Replication strategy, ReplicateArgs, reserve vs add-only, deterministic replication -> Commands (replication)
- must_obey_client, valkey_8_0 feature, 8.0 vs 8.1 compat, size limit bypass -> Commands (replication)
- Keyspace notifications, bloom.add, bloom.reserve, replicate_verbatim -> Commands (replication)
- bloom-memory-usage-limit, bloom-capacity, bloom-expansion, bloom-defrag-enabled -> Commands (module-configs)
- bloom-fp-rate, bloom-tightening-ratio, on_string_config_set, string->f64 validation -> Commands (module-configs)
- bloom-use-random-seed, FIXED_SEED, module_args_as_configuration -> Commands (module-configs)
- Cargo build, feature flags, clippy, cdylib, ValkeyAlloc, build.sh -> Contributing (build)
- Unit tests, rstest, parameterized tests, cargo test -> Contributing (testing)
- Python integration tests, pytest, valkey-test-framework, conftest -> Contributing (testing)
- CI pipeline, GitHub Actions, build-ubuntu, build-macos, asan-build -> Contributing (ci-pipeline)
- ASAN, LeakSanitizer, skip_for_asan, sanitizer detection -> Contributing (ci-pipeline)
- Code structure, adding commands, command_handler.rs, data_type.rs, directory layout -> Contributing (code-structure)
- ACL category, BloomError, command metadata JSON, module registration -> Contributing (code-structure)
Quick Start
# Build for Valkey >= 8.1
cargo build --release
# Build for Valkey 8.0
cargo build --release --features valkey_8_0
# Unit tests (requires system allocator)
cargo test --features enable-system-alloc
# Load into Valkey
valkey-server --loadmodule ./target/release/libvalkey_bloom.so
# Integration tests (requires running Valkey with module loaded)
python3 -m pytest tests/ -v
Commands: BF.ADD, BF.MADD, BF.EXISTS, BF.MEXISTS, BF.CARD, BF.RESERVE, BF.INFO, BF.INSERT, BF.LOAD
Critical Rules
- ValkeyAlloc is the global allocator - the module uses
#[global_allocator]with ValkeyAlloc so Valkey tracks all memory; unit tests need--features enable-system-allocto swap in the system allocator - Seeds must be deterministic for replication - BF.INSERT sends SEED and TIGHTENING as replication-only arguments to ensure replicas build identical filters
- Respect bloom-memory-usage-limit - size validation via
validate_sizemust pass before creating or scaling; replicas bypass viamust_obey_client - Feature flag for 8.0 compat -
--features valkey_8_0gates APIs unavailable on Valkey 8.0 (e.g., keyspace notifications) - Tests are non-negotiable - unit tests via rstest + cargo test, integration tests via pytest with valkey-test-framework
- CI runs ASAN builds - address sanitizer catches memory issues; use
skip_for_asanfor tests incompatible with leak detection
Architecture
| Topic | Reference |
|---|---|
| BloomObject struct, scaling mechanism, FP tightening, memory limits, VALIDATESCALETO | bloom-object |
| BloomFilter struct, bloomfilter crate, seed handling, item add/check flow | bloom-filter |
| RDB save/load, AOF rewrite, bincode encode/decode, copy callback, data type registration | persistence |
| Defrag callbacks, cursor-based incremental defrag, INFO bf metrics, atomic counters | defrag-metrics |
Commands and Replication
| Topic | Reference |
|---|---|
| BF.ADD, BF.MADD, BF.EXISTS, BF.MEXISTS, BF.CARD, BF.INFO handlers | command-handlers |
| BF.RESERVE, BF.INSERT, BF.LOAD, NOCREATE, VALIDATESCALETO, replication args | bf-reserve-insert |
| Deterministic replication, must_obey_client, keyspace notifications | replication |
| All 7 configs, defaults, ranges, on_string_config_set, module_args_as_configuration | module-configs |
Build and Contributing
| Topic | Reference |
|---|---|
| Cargo.toml, cdylib, dependencies, feature flags, ValkeyAlloc, build.sh | build |
| Unit tests (rstest, parameterized), integration test framework, test helpers | testing |
| GitHub Actions CI jobs, matrix versions, ASAN/LeakSanitizer, release workflow | ci-pipeline |
| Directory layout, module registration, command metadata JSON, error types, adding new commands | code-structure |
More from avifenesh/valkey-skills
valkey
Use when building apps with Valkey - caching, sessions, queues, locks, rate-limiting, leaderboards, counters, pub-sub, streams, scripting. Covers IFEQ/DELIFEQ, hash field TTL, COMMANDLOG. Not for server internals (valkey-dev) or ops (valkey-ops).
5valkey-dev
Use when contributing to the Valkey server - C internals, event loop, commands, data structures, cluster, replication, RDB/AOF, memory, threading, modules, Lua, RESP, tests. Not for app development (valkey) or ops (valkey-ops).
5valkey-ops
Use when deploying, configuring, monitoring, or troubleshooting self-hosted Valkey. Covers Sentinel, cluster, persistence, replication, security, Kubernetes, performance tuning. Not for app development (valkey) or server internals (valkey-dev).
5valkey-ecosystem
Use when evaluating the Valkey ecosystem - client libraries, modules (JSON, Bloom, Search), managed services (AWS, GCP, Aiven), monitoring tools, frameworks (Spring, Django, Rails), Docker/Kubernetes deployment, CI/CD patterns, migration from Redis, and developer tooling.
5glide-mq
Use when building message queues with glide-mq. Covers queue setup, producer/consumer patterns, job scheduling, workflows, batch processing, streaming, and suspend/resume. Not for migrating from BullMQ (migrate-bullmq) or Bee-Queue (migrate-bee).
4valkey-glide
Router for Valkey GLIDE per-language skills. Use when you need to find the right language-specific GLIDE skill or migration skill. Not for GLIDE library internals or contributing to GLIDE source code - use glide-dev instead.
4