use crate::engine::types::{DbError, LogEntry};
use crate::engine::storage::StorageBackend;
use std::ops::ControlFlow;
pub struct InMemoryStorage;
impl StorageBackend for InMemoryStorage {
fn write_entry(&self, _entry: &LogEntry) -> Result<(), DbError> {
Ok(())
}
fn read_log(&self) -> Result<Vec<LogEntry>, DbError> {
Ok(Vec::new())
}
fn compact(&self, _entries: Vec<LogEntry>) -> Result<(), DbError> {
Ok(())
}
fn read_at(&self, _offset: u64, _length: u32) -> Result<Vec<u8>, DbError> {
Err(DbError::Io(std::io::Error::new(
std::io::ErrorKind::Unsupported,
"read_at is not supported in --in-memory mode (no Cold documents exist)",
)))
}
fn stream_log_into(&self, _f: &mut dyn FnMut(LogEntry, u32) -> ControlFlow<(), ()>) -> Result<u64, DbError> {
Ok(0)
}
}