default impl for get_memory_io

This commit is contained in:
pedrocarlo
2025-08-13 15:03:05 -03:00
parent d5a59c6bee
commit 7bc0545442
8 changed files with 7 additions and 34 deletions

View File

@@ -38,10 +38,6 @@ impl IO for GenericIO {
fn run_once(&self) -> Result<()> {
Ok(())
}
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
}
impl Clock for GenericIO {

View File

@@ -3,7 +3,7 @@
use super::{common, Completion, CompletionInner, File, OpenFlags, IO};
use crate::io::clock::{Clock, Instant};
use crate::storage::wal::CKPT_BATCH_PAGES;
use crate::{turso_assert, LimboError, MemoryIO, Result};
use crate::{turso_assert, LimboError, Result};
use rustix::fs::{self, FlockOperation, OFlags};
use std::ptr::NonNull;
use std::{
@@ -528,10 +528,6 @@ impl IO for UringIO {
}
}
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
fn register_fixed_buffer(&self, ptr: std::ptr::NonNull<u8>, len: usize) -> Result<u32> {
turso_assert!(
len % 512 == 0,

View File

@@ -67,10 +67,6 @@ impl IO for MemoryIO {
// nop
Ok(())
}
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
}
pub struct MemoryFile {

View File

@@ -99,7 +99,9 @@ pub trait IO: Clock + Send + Sync {
i64::from_ne_bytes(buf)
}
fn get_memory_io(&self) -> Arc<MemoryIO>;
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
fn register_fixed_buffer(&self, _ptr: NonNull<u8>, _len: usize) -> Result<u32> {
Err(crate::LimboError::InternalError(

View File

@@ -1,4 +1,4 @@
use super::{Completion, File, MemoryIO, OpenFlags, IO};
use super::{Completion, File, OpenFlags, IO};
use crate::error::LimboError;
use crate::io::clock::{Clock, Instant};
use crate::io::common;
@@ -398,10 +398,6 @@ impl IO for UnixIO {
Ok(())
}
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
}
enum CompletionCallback {

View File

@@ -1,4 +1,4 @@
use super::{Buffer, Completion, File, MemoryIO, OpenFlags, IO};
use super::{Buffer, Completion, File, OpenFlags, IO};
use crate::ext::VfsMod;
use crate::io::clock::{Clock, Instant};
use crate::io::CompletionInner;
@@ -51,10 +51,6 @@ impl IO for VfsMod {
let vfs = unsafe { &*self.ctx };
unsafe { (vfs.gen_random_number)() }
}
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
}
impl VfsMod {

View File

@@ -35,11 +35,6 @@ impl IO for WindowsIO {
fn run_once(&self) -> Result<()> {
Ok(())
}
#[instrument(skip_all, level = Level::TRACE)]
fn get_memory_io(&self) -> Arc<MemoryIO> {
Arc::new(MemoryIO::new())
}
}
impl Clock for WindowsIO {

View File

@@ -5,7 +5,7 @@ use std::{
use rand::{RngCore, SeedableRng};
use rand_chacha::ChaCha8Rng;
use turso_core::{Clock, Instant, MemoryIO, OpenFlags, PlatformIO, Result, IO};
use turso_core::{Clock, Instant, OpenFlags, PlatformIO, Result, IO};
use crate::{
model::FAULT_ERROR_MSG,
@@ -128,8 +128,4 @@ impl IO for SimulatorIO {
fn generate_random_number(&self) -> i64 {
self.rng.borrow_mut().next_u64() as i64
}
fn get_memory_io(&self) -> Arc<turso_core::MemoryIO> {
Arc::new(MemoryIO::new())
}
}