mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-19 11:06:17 +00:00
重写stores初始化
This commit is contained in:
+4
-2
@@ -2,7 +2,7 @@ mod config;
|
||||
mod storage;
|
||||
|
||||
use clap::Parser;
|
||||
use ecstore::error::Result;
|
||||
use ecstore::{disks_layout::DisksLayout, endpoints::EndpointServerPools, error::Result};
|
||||
use hyper_util::{
|
||||
rt::{TokioExecutor, TokioIo},
|
||||
server::conn::auto::Builder as ConnBuilder,
|
||||
@@ -66,10 +66,12 @@ async fn run(opt: config::Opt) -> Result<()> {
|
||||
// })
|
||||
// };
|
||||
|
||||
let (endpoint_pools, _) = EndpointServerPools::from_volumes(opt.address.clone().as_str(), opt.volumes.clone())?;
|
||||
|
||||
// Setup S3 service
|
||||
// 本项目使用s3s库来实现s3服务
|
||||
let service = {
|
||||
let mut b = S3ServiceBuilder::new(storage::ecfs::FS::new(opt.address.clone(), opt.volumes.clone()).await?);
|
||||
let mut b = S3ServiceBuilder::new(storage::ecfs::FS::new(opt.address.clone(), endpoint_pools).await?);
|
||||
//设置AK和SK
|
||||
//其中部份内容从config配置文件中读取
|
||||
let mut access_key = String::from_str(config::DEFAULT_ACCESS_KEY).unwrap();
|
||||
|
||||
@@ -24,6 +24,7 @@ use std::str::FromStr;
|
||||
use transform_stream::AsyncTryStream;
|
||||
use uuid::Uuid;
|
||||
|
||||
use ecstore::endpoints::EndpointServerPools;
|
||||
use ecstore::error::Result;
|
||||
use ecstore::store::ECStore;
|
||||
use tracing::debug;
|
||||
@@ -45,8 +46,8 @@ pub struct FS {
|
||||
}
|
||||
|
||||
impl FS {
|
||||
pub async fn new(address: String, endpoints: Vec<String>) -> Result<Self> {
|
||||
let store: ECStore = ECStore::new(address, endpoints).await?;
|
||||
pub async fn new(address: String, endpoint_pools: EndpointServerPools) -> Result<Self> {
|
||||
let store: ECStore = ECStore::new(address, endpoint_pools).await?;
|
||||
Ok(Self { store })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user