mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-09 06:39:25 +00:00
fix: 调整init_disks位置
This commit is contained in:
+18
-3
@@ -3,8 +3,6 @@ pub mod error;
|
||||
pub mod format;
|
||||
mod local;
|
||||
|
||||
pub use local::{init_disks, DiskOption, DiskStore};
|
||||
|
||||
pub const RUSTFS_META_BUCKET: &str = ".rustfs.sys";
|
||||
pub const RUSTFS_META_MULTIPART_BUCKET: &str = ".rustfs.sys/multipart";
|
||||
pub const RUSTFS_META_TMP_BUCKET: &str = ".rustfs.sys/tmp";
|
||||
@@ -19,7 +17,7 @@ use crate::{
|
||||
store_api::{FileInfo, RawFileInfo},
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use std::{fmt::Debug, io::SeekFrom, pin::Pin};
|
||||
use std::{fmt::Debug, io::SeekFrom, pin::Pin, sync::Arc};
|
||||
use time::OffsetDateTime;
|
||||
use tokio::{
|
||||
fs::File,
|
||||
@@ -27,6 +25,18 @@ use tokio::{
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub type DiskStore = Arc<Box<dyn DiskAPI>>;
|
||||
|
||||
pub async fn new_disk(ep: &endpoint::Endpoint, opt: &DiskOption) -> Result<DiskStore> {
|
||||
if ep.is_local {
|
||||
let s = local::LocalDisk::new(ep, opt.cleanup).await?;
|
||||
Ok(Arc::new(Box::new(s)))
|
||||
} else {
|
||||
let _ = opt.health_check;
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait DiskAPI: Debug + Send + Sync + 'static {
|
||||
fn is_local(&self) -> bool;
|
||||
@@ -71,6 +81,11 @@ pub trait DiskAPI: Debug + Send + Sync + 'static {
|
||||
async fn read_multiple(&self, req: ReadMultipleReq) -> Result<Vec<ReadMultipleResp>>;
|
||||
}
|
||||
|
||||
pub struct DiskOption {
|
||||
pub cleanup: bool,
|
||||
pub health_check: bool,
|
||||
}
|
||||
|
||||
pub struct RenameDataResp {
|
||||
pub old_data_dir: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user