Skip to content

Refactor bloom filter to support async file I/O operations#617

Merged
hicder merged 1 commit intomasterfrom
hicder/async-bloom-filter
Jan 2, 2026
Merged

Refactor bloom filter to support async file I/O operations#617
hicder merged 1 commit intomasterfrom
hicder/async-bloom-filter

Conversation

@hicder
Copy link
Owner

@hicder hicder commented Jan 2, 2026

This commit converts the bloom filter implementation from synchronous to asynchronous to support non-blocking file I/O, enabling better performance in concurrent environments.

Key changes:

  • Made BloomFilter trait async using #[async_trait::async_trait]
  • Updated is_bit_set to return Result and be async
  • Converted check_bits and may_contain methods to async
  • Replaced direct memory mapping in ImmutableBloomFilter with FileIO trait for async file operations
  • Updated all implementations (BlockedBloomFilter, ImmutableBloomFilter)
  • Converted tests from #[test] to #[tokio::test]
  • Added proper error handling throughout with anyhow::Result

Files modified:

  • rs/utils/src/bloom_filter/mod.rs: Made trait async
  • rs/utils/src/bloom_filter/blocked_bloom_filter.rs: Updated implementation
  • rs/utils/src/bloom_filter/immutable_bloom_filter.rs: Uses FileIO instead of Mmap
  • rs/utils/src/bloom_filter/reader.rs: Updated to async read operations

This change enables bloom filters to work efficiently with async runtimes and distributed file systems where blocking operations are not desirable.

This commit converts the bloom filter implementation from synchronous to
asynchronous to support non-blocking file I/O, enabling better performance
in concurrent environments.

Key changes:
- Made BloomFilter trait async using #[async_trait::async_trait]
- Updated is_bit_set to return Result<bool> and be async
- Converted check_bits and may_contain methods to async
- Replaced direct memory mapping in ImmutableBloomFilter with FileIO trait
  for async file operations
- Updated all implementations (BlockedBloomFilter, ImmutableBloomFilter)
- Converted tests from #[test] to #[tokio::test]
- Added proper error handling throughout with anyhow::Result

Files modified:
- rs/utils/src/bloom_filter/mod.rs: Made trait async
- rs/utils/src/bloom_filter/blocked_bloom_filter.rs: Updated implementation
- rs/utils/src/bloom_filter/immutable_bloom_filter.rs: Uses FileIO instead of Mmap
- rs/utils/src/bloom_filter/reader.rs: Updated to async read operations

This change enables bloom filters to work efficiently with async runtimes
and distributed file systems where blocking operations are not desirable.
@hicder hicder merged commit 2fe0a5a into master Jan 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant