Restructure config between the kinds of backends

This commit is contained in:
Dominik Werder
2022-02-18 19:24:14 +01:00
parent b7aaad7a7b
commit 96fa8b5b09
20 changed files with 195 additions and 138 deletions

View File

@@ -9,7 +9,7 @@ use netpod::log::*;
use netpod::{DiskStats, OpenStats, ReadExactStats, ReadStats, SeekStats};
use std::fmt;
use std::io::{self, SeekFrom};
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Instant;
use tokio::fs::{File, OpenOptions};
@@ -18,6 +18,13 @@ use tokio::io::{AsyncReadExt, AsyncSeekExt};
const LOG_IO: bool = true;
const STATS_IO: bool = true;
pub async fn tokio_read(path: impl AsRef<Path>) -> Result<Vec<u8>, Error> {
let path = path.as_ref();
tokio::fs::read(path)
.await
.map_err(|e| Error::with_msg_no_trace(format!("Can not open {path:?} {e:?}")))
}
pub struct StatsChannel {
chn: Sender<Sitemty<EventsItem>>,
}