重写stores初始化

This commit is contained in:
weisd
2024-09-10 16:27:35 +08:00
parent 32b64e74d0
commit f7e7f6e257
6 changed files with 18 additions and 10 deletions
+5
View File
@@ -408,6 +408,11 @@ impl AsMut<Vec<PoolEndpoints>> for EndpointServerPools {
}
impl EndpointServerPools {
pub fn from_volumes(server_addr: &str, endpoints: Vec<String>) -> Result<(EndpointServerPools, SetupType)> {
let layouts = DisksLayout::try_from(endpoints.as_slice())?;
Self::create_server_endpoints(server_addr, &layouts)
}
/// validates and creates new endpoints from input args, supports
/// both ellipses and without ellipses transparently.
pub fn create_server_endpoints(server_addr: &str, disks_layout: &DisksLayout) -> Result<(EndpointServerPools, SetupType)> {
+2 -2
View File
@@ -1,8 +1,8 @@
mod bucket_meta;
mod chunk_stream;
pub mod disk;
mod disks_layout;
mod endpoints;
pub mod disks_layout;
pub mod endpoints;
mod erasure;
pub mod error;
mod file_meta;
+3 -3
View File
@@ -32,12 +32,12 @@ pub struct ECStore {
}
impl ECStore {
pub async fn new(address: String, endpoints: Vec<String>) -> Result<Self> {
let layouts = DisksLayout::try_from(endpoints.as_slice())?;
pub async fn new(address: String, endpoint_pools: EndpointServerPools) -> Result<Self> {
// let layouts = DisksLayout::try_from(endpoints.as_slice())?;
let mut deployment_id = None;
let (endpoint_pools, _) = EndpointServerPools::create_server_endpoints(address.as_str(), &layouts)?;
// let (endpoint_pools, _) = EndpointServerPools::create_server_endpoints(address.as_str(), &layouts)?;
let mut pools = Vec::with_capacity(endpoint_pools.as_ref().len());
let mut disk_map = HashMap::with_capacity(endpoint_pools.as_ref().len());