mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-21 03:46:37 +00:00
todo:put_object
This commit is contained in:
+36
-6
@@ -1,13 +1,19 @@
|
||||
use anyhow::Result;
|
||||
use futures::StreamExt;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{endpoint::PoolEndpoints, format::FormatV3};
|
||||
use crate::{
|
||||
disk::DiskStore,
|
||||
endpoint::PoolEndpoints,
|
||||
format::FormatV3,
|
||||
store_api::{MakeBucketOptions, ObjectOptions, PutObjReader, StorageAPI},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Sets {
|
||||
pub id: Uuid,
|
||||
// pub sets: Vec<Objects>,
|
||||
pub disk_indexs: Vec<Vec<usize>>, // [set_count_idx][set_drive_count_idx] = disk_idx
|
||||
pub disk_indexs: Vec<Vec<Option<DiskStore>>>, // [set_count_idx][set_drive_count_idx] = disk_idx
|
||||
pub pool_idx: usize,
|
||||
pub endpoints: PoolEndpoints,
|
||||
pub format: FormatV3,
|
||||
@@ -18,6 +24,7 @@ pub struct Sets {
|
||||
|
||||
impl Sets {
|
||||
pub fn new(
|
||||
disks: Vec<Option<DiskStore>>,
|
||||
endpoints: &PoolEndpoints,
|
||||
fm: &FormatV3,
|
||||
pool_idx: usize,
|
||||
@@ -29,13 +36,18 @@ impl Sets {
|
||||
let mut disk_indexs = Vec::with_capacity(set_count);
|
||||
|
||||
for i in 0..set_count {
|
||||
let mut set_indexs = Vec::with_capacity(set_drive_count);
|
||||
let mut set_drive = Vec::with_capacity(set_drive_count);
|
||||
for j in 0..set_drive_count {
|
||||
let idx = i * set_drive_count + j;
|
||||
set_indexs.push(idx);
|
||||
if disks[idx].is_none() {
|
||||
set_drive.push(None);
|
||||
} else {
|
||||
let disk = disks[idx].clone();
|
||||
set_drive.push(disk);
|
||||
}
|
||||
}
|
||||
|
||||
disk_indexs.push(set_indexs);
|
||||
disk_indexs.push(set_drive);
|
||||
}
|
||||
|
||||
let sets = Self {
|
||||
@@ -52,7 +64,7 @@ impl Sets {
|
||||
|
||||
Ok(sets)
|
||||
}
|
||||
pub fn get_disks(&self, set_idx: usize) -> Vec<usize> {
|
||||
pub fn get_disks(&self, set_idx: usize) -> Vec<Option<DiskStore>> {
|
||||
self.disk_indexs[set_idx].clone()
|
||||
}
|
||||
}
|
||||
@@ -66,3 +78,21 @@ impl Sets {
|
||||
// pub set_drive_count: usize,
|
||||
// pub default_parity_count: usize,
|
||||
// }
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl StorageAPI for Sets {
|
||||
async fn make_bucket(&self, bucket: &str, opts: &MakeBucketOptions) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
async fn put_object(
|
||||
&self,
|
||||
bucket: &str,
|
||||
object: &str,
|
||||
data: &PutObjReader,
|
||||
opts: &ObjectOptions,
|
||||
) -> Result<()> {
|
||||
// data.stream.next();
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user