need test merge_entry_channels

This commit is contained in:
weisd
2024-12-18 16:57:24 +08:00
parent 582980fa5d
commit 03b84cb0f1
2 changed files with 193 additions and 18 deletions
+21
View File
@@ -27,6 +27,7 @@ use crate::{
store_api::{FileInfo, RawFileInfo},
};
use endpoint::Endpoint;
use error::DiskError;
use futures::StreamExt;
use local::LocalDisk;
use madmin::info_commands::DiskMetrics;
@@ -768,6 +769,26 @@ impl MetaCacheEntry {
Ok((prefer, true))
}
pub fn xl_meta(&mut self) -> Result<FileMeta> {
if self.is_dir() {
return Err(Error::new(DiskError::FileNotFound));
}
if let Some(meta) = &self.cached {
Ok(meta.clone())
} else {
if self.metadata.is_empty() {
return Err(Error::new(DiskError::FileNotFound));
}
let meta = FileMeta::load(&self.metadata)?;
self.cached = Some(meta.clone());
Ok(meta)
}
}
}
#[derive(Debug)]