mod data_file;
mod index_file;
pub mod internal;
mod pacer;
mod store;
mod types;
#[cfg(feature = "whitebox-testing")]
pub(crate) fn crash_point(name: &str) {
use std::sync::atomic::{AtomicU64, Ordering};
static COUNTER: AtomicU64 = AtomicU64::new(0);
let Ok(target) = std::env::var("CANDYSTORE_CRASH_POINT") else {
return;
};
if target != name {
return;
}
let after: u64 = std::env::var("CANDYSTORE_CRASH_AFTER")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(0);
if COUNTER.fetch_add(1, Ordering::Relaxed) >= after {
std::process::abort();
}
}
#[cfg(not(feature = "whitebox-testing"))]
#[inline(always)]
pub(crate) fn crash_point(_name: &str) {}
pub use crate::store::{
CandyStore, CandyTypedDeque, CandyTypedKey, CandyTypedList, CandyTypedStore, KVPair,
ListIterator,
};
pub use crate::types::*;
pub type CandyError = Error;
pub const MAX_KEY_LEN: usize = MAX_USER_KEY_SIZE;
pub const MAX_VALUE_LEN: usize = MAX_USER_VALUE_SIZE;