use anyhow:Result

This commit is contained in:
weisd
2024-06-28 13:37:56 +08:00
parent a9e515e5c0
commit 4c7c3d4c96
10 changed files with 64 additions and 58 deletions
+6 -6
View File
@@ -1,20 +1,20 @@
use std::fmt::Debug;
use anyhow::Error;
use anyhow::Result;
use bytes::Bytes;
#[async_trait::async_trait]
pub trait DiskAPI: Debug + Send + Sync + 'static {
async fn read_all(&self, volume: &str, path: &str) -> Result<Bytes, Error>;
async fn write_all(&self, volume: &str, path: &str, data: Bytes) -> Result<(), Error>;
async fn read_all(&self, volume: &str, path: &str) -> Result<Bytes>;
async fn write_all(&self, volume: &str, path: &str, data: Bytes) -> Result<()>;
async fn rename_file(
&self,
src_volume: &str,
src_path: &str,
dst_volume: &str,
dst_path: &str,
) -> Result<(), Error>;
) -> Result<()>;
async fn make_volumes(&self, volume: Vec<&str>) -> Result<(), Error>;
async fn make_volume(&self, volume: &str) -> Result<(), Error>;
async fn make_volumes(&self, volume: Vec<&str>) -> Result<()>;
async fn make_volume(&self, volume: &str) -> Result<()>;
}