Packages
ferricstore
0.9.0
0.11.12
0.11.11
0.11.10
0.11.9
0.11.8
0.11.7
0.11.6
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.3
0.10.2
0.10.1
0.10.0
0.9.1
0.9.0
0.8.0
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.2.0
0.1.0
FerricFlow durable workflows and queues with native-protocol storage, Raft durability, and Bitcask persistence.
Current section
Files
Jump to
Current section
Files
native/ferricstore_bitcask/src/cuckoo.rs
//! Cuckoo filter implementation for FerricStore.
//!
//! A space-efficient probabilistic data structure similar to Bloom filters,
//! but supporting deletion and approximate counting. Stores fingerprints of
//! elements in a hash table with two candidate bucket positions per element.
//!
//! ## File layout
//!
//! ```text
//! [magic: 2B][version: 1B][num_buckets: 4B][bucket_size: 1B]
//! [fingerprint_size: 1B][max_kicks: 2B][num_items: 8B][num_deletes: 8B]
//! [buckets: num_buckets * bucket_size * fingerprint_size bytes]
//! [mutation token: 16B]
//! ```
//!
//! Total header size: 27 bytes.
include!("sections/cuckoo_part_01.rs");
include!("sections/cuckoo_part_02.rs");
pub(crate) fn recover_sidecar(path: &std::path::Path) -> Result<(), String> {
let file = crate::open_random_rw_locked(path)
.map_err(|error| format!("open cuckoo sidecar for recovery: {error}"))?;
let header = cuckoo_read_header(&file)?;
crate::prob_txn::recover(
&file,
path,
cuckoo_mutation_token_offset(
header.num_buckets,
header.bucket_size,
header.fingerprint_size,
)?,
cuckoo_file_size(
header.num_buckets,
header.bucket_size,
header.fingerprint_size,
)?,
)
}
#[cfg(test)]
mod tests {
include!("sections/cuckoo_tests_part_01.rs");
include!("sections/cuckoo_tests_part_02.rs");
}