init:store

This commit is contained in:
weisd
2024-06-27 18:18:38 +08:00
parent fd626ec94d
commit 8d820c3096
7 changed files with 476 additions and 76 deletions
+20
View File
@@ -0,0 +1,20 @@
use std::fmt::Debug;
use anyhow::Error;
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 rename_file(
&self,
src_volume: &str,
src_path: &str,
dst_volume: &str,
dst_path: &str,
) -> Result<(), Error>;
async fn make_volumes(&self, volume: Vec<&str>) -> Result<(), Error>;
async fn make_volume(&self, volume: &str) -> Result<(), Error>;
}