mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 14:23:13 +00:00
todo: rpc walk_dir use writer
This commit is contained in:
@@ -1521,7 +1521,7 @@ impl DiskAPI for LocalDisk {
|
||||
|
||||
// FIXME: TODO: io.writer TODO cancel
|
||||
#[tracing::instrument(level = "debug", skip(self, wr))]
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<Vec<MetaCacheEntry>> {
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<()> {
|
||||
let volume_dir = self.get_bucket_path(&opts.bucket)?;
|
||||
|
||||
if !skip_access_checks(&opts.bucket) {
|
||||
@@ -1560,7 +1560,7 @@ impl DiskAPI for LocalDisk {
|
||||
let mut current = opts.base_dir.clone();
|
||||
self.scan_dir(&mut current, &opts, &mut out, &mut objs_returned).await?;
|
||||
|
||||
Ok(Vec::new())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// #[tracing::instrument(skip(self))]
|
||||
|
||||
@@ -211,7 +211,7 @@ impl DiskAPI for Disk {
|
||||
}
|
||||
}
|
||||
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<Vec<MetaCacheEntry>> {
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<()> {
|
||||
match self {
|
||||
Disk::Local(local_disk) => local_disk.walk_dir(opts, wr).await,
|
||||
Disk::Remote(remote_disk) => remote_disk.walk_dir(opts, wr).await,
|
||||
@@ -406,8 +406,8 @@ pub trait DiskAPI: Debug + Send + Sync + 'static {
|
||||
async fn stat_volume(&self, volume: &str) -> Result<VolumeInfo>;
|
||||
async fn delete_volume(&self, volume: &str) -> Result<()>;
|
||||
|
||||
// 并发边读边写 TODO: wr io.Writer
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<Vec<MetaCacheEntry>>;
|
||||
// 并发边读边写 w <- MetaCacheEntry
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, wr: &mut W) -> Result<()>;
|
||||
|
||||
// Metadata operations
|
||||
async fn delete_version(
|
||||
|
||||
+14
-11
@@ -351,7 +351,7 @@ impl DiskAPI for RemoteDisk {
|
||||
}
|
||||
|
||||
// FIXME: TODO: use writer
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, _wr: &mut W) -> Result<Vec<MetaCacheEntry>> {
|
||||
async fn walk_dir<W: AsyncWrite + Unpin + Send>(&self, opts: WalkDirOptions, _wr: &mut W) -> Result<()> {
|
||||
info!("walk_dir");
|
||||
let walk_dir_options = serde_json::to_string(&opts)?;
|
||||
let mut client = node_service_time_out_client(&self.addr)
|
||||
@@ -362,19 +362,22 @@ impl DiskAPI for RemoteDisk {
|
||||
walk_dir_options,
|
||||
});
|
||||
|
||||
let response = client.walk_dir(request).await?.into_inner();
|
||||
// TODO: use writer
|
||||
unimplemented!()
|
||||
|
||||
if !response.success {
|
||||
return Err(Error::from_string(response.error_info.unwrap_or("".to_string())));
|
||||
}
|
||||
// let response = client.walk_dir(request).await?.into_inner();
|
||||
|
||||
let entries = response
|
||||
.meta_cache_entry
|
||||
.into_iter()
|
||||
.filter_map(|json_str| serde_json::from_str::<MetaCacheEntry>(&json_str).ok())
|
||||
.collect();
|
||||
// if !response.success {
|
||||
// return Err(Error::from_string(response.error_info.unwrap_or("".to_string())));
|
||||
// }
|
||||
|
||||
Ok(entries)
|
||||
// let entries = response
|
||||
// .meta_cache_entry
|
||||
// .into_iter()
|
||||
// .filter_map(|json_str| serde_json::from_str::<MetaCacheEntry>(&json_str).ok())
|
||||
// .collect();
|
||||
|
||||
// Ok(entries)
|
||||
}
|
||||
|
||||
async fn rename_data(
|
||||
|
||||
Reference in New Issue
Block a user