Fix bug:#45 #43 #42

This commit is contained in:
weisd
2024-09-18 13:53:13 +08:00
parent bac129069b
commit b715eb530a
3 changed files with 12 additions and 3 deletions
+4 -1
View File
@@ -439,6 +439,7 @@ impl DiskAPI for LocalDisk {
} }
async fn get_disk_id(&self) -> Option<Uuid> { async fn get_disk_id(&self) -> Option<Uuid> {
warn!("local get_disk_id");
// TODO: check format file // TODO: check format file
let format_info = self.format_info.lock().await; let format_info = self.format_info.lock().await;
@@ -446,8 +447,10 @@ impl DiskAPI for LocalDisk {
// TODO: 判断源文件id,是否有效 // TODO: 判断源文件id,是否有效
} }
async fn set_disk_id(&self, _id: Option<Uuid>) -> Result<()> { async fn set_disk_id(&self, id: Option<Uuid>) -> Result<()> {
// 本地不需要设置 // 本地不需要设置
let mut format_info = self.format_info.lock().await;
format_info.id = id;
Ok(()) Ok(())
} }
+1 -1
View File
@@ -360,7 +360,7 @@ impl PeerS3Client for LocalPeerS3Client {
.ok_or(Error::new(DiskError::VolumeNotFound)) .ok_or(Error::new(DiskError::VolumeNotFound))
} }
async fn delete_bucket(&self, bucket: &str, opts: &DeleteBucketOptions) -> Result<()> { async fn delete_bucket(&self, bucket: &str, _opts: &DeleteBucketOptions) -> Result<()> {
let local_disks = all_local_disk().await; let local_disks = all_local_disk().await;
let mut futures = Vec::with_capacity(local_disks.len()); let mut futures = Vec::with_capacity(local_disks.len());
+7 -1
View File
@@ -2,6 +2,7 @@ use std::collections::HashMap;
use futures::future::join_all; use futures::future::join_all;
use http::HeaderMap; use http::HeaderMap;
use tracing::warn;
use uuid::Uuid; use uuid::Uuid;
use crate::{ use crate::{
@@ -55,6 +56,7 @@ impl Sets {
let idx = i * set_drive_count + j; let idx = i * set_drive_count + j;
let mut disk = disks[idx].clone(); let mut disk = disks[idx].clone();
if disk.is_none() { if disk.is_none() {
warn!("sets new set_drive {}-{} is none", i, j);
set_drive.push(None); set_drive.push(None);
continue; continue;
} }
@@ -66,6 +68,7 @@ impl Sets {
}; };
if local_disk.is_none() { if local_disk.is_none() {
warn!("sets new set_drive {}-{} local_disk is none", i, j);
set_drive.push(None); set_drive.push(None);
continue; continue;
} }
@@ -78,10 +81,13 @@ impl Sets {
if let Some(_disk_id) = disk.as_ref().unwrap().get_disk_id().await { if let Some(_disk_id) = disk.as_ref().unwrap().get_disk_id().await {
set_drive.push(disk); set_drive.push(disk);
} else { } else {
warn!("sets new set_drive {}-{} get_disk_id is none", i, j);
set_drive.push(None); set_drive.push(None);
} }
} }
warn!("sets new set_drive {:?}", &set_drive);
let set_disks = SetDisks { let set_disks = SetDisks {
disks: set_drive, disks: set_drive,
set_drive_count, set_drive_count,
@@ -320,7 +326,7 @@ impl StorageAPI for Sets {
.await .await
} }
async fn delete_bucket(&self, _bucket: &str, opts: &DeleteBucketOptions) -> Result<()> { async fn delete_bucket(&self, _bucket: &str, _opts: &DeleteBucketOptions) -> Result<()> {
unimplemented!() unimplemented!()
} }
} }