mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-26 12:34:22 +01:00
The logging code that writes out transactions to disk needs to write out the byte array that we actually use. The code is less hairly without the generics so drop them.
33 lines
612 B
Rust
33 lines
612 B
Rust
use std::fmt::Debug;
|
|
|
|
use crate::mvcc::database::{LogRecord, Result};
|
|
use crate::mvcc::errors::DatabaseError;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Storage {
|
|
Noop,
|
|
}
|
|
|
|
impl Storage {
|
|
pub fn new_noop() -> Self {
|
|
Self::Noop
|
|
}
|
|
}
|
|
|
|
impl Storage {
|
|
pub fn log_tx(&self, _m: LogRecord) -> Result<()> {
|
|
match self {
|
|
Self::Noop => (),
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
pub fn read_tx_log(&self) -> Result<Vec<LogRecord>> {
|
|
match self {
|
|
Self::Noop => Err(DatabaseError::Io(
|
|
"cannot read from Noop storage".to_string(),
|
|
)),
|
|
}
|
|
}
|
|
}
|