#![forbid(unsafe_code)]
#![warn(missing_docs)]
mod aof;
pub mod feed_meta;
pub mod layout;
mod replay;
pub mod reshard;
mod rewrite_fmt;
mod shards_meta;
mod snapshot_fmt;
mod snapshot_payload;
mod snapshot_read;
mod snapshot_write;
pub use aof::{Aof, Fsync, RewritePlan, RewriteStats, write_aof_base};
pub use replay::replay_aof;
pub use shards_meta::{Routing, ShardsMeta, read_shards_meta, write_shards_meta};
pub use kevy_resp::{Argv, ArgvView};
pub use rewrite_fmt::dump_aof;
pub use snapshot_read::{
load_snapshot, load_snapshot_filtered, load_snapshot_from, read_snapshot_cursor,
};
pub use snapshot_write::{
save_snapshot, write_snapshot_tmp, write_snapshot_to, write_snapshot_to_with_cursor,
};
pub(crate) use rewrite_fmt::{dump_store_to_buf, estimate_multibulk_bytes, write_multibulk};
pub(crate) use snapshot_fmt::{SNAPSHOT_BUF_CAP, write_bytes};
pub(crate) use snapshot_write::write_stream_groups;
use kevy_store::Store;
use kevy_store::Value;
pub trait SnapshotSource {
fn for_each_entry(&self, f: impl FnMut(&[u8], &Value, Option<u64>));
fn for_each_hash_ttl(&self, _f: impl FnMut(&[u8], &[u8], u64)) {}
}
impl SnapshotSource for Store {
fn for_each_entry(&self, f: impl FnMut(&[u8], &Value, Option<u64>)) {
self.snapshot_each(f);
}
fn for_each_hash_ttl(&self, f: impl FnMut(&[u8], &[u8], u64)) {
self.hash_ttl_each(f);
}
}
impl SnapshotSource for kevy_store::SnapshotView {
fn for_each_entry(&self, f: impl FnMut(&[u8], &Value, Option<u64>)) {
self.each(f);
}
fn for_each_hash_ttl(&self, f: impl FnMut(&[u8], &[u8], u64)) {
self.each_hash_ttl(f);
}
}
#[cfg(test)]
mod tests;
#[cfg(test)]
mod tests_aof;
#[cfg(test)]
mod tests_rewrite;