mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 23:47:28 +00:00
init:store
This commit is contained in:
+35
-6
@@ -1,9 +1,14 @@
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{disks_layout::DisksLayout, endpoint::create_server_endpoints};
|
||||
use crate::{
|
||||
disk::{self, DiskAPI, DiskOption},
|
||||
disks_layout::DisksLayout,
|
||||
endpoint::create_server_endpoints,
|
||||
format::FormatV3,
|
||||
};
|
||||
|
||||
use super::endpoint::Endpoint;
|
||||
use anyhow::Result;
|
||||
use anyhow::{Error, Result};
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
@@ -16,10 +21,20 @@ pub struct ECStore {
|
||||
}
|
||||
|
||||
impl ECStore {
|
||||
pub fn new(address: String, endpoints: Vec<String>) -> Result<Self> {
|
||||
pub async fn new(address: String, endpoints: Vec<String>) -> Result<Self> {
|
||||
let layouts = DisksLayout::new(endpoints)?;
|
||||
|
||||
let (pools, _) = create_server_endpoints(address, &layouts.pools, layouts.legacy)?;
|
||||
for (i, pool_eps) in pools.iter().enumerate() {
|
||||
let (disks, errs) = disk::init_disks(
|
||||
&pool_eps.endpoints,
|
||||
&DiskOption {
|
||||
cleanup: true,
|
||||
health_check: true,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
Ok(ECStore {
|
||||
id: Uuid::nil(),
|
||||
@@ -27,6 +42,23 @@ impl ECStore {
|
||||
peer: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
async fn load_formats(
|
||||
disks: Vec<Option<impl DiskAPI>>,
|
||||
heal: bool,
|
||||
) -> (Vec<FormatV3>, Vec<Error>) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn default_partiy_blocks(drive: usize) -> usize {
|
||||
match drive {
|
||||
1 => 0,
|
||||
2 | 3 => 1,
|
||||
4 | 5 => 2,
|
||||
6 | 7 => 3,
|
||||
_ => 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -44,7 +76,4 @@ pub struct Objects {
|
||||
pub default_parity_count: usize,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
trait DiskAPI: Debug + Send + Sync + 'static {}
|
||||
|
||||
pub trait StorageAPI: Debug + Send + Sync + 'static {}
|
||||
|
||||
Reference in New Issue
Block a user