Fix slow.rs

This commit is contained in:
Igor Katson 2024-05-03 13:52:33 +01:00
parent 4fbb3530ea
commit e9617e7f80
2 changed files with 11 additions and 3 deletions

View file

@ -37,7 +37,11 @@ impl<U: StorageFactory + Clone> StorageFactory for SlowStorageFactory<U> {
underlying: self.underlying_factory.init_storage(info)?,
pwrite_all_bufread: Mutex::new(Box::new(
BufReader::new(
File::open(std::env::var("DBG_PWRITE_ALL_FILENAME").unwrap()).unwrap(),
File::open(
std::env::var("DBG_PWRITE_ALL_FILENAME")
.expect("DBG_PWRITE_ALL_FILENAME env var not there"),
)
.unwrap(),
)
.lines()
.map(|l| l.unwrap().parse().unwrap())
@ -46,7 +50,11 @@ impl<U: StorageFactory + Clone> StorageFactory for SlowStorageFactory<U> {
)),
pread_exact_bufread: Mutex::new(Box::new(
BufReader::new(
File::open(std::env::var("DBG_PWRITE_ALL_FILENAME").unwrap()).unwrap(),
File::open(
std::env::var("DBG_PWRITE_ALL_FILENAME")
.expect("DBG_PWRITE_ALL_FILENAME env var not there"),
)
.unwrap(),
)
.lines()
.map(|l| l.unwrap().parse().unwrap())

View file

@ -303,7 +303,7 @@ async fn async_main(opts: Opts) -> anyhow::Result<()> {
fn wrap<S: StorageFactory + Clone>(s: S) -> impl StorageFactory {
#[cfg(feature = "debug_slow_disk")]
{
use librqbit::middleware::{
use librqbit::storage::middleware::{
slow::SlowStorageFactory, timing::TimingStorageFactory,
};
TimingStorageFactory::new("hdd".to_owned(), SlowStorageFactory::new(s))