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
+11 -11
View File
@@ -8,19 +8,19 @@ edition = "2021"
path = "src/commonio.rs"
[dependencies]
tokio = { version = "1.7.1", features = ["io-util", "net", "time", "sync", "fs", "parking_lot"] }
tracing = "0.1.26"
tokio = { version = "=1.16.1", features = ["io-util", "net", "time", "sync", "fs", "parking_lot"] }
tracing = "0.1"
futures-core = "0.3.15"
futures-util = "0.3.15"
bytes = "1.0.1"
serde = "1.0.126"
serde_derive = "1.0.126"
serde_json = "1.0.64"
bincode = "1.3.3"
chrono = "0.4.19"
async-channel = "1.6"
parking_lot = "0.11.2"
crc32fast = "1.2.1"
bytes = "1"
serde = { version = "1", features = ["derive"] }
serde_derive = "1"
serde_json = "1"
bincode = "1.3"
chrono = "0.4"
async-channel = "1"
parking_lot = "0.11"
crc32fast = "1.2"
err = { path = "../err" }
taskrun = { path = "../taskrun" }
netpod = { path = "../netpod" }
+8 -1
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>>,
}