From 84d4a08128e8e7c8b1bb029bf2d2871c9972c672 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 11:15:49 +0800 Subject: [PATCH 01/77] clippy clippy clippy --- ecstore/src/disk/error.rs | 8 +++++ ecstore/src/disk/local.rs | 53 +++++++++++++++++++++++++-------- ecstore/src/file_meta.rs | 10 +++---- ecstore/src/notification_sys.rs | 1 + ecstore/src/set_disk.rs | 16 +++++----- ecstore/src/sets.rs | 4 +-- scripts/test.sh | 0 7 files changed, 66 insertions(+), 26 deletions(-) mode change 100644 => 100755 scripts/test.sh diff --git a/ecstore/src/disk/error.rs b/ecstore/src/disk/error.rs index 36e49f46c..1b8a2b92b 100644 --- a/ecstore/src/disk/error.rs +++ b/ecstore/src/disk/error.rs @@ -450,3 +450,11 @@ pub fn is_all_buckets_not_found(errs: &[Option]) -> bool { } errs.len() == not_found_count } + +pub fn is_err_os_not_exist(err: &Error) -> bool { + if let Some(os_err) = err.downcast_ref::() { + os_is_not_exist(os_err) + } else { + false + } +} diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 4ad6af745..7913e7a4d 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -12,8 +12,8 @@ use crate::bitrot::bitrot_verify; use crate::bucket::metadata_sys::{self}; use crate::cache_value::cache::{Cache, Opts, UpdateFn}; use crate::disk::error::{ - convert_access_error, is_sys_err_handle_invalid, is_sys_err_invalid_arg, is_sys_err_is_dir, is_sys_err_not_dir, - map_err_not_exists, os_err_to_file_err, + convert_access_error, is_err_os_not_exist, is_sys_err_handle_invalid, is_sys_err_invalid_arg, is_sys_err_is_dir, + is_sys_err_not_dir, map_err_not_exists, os_err_to_file_err, }; use crate::disk::os::{check_path_length, is_empty_dir}; use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE}; @@ -40,6 +40,7 @@ use crate::{ utils, }; use common::defer; +use nix::NixPath; use path_absolutize::Absolutize; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; @@ -57,7 +58,7 @@ use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{error, info, warn}; +use tracing::{info, warn}; use uuid::Uuid; #[derive(Debug)] @@ -399,22 +400,49 @@ impl LocalDisk { } /// read xl.meta raw data - #[tracing::instrument(level = "debug", skip(self, volume_dir, path))] + #[tracing::instrument(level = "debug", skip(self, volume_dir, file_path))] async fn read_raw( &self, bucket: &str, volume_dir: impl AsRef, - path: impl AsRef, + file_path: impl AsRef, read_data: bool, ) -> Result<(Vec, Option)> { - let meta_path = path.as_ref().join(Path::new(super::STORAGE_FORMAT_FILE)); - if read_data { - self.read_all_data_with_dmtime(bucket, volume_dir, meta_path).await - } else { - self.read_all_data_with_dmtime(bucket, volume_dir, meta_path).await - // FIXME: read_metadata only suport - // self.read_metadata_with_dmtime(meta_path).await + if file_path.as_ref().is_empty() { + return Err(Error::new(DiskError::FileNotFound)); } + + let meta_path = file_path.as_ref().join(Path::new(super::STORAGE_FORMAT_FILE)); + + let res = { + if read_data { + self.read_all_data_with_dmtime(bucket, volume_dir, meta_path).await + } else { + match self.read_metadata_with_dmtime(meta_path).await { + Ok(res) => Ok(res), + Err(err) => { + if is_err_os_not_exist(&err) + && !skip_access_checks(volume_dir.as_ref().to_string_lossy().to_string().as_str()) + { + if let Err(aerr) = access(volume_dir.as_ref()).await { + if os_is_not_exist(&aerr) { + return Err(Error::new(DiskError::VolumeNotFound)); + } + } + } + + Err(err) + } + } + } + }; + + let (buf, mtime) = res?; + if buf.is_empty() { + return Err(Error::new(DiskError::FileNotFound)); + } + + Ok((buf, mtime)) } async fn read_metadata(&self, file_path: impl AsRef) -> Result> { @@ -445,6 +473,7 @@ impl LocalDisk { let mut bytes = Vec::new(); bytes.try_reserve_exact(size)?; + // FIXME: real xl no data f.read_to_end(&mut bytes).await.map_err(os_err_to_file_err)?; let modtime = match meta.modified() { diff --git a/ecstore/src/file_meta.rs b/ecstore/src/file_meta.rs index 3afae0557..2a4fa0baf 100644 --- a/ecstore/src/file_meta.rs +++ b/ecstore/src/file_meta.rs @@ -484,7 +484,7 @@ impl FileMeta { } } - let mut fi = ver.into_fileinfo(volume, path, has_vid, all_parts)?; + let mut fi = ver.to_fileinfo(volume, path, has_vid, all_parts)?; fi.is_latest = is_latest; if let Some(_d) = succ_mod_time { fi.successor_mod_time = succ_mod_time; @@ -511,7 +511,7 @@ impl FileMeta { for version in self.versions.iter() { let mut file_version = FileMetaVersion::default(); file_version.unmarshal_msg(&version.meta)?; - let fi = file_version.into_fileinfo(volume, path, None, all_parts); + let fi = file_version.to_fileinfo(volume, path, None, all_parts); versions.push(fi); } @@ -553,10 +553,10 @@ pub struct FileMetaShallowVersion { } impl FileMetaShallowVersion { - pub fn into_fileinfo(&self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> Result { + pub fn to_fileinfo(&self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> Result { let file_version = FileMetaVersion::try_from(self.meta.as_slice())?; - Ok(file_version.into_fileinfo(volume, path, version_id, all_parts)) + Ok(file_version.to_fileinfo(volume, path, version_id, all_parts)) } } @@ -760,7 +760,7 @@ impl FileMetaVersion { FileMetaVersionHeader::from(self.clone()) } - pub fn into_fileinfo(self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> FileInfo { + pub fn to_fileinfo(&self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> FileInfo { match self.version_type { VersionType::Invalid => FileInfo { name: path.to_string(), diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index a36d14629..1487ec052 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -26,6 +26,7 @@ pub fn get_global_notification_sys() -> Option<&'static NotificationSys> { pub struct NotificationSys { peer_clients: Vec>, + #[allow(dead_code)] all_peer_clients: Vec>, } diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 152f2063f..4061024bc 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -177,6 +177,7 @@ impl SetDisks { } #[tracing::instrument(level = "debug", skip(disks, file_infos))] + #[allow(clippy::type_complexity)] async fn rename_data( disks: &[Option], src_bucket: &str, @@ -1107,9 +1108,9 @@ impl SetDisks { let finfo = match meta.into_fileinfo(bucket, object, "", true, true) { Ok(res) => res, Err(err) => { - for i in 0..errs.len() { - if errs[i].is_none() { - errs[i] = Some(err.clone()) + for item in errs.iter_mut() { + if item.is_none() { + *item = Some(err.clone()) } } @@ -1118,9 +1119,9 @@ impl SetDisks { }; if !finfo.is_valid() { - for i in 0..errs.len() { - if errs[i].is_none() { - errs[i] = Some(Error::new(DiskError::FileCorrupt)); + for item in errs.iter_mut() { + if item.is_none() { + *item = Some(Error::new(DiskError::FileCorrupt)); } } @@ -1629,6 +1630,7 @@ impl SetDisks { Ok((fi, parts_metadata, online_disks)) } + #[allow(clippy::too_many_arguments)] async fn get_object_with_fileinfo( // &self, bucket: &str, @@ -5008,7 +5010,7 @@ async fn get_disks_info(disks: &[Option], eps: &[Endpoint]) -> Vec>, eps: &Vec) -> madmin::StorageInfo { +async fn get_storage_info(disks: &[Option], eps: &[Endpoint]) -> madmin::StorageInfo { let mut disks = get_disks_info(disks, eps).await; disks.sort_by(|a, b| a.total_space.cmp(&b.total_space)); diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index 000fe458c..708805a9d 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -86,7 +86,7 @@ impl Sets { let mut disk_set = Vec::with_capacity(set_count); - for i in 0..set_count { + for (i, locker) in lockers.iter().enumerate().take(set_count) { let mut set_drive = Vec::with_capacity(set_drive_count); let mut set_endpoints = Vec::with_capacity(set_drive_count); for j in 0..set_drive_count { @@ -131,7 +131,7 @@ impl Sets { // warn!("sets new set_drive {:?}", &set_drive); let set_disks = SetDisks { - lockers: lockers[i].clone(), + lockers: locker.clone(), locker_owner: GLOBAL_Local_Node_Name.read().await.to_string(), ns_mutex: Arc::new(RwLock::new(NsLockMap::new(is_dist_erasure().await))), disks: RwLock::new(set_drive), diff --git a/scripts/test.sh b/scripts/test.sh old mode 100644 new mode 100755 From d99086c5aab7108be75ad583bc17259a95b26c7c Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 17:36:16 +0800 Subject: [PATCH 02/77] rewrite real_meta --- ecstore/src/disk/local.rs | 13 +- ecstore/src/file_meta.rs | 162 +++++++++++++- ecstore/src/lib.rs | 13 +- ecstore/src/notification_sys.rs | 5 + ecstore/src/store.rs | 207 +++++++++--------- ...{list_objects.rs => store_list_objects.rs} | 12 +- 6 files changed, 278 insertions(+), 134 deletions(-) rename ecstore/src/{list_objects.rs => store_list_objects.rs} (96%) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 7913e7a4d..8cca640b6 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -18,6 +18,7 @@ use crate::disk::error::{ use crate::disk::os::{check_path_length, is_empty_dir}; use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE}; use crate::error::{Error, Result}; +use crate::file_meta::read_xl_meta_no_data; use crate::global::{GLOBAL_IsErasureSD, GLOBAL_RootDiskThreshold}; use crate::heal::data_scanner::{has_active_rules, scan_data_folder, ScannerItem, SizeSummary}; use crate::heal::data_scanner_metric::{ScannerMetric, ScannerMetrics}; @@ -451,7 +452,6 @@ impl LocalDisk { Ok(data) } - // FIXME: read_metadata only suport async fn read_metadata_with_dmtime(&self, file_path: impl AsRef) -> Result<(Vec, Option)> { check_path_length(file_path.as_ref().to_string_lossy().as_ref())?; @@ -470,18 +470,15 @@ impl LocalDisk { } let size = meta.len() as usize; - let mut bytes = Vec::new(); - bytes.try_reserve_exact(size)?; - // FIXME: real xl no data - f.read_to_end(&mut bytes).await.map_err(os_err_to_file_err)?; + let data = read_xl_meta_no_data(&mut f, size).await?; let modtime = match meta.modified() { Ok(md) => Some(OffsetDateTime::from(md)), Err(_) => None, }; - Ok((bytes, modtime)) + Ok((data, modtime)) } async fn read_all_data(&self, volume: &str, volume_dir: impl AsRef, file_path: impl AsRef) -> Result> { @@ -1473,7 +1470,7 @@ impl DiskAPI for LocalDisk { let mut xlmeta = FileMeta::new(); if let Some(dst_buf) = has_dst_buf.as_ref() { - if FileMeta::is_xl_format(dst_buf) { + if FileMeta::is_xl2_v1_format(dst_buf) { if let Ok(nmeta) = FileMeta::load(dst_buf) { xlmeta = nmeta } @@ -1721,7 +1718,7 @@ impl DiskAPI for LocalDisk { } })?; - if !FileMeta::is_xl_format(buf.as_slice()) { + if !FileMeta::is_xl2_v1_format(buf.as_slice()) { return Err(Error::new(DiskError::FileVersionNotFound)); } diff --git a/ecstore/src/file_meta.rs b/ecstore/src/file_meta.rs index 2a4fa0baf..3dae801d6 100644 --- a/ecstore/src/file_meta.rs +++ b/ecstore/src/file_meta.rs @@ -3,10 +3,11 @@ use rmp::Marker; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::fmt::Display; -use std::io::{Read, Write}; +use std::io::{self, Read, Write}; use std::{collections::HashMap, io::Cursor}; use time::OffsetDateTime; -use tracing::warn; +use tokio::io::AsyncRead; +use tracing::{error, warn}; use uuid::Uuid; use xxhash_rust::xxh64; @@ -35,6 +36,9 @@ const XL_FLAG_FREE_VERSION: u8 = 1 << 0; // const XL_FLAG_USES_DATA_DIR: u8 = 1 << 1; const _XL_FLAG_INLINE_DATA: u8 = 1 << 2; +const META_DATA_READ_DEFAULT: usize = 4 << 10; +const MSGP_UINT32_SIZE: usize = 5; + #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct FileMeta { pub versions: Vec, @@ -51,8 +55,9 @@ impl FileMeta { } } - pub fn is_xl_format(buf: &[u8]) -> bool { - !matches!(Self::read_xl_file_header(buf), Err(_e)) + // isXL2V1Format + pub fn is_xl2_v1_format(buf: &[u8]) -> bool { + !matches!(Self::check_xl2_v1(buf), Err(_e)) } pub fn load(buf: &[u8]) -> Result { @@ -62,9 +67,10 @@ impl FileMeta { Ok(xl) } - // read_xl_file_header 读xl文件头,返回后续内容,版本信息 + // check_xl2_v1 读xl文件头,返回后续内容,版本信息 + // checkXL2V1 #[tracing::instrument] - pub fn read_xl_file_header(buf: &[u8]) -> Result<(&[u8], u16, u16)> { + pub fn check_xl2_v1(buf: &[u8]) -> Result<(&[u8], u16, u16)> { if buf.len() < 8 { return Err(Error::msg("xl file header not exists")); } @@ -81,12 +87,22 @@ impl FileMeta { Ok((&buf[8..], major, minor)) } + + // 固定u32 + pub fn read_bytes_header(buf: &[u8]) -> Result<(u32, &[u8])> { + let (mut size_buf, _) = buf.split_at(5); + + // 取meta数据,buf = crc + data + let bin_len = rmp::decode::read_bin_len(&mut size_buf)?; + + Ok((bin_len, &buf[5..])) + } #[tracing::instrument] pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let i = buf.len() as u64; // check version, buf = buf[8..] - let (buf, _, _) = Self::read_xl_file_header(buf)?; + let (buf, _, _) = Self::check_xl2_v1(buf)?; let (mut size_buf, buf) = buf.split_at(5); @@ -1994,9 +2010,96 @@ async fn get_file_info(buf: &[u8], volume: &str, path: &str, version_id: &str, o Ok(fi) } + +async fn read_more( + reader: &mut R, + buf: &mut Vec, + total_size: usize, + read_size: usize, + has_full: bool, +) -> Result<()> { + use tokio::io::AsyncReadExt; + let has = buf.len(); + + if has >= read_size { + return Ok(()); + } + + if has_full || read_size > total_size { + return Err(Error::new(io::Error::new(io::ErrorKind::UnexpectedEof, "Unexpected EOF"))); + } + + let extra = read_size - has; + if buf.capacity() >= read_size { + // Extend the buffer if we have enough space. + buf.resize(read_size, 0); + } else { + buf.extend(vec![0u8; extra]); + } + + reader.read_exact(&mut buf[has..]).await?; + Ok(()) +} + +pub async fn read_xl_meta_no_data(reader: &mut R, size: usize) -> Result> { + use tokio::io::AsyncReadExt; + + let mut initial = size; + let mut has_full = true; + + if initial > META_DATA_READ_DEFAULT { + initial = META_DATA_READ_DEFAULT; + has_full = false; + } + + let mut buf = vec![0u8; initial]; + reader.read_exact(&mut buf).await?; + + let (tmp_buf, major, minor) = FileMeta::check_xl2_v1(&buf)?; + + match major { + 1 => match minor { + 0 => { + read_more(reader, &mut buf, size, size, has_full).await?; + Ok(buf) + } + 1..=3 => { + let (sz, tmp_buf) = FileMeta::read_bytes_header(tmp_buf)?; + let mut want = sz as usize + (buf.len() - tmp_buf.len()); + + if minor < 2 { + read_more(reader, &mut buf, size, want, has_full).await?; + return Ok(buf[..want].to_vec()); + } + + let want_max = usize::min(want + MSGP_UINT32_SIZE, size); + read_more(reader, &mut buf, size, want_max, has_full).await?; + + if buf.len() < want { + error!("read_xl_meta_no_data buffer too small (length: {}, needed: {})", &buf.len(), want); + return Err(Error::new(DiskError::FileCorrupt)); + } + + let tmp = &buf[want..]; + let crc_size = 5; + let other_size = tmp.len() - crc_size; + + want += tmp.len() - other_size; + + Ok(buf[..want].to_vec()) + } + _ => Err(Error::new(io::Error::new(io::ErrorKind::InvalidData, "Unknown minor metadata version"))), + }, + _ => Err(Error::new(io::Error::new(io::ErrorKind::InvalidData, "Unknown major metadata version"))), + } +} #[cfg(test)] mod test { + use std::fs; + use std::fs::File; + use std::os::unix::fs::MetadataExt; + use super::*; #[test] @@ -2012,15 +2115,11 @@ mod test { fm.add_version(fi).unwrap(); } - // println!("fm:{:?}", &fm); - let buff = fm.marshal_msg().unwrap(); let mut newfm = FileMeta::default(); newfm.unmarshal_msg(&buff).unwrap(); - // println!("newone:{:?}", newone); - assert_eq!(fm, newfm) } @@ -2107,3 +2206,44 @@ mod test { assert_eq!(obj.version_id, vid); } } + +#[tokio::test] +async fn test_read_xl_meta_no_data() { + use tokio::fs; + use tokio::fs::File; + use tokio::io::AsyncWriteExt; + + let mut fm = FileMeta::new(); + + let (m, n) = (3, 2); + + for i in 0..5 { + let mut fi = FileInfo::new(i.to_string().as_str(), m, n); + fi.mod_time = Some(OffsetDateTime::now_utc()); + + fm.add_version(fi).unwrap(); + } + + let mut buff = fm.marshal_msg().unwrap(); + + buff.resize(buff.len() + 100, 0); + + let filepath = "./test_xl.meta"; + + let mut file = File::create(filepath).await.unwrap(); + // 写入字符串 + file.write_all(&buff).await.unwrap(); + + let mut f = File::open(filepath).await.unwrap(); + + let stat = f.metadata().await.unwrap(); + + let data = read_xl_meta_no_data(&mut f, stat.len() as usize).await.unwrap(); + + let mut newfm = FileMeta::default(); + newfm.unmarshal_msg(&data).unwrap(); + + fs::remove_file(filepath).await.unwrap(); + + assert_eq!(fm, newfm) +} diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index 244a7d8d1..79f560e30 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -1,5 +1,6 @@ pub mod admin_server_info; pub mod bitrot; +pub mod bucket; pub mod cache_value; mod chunk_stream; pub mod config; @@ -9,25 +10,23 @@ pub mod endpoints; pub mod erasure; pub mod error; mod file_meta; +pub mod file_meta_inline; pub mod global; pub mod heal; pub mod metrics_realtime; pub mod notification_sys; pub mod peer; mod peer_rest_client; +pub mod pools; mod quorum; pub mod set_disk; mod sets; pub mod store; pub mod store_api; -mod store_init; -pub mod utils; - -pub mod bucket; -pub mod file_meta_inline; - -pub mod pools; pub mod store_err; +mod store_init; +mod store_list_objects; +pub mod utils; pub mod xhttp; pub use global::new_object_layer_fn; diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index 1487ec052..c0735900f 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -46,6 +46,11 @@ pub struct NotificationPeerErr { } impl NotificationSys { + pub fn rest_client_from_hash(&self, s:&str) ->Option{ + + + None + } pub async fn delete_policy(&self) -> Vec { unimplemented!() } diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 148837f56..894a8bbae 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -24,19 +24,19 @@ use crate::store_err::{ }; use crate::store_init::ec_drives_no_config; use crate::utils::crypto::base64_decode; -use crate::utils::path::{base_dir_from_prefix, decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; +use crate::utils::path::{decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; use crate::utils::xml; use crate::{ bucket::metadata::BucketMetadata, - disk::{error::DiskError, new_disk, DiskOption, DiskStore, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET}, + disk::{error::DiskError, new_disk, DiskOption, DiskStore, BUCKET_META_PREFIX, RUSTFS_META_BUCKET}, endpoints::EndpointServerPools, error::{Error, Result}, peer::S3PeerSys, sets::Sets, store_api::{ BucketInfo, BucketOptions, CompletePart, DeleteBucketOptions, DeletedObject, GetObjectReader, HTTPRangeSpec, - ListObjectsInfo, ListObjectsV2Info, MakeBucketOptions, MultipartUploadResult, ObjectInfo, ObjectOptions, ObjectToDelete, - PartInfo, PutObjReader, StorageAPI, + ListObjectsV2Info, MakeBucketOptions, MultipartUploadResult, ObjectInfo, ObjectOptions, ObjectToDelete, PartInfo, + PutObjReader, StorageAPI, }, store_init, utils, }; @@ -51,11 +51,7 @@ use std::cmp::Ordering; use std::process::exit; use std::slice::Iter; use std::time::SystemTime; -use std::{ - collections::{HashMap, HashSet}, - sync::Arc, - time::Duration, -}; +use std::{collections::HashMap, sync::Arc, time::Duration}; use time::OffsetDateTime; use tokio::sync::mpsc::Sender; use tokio::sync::{broadcast, mpsc, RwLock}; @@ -263,102 +259,104 @@ impl ECStore { self.pools.len() == 1 } - pub async fn list_path(&self, opts: &ListPathOptions, delimiter: &str) -> Result { - // if opts.prefix.ends_with(SLASH_SEPARATOR) { - // return Err(Error::msg("eof")); - // } + // define in store_list_objects.rs + // pub async fn list_path(&self, opts: &ListPathOptions, delimiter: &str) -> Result { + // // if opts.prefix.ends_with(SLASH_SEPARATOR) { + // // return Err(Error::msg("eof")); + // // } - let mut opts = opts.clone(); + // let mut opts = opts.clone(); - if opts.base_dir.is_empty() { - opts.base_dir = base_dir_from_prefix(&opts.prefix); - } + // if opts.base_dir.is_empty() { + // opts.base_dir = base_dir_from_prefix(&opts.prefix); + // } - let objects = self.list_merged(&opts, delimiter).await?; + // let objects = self.list_merged(&opts, delimiter).await?; - let info = ListObjectsInfo { - objects, - ..Default::default() - }; - Ok(info) - } + // let info = ListObjectsInfo { + // objects, + // ..Default::default() + // }; + // Ok(info) + // } // 读所有 - async fn list_merged(&self, opts: &ListPathOptions, delimiter: &str) -> Result> { - let walk_opts = WalkDirOptions { - bucket: opts.bucket.clone(), - base_dir: opts.base_dir.clone(), - ..Default::default() - }; + // define in store_list_objects.rs + // async fn list_merged(&self, opts: &ListPathOptions, delimiter: &str) -> Result> { + // let walk_opts = WalkDirOptions { + // bucket: opts.bucket.clone(), + // base_dir: opts.base_dir.clone(), + // ..Default::default() + // }; - // let (mut wr, mut rd) = tokio::io::duplex(1024); + // // let (mut wr, mut rd) = tokio::io::duplex(1024); - let mut futures = Vec::new(); + // let mut futures = Vec::new(); - for sets in self.pools.iter() { - for set in sets.disk_set.iter() { - futures.push(set.walk_dir(&walk_opts)); - } - } + // for sets in self.pools.iter() { + // for set in sets.disk_set.iter() { + // futures.push(set.walk_dir(&walk_opts)); + // } + // } - let results = join_all(futures).await; + // let results = join_all(futures).await; - // let mut errs = Vec::new(); - let mut ress = Vec::new(); - let mut uniq = HashSet::new(); + // // let mut errs = Vec::new(); + // let mut ress = Vec::new(); + // let mut uniq = HashSet::new(); - for (disks_ress, _disks_errs) in results { - for disks_res in disks_ress.iter() { - if disks_res.is_none() { - // TODO handle errs - continue; - } - let entrys = disks_res.as_ref().unwrap(); + // for (disks_ress, _disks_errs) in results { + // for disks_res in disks_ress.iter() { + // if disks_res.is_none() { + // // TODO handle errs + // continue; + // } + // let entrys = disks_res.as_ref().unwrap(); - for entry in entrys { - // warn!("lst_merged entry---- {}", &entry.name); + // for entry in entrys { + // // warn!("lst_merged entry---- {}", &entry.name); - if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { - continue; - } + // if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { + // continue; + // } - if !uniq.contains(&entry.name) { - uniq.insert(entry.name.clone()); - // TODO: 过滤 + // if !uniq.contains(&entry.name) { + // uniq.insert(entry.name.clone()); + // // TODO: 过滤 - if opts.limit > 0 && ress.len() as i32 >= opts.limit { - return Ok(ress); - } + // if opts.limit > 0 && ress.len() as i32 >= opts.limit { + // return Ok(ress); + // } - if entry.is_object() { - if !delimiter.is_empty() { - // entry.name.trim_start_matches(pat) - } + // if entry.is_object() { + // if !delimiter.is_empty() { + // // entry.name.trim_start_matches(pat) + // } - let fi = entry.to_fileinfo(&opts.bucket)?; - if let Some(f) = fi { - ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); - } - continue; - } + // let fi = entry.to_fileinfo(&opts.bucket)?; + // if let Some(f) = fi { + // ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); + // } + // continue; + // } - if entry.is_dir() { - ress.push(ObjectInfo { - is_dir: true, - bucket: opts.bucket.clone(), - name: entry.name.clone(), - ..Default::default() - }); - } - } - } - } - } + // if entry.is_dir() { + // ress.push(ObjectInfo { + // is_dir: true, + // bucket: opts.bucket.clone(), + // name: entry.name.clone(), + // ..Default::default() + // }); + // } + // } + // } + // } + // } - // warn!("list_merged errs {:?}", errs); + // // warn!("list_merged errs {:?}", errs); - Ok(ress) - } + // Ok(ress) + // } async fn delete_all(&self, bucket: &str, prefix: &str) -> Result<()> { let mut futures = Vec::new(); @@ -1525,29 +1523,32 @@ impl StorageAPI for ECStore { continuation_token: &str, delimiter: &str, max_keys: i32, - _fetch_owner: bool, - _start_after: &str, + fetch_owner: bool, + start_after: &str, ) -> Result { - let opts = ListPathOptions { - bucket: bucket.to_string(), - limit: max_keys, - prefix: prefix.to_owned(), - ..Default::default() - }; + self.inner_list_objects_v2(&bucket, &prefix, &continuation_token, &delimiter, max_keys, fetch_owner, start_after) + .await - let info = self.list_path(&opts, delimiter).await?; + // let opts = ListPathOptions { + // bucket: bucket.to_string(), + // limit: max_keys, + // prefix: prefix.to_owned(), + // ..Default::default() + // }; - // warn!("list_objects_v2 info {:?}", info); + // let info = self.list_path(&opts, delimiter).await?; - let v2 = ListObjectsV2Info { - is_truncated: info.is_truncated, - continuation_token: continuation_token.to_owned(), - next_continuation_token: info.next_marker, - objects: info.objects, - prefixes: info.prefixes, - }; + // // warn!("list_objects_v2 info {:?}", info); - Ok(v2) + // let v2 = ListObjectsV2Info { + // is_truncated: info.is_truncated, + // continuation_token: continuation_token.to_owned(), + // next_continuation_token: info.next_marker, + // objects: info.objects, + // prefixes: info.prefixes, + // }; + + // Ok(v2) } async fn list_object_versions( &self, @@ -2243,7 +2244,7 @@ fn check_bucket_and_object_names(bucket: &str, object: &str) -> Result<()> { Ok(()) } -fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &str) -> Result<()> { +pub fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &str) -> Result<()> { if !is_meta_bucketname(bucket) && check_valid_bucket_name_strict(bucket).is_err() { return Err(Error::new(StorageError::BucketNameInvalid(bucket.to_string()))); } diff --git a/ecstore/src/list_objects.rs b/ecstore/src/store_list_objects.rs similarity index 96% rename from ecstore/src/list_objects.rs rename to ecstore/src/store_list_objects.rs index bb1f4cd2d..119cb738f 100644 --- a/ecstore/src/list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -101,6 +101,7 @@ impl ListPathOptions { } impl ECStore { + #[allow(clippy::too_many_arguments)] pub async fn inner_list_objects_v2( &self, bucket: &str, @@ -120,7 +121,7 @@ impl ECStore { }; self.list_objects_generic(bucket, prefix, marker, delimiter, max_keys).await?; - + // FIXME:TODO: unimplemented!() } @@ -145,6 +146,8 @@ impl ECStore { let merged = self.list_path(&opts).await?; + // FIXME:TODO: + todo!() } @@ -159,10 +162,8 @@ impl ECStore { o.marker = "".to_owned(); } - if !o.marker.is_empty() && !o.prefix.is_empty() { - if !o.marker.starts_with(&o.prefix) { - return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); - } + if !o.marker.is_empty() && !o.prefix.is_empty() && !o.marker.starts_with(&o.prefix) { + return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); } if o.limit == 0 { @@ -194,6 +195,7 @@ impl ECStore { o.create = false; } + // FIXME:TODO: todo!() // let mut opts = opts.clone(); From a2fb2523305d8320b3d2c794a414d23cd200acdc Mon Sep 17 00:00:00 2001 From: bestgopher <84328409@qq.com> Date: Wed, 4 Dec 2024 20:47:28 +0800 Subject: [PATCH 03/77] fix: make cargo check happy --- crypto/Cargo.toml | 5 +++-- crypto/src/encdec/decrypt.rs | 2 +- crypto/src/encdec/encrypt.rs | 2 +- crypto/src/error.rs | 5 ++--- iam/src/auth/credentials.rs | 3 +-- iam/src/cache.rs | 8 ++++---- iam/src/error.rs | 2 -- iam/src/handler.rs | 13 ++++++------- iam/src/policy/effect.rs | 2 -- iam/src/policy/function.rs | 3 +-- iam/src/policy/statement.rs | 2 -- iam/src/policy/utils/path.rs | 2 -- iam/src/store/object.rs | 6 +++--- 13 files changed, 22 insertions(+), 33 deletions(-) diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index 4c7e3a014..179abb6d5 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -14,7 +14,7 @@ chacha20poly1305 = { version = "0.10.1", optional = true } jsonwebtoken = "9.3.0" pbkdf2 = { version = "0.12.2", optional = true } rand = { workspace = true, optional = true } -sha2 = "0.10.8" +sha2 = { version = "0.10.8", optional = true } thiserror.workspace = true serde_json.workspace = true @@ -24,6 +24,7 @@ test-case.workspace = true time.workspace = true [features] +default = ["crypto", "fips"] fips = [] crypto = [ "dep:aes-gcm", @@ -31,8 +32,8 @@ crypto = [ "dep:chacha20poly1305", "dep:pbkdf2", "dep:rand", + "dep:sha2", ] -default = ["crypto", "fips"] [lints.clippy] unwrap_used = "deny" diff --git a/crypto/src/encdec/decrypt.rs b/crypto/src/encdec/decrypt.rs index 92de90052..e3660e6db 100644 --- a/crypto/src/encdec/decrypt.rs +++ b/crypto/src/encdec/decrypt.rs @@ -37,7 +37,7 @@ fn decryp(stream: T, nonce: &[u8], data: &[u8]) -> Resul .map_err(Error::ErrDecryptFailed) } -#[cfg(all(not(test), not(feature = "crypto")))] +#[cfg(not(any(test, feature = "crypto")))] pub fn decrypt_data(_password: &[u8], data: &[u8]) -> Result, crate::Error> { Ok(data.to_vec()) } diff --git a/crypto/src/encdec/encrypt.rs b/crypto/src/encdec/encrypt.rs index 76ddd2a13..885d46c05 100644 --- a/crypto/src/encdec/encrypt.rs +++ b/crypto/src/encdec/encrypt.rs @@ -55,7 +55,7 @@ fn encrypt( Ok(ciphertext) } -#[cfg(all(not(test), not(feature = "crypto")))] +#[cfg(not(any(test, feature = "crypto")))] pub fn encrypt_data(_password: &[u8], data: &[u8]) -> Result, crate::Error> { Ok(data.to_vec()) } diff --git a/crypto/src/error.rs b/crypto/src/error.rs index 6ab05e67a..d75ddde63 100644 --- a/crypto/src/error.rs +++ b/crypto/src/error.rs @@ -1,5 +1,3 @@ -use sha2::digest::InvalidLength; - #[derive(thiserror::Error, Debug)] pub enum Error { #[error("unexpected header")] @@ -8,8 +6,9 @@ pub enum Error { #[error("invalid encryption algorithm ID: {0}")] ErrInvalidAlgID(u8), + #[cfg(any(test, feature = "crypto"))] #[error("{0}")] - ErrInvalidLength(#[from] InvalidLength), + ErrInvalidLength(#[from] sha2::digest::InvalidLength), #[cfg(any(test, feature = "crypto"))] #[error("encrypt failed")] diff --git a/iam/src/auth/credentials.rs b/iam/src/auth/credentials.rs index 3b72cb63f..ac4590c2a 100644 --- a/iam/src/auth/credentials.rs +++ b/iam/src/auth/credentials.rs @@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use std::cell::LazyCell; use std::collections::HashMap; -use std::env::var; use time::format_description::BorrowedFormatItem; use time::{Date, OffsetDateTime}; @@ -103,7 +102,7 @@ impl Credentials { Self::check_key_value(header) } - pub fn check_key_value(header: CredentialHeader) -> crate::Result { + pub fn check_key_value(_header: CredentialHeader) -> crate::Result { todo!() } diff --git a/iam/src/cache.rs b/iam/src/cache.rs index e615632f1..c3dbef97c 100644 --- a/iam/src/cache.rs +++ b/iam/src/cache.rs @@ -93,7 +93,7 @@ impl CacheInner { self.users.get(user_name).or_else(|| self.sts_accounts.get(user_name)) } - fn get_policy(&self, name: &str, groups: &[String]) -> crate::Result> { + fn get_policy(&self, _name: &str, _groups: &[String]) -> crate::Result> { todo!() } @@ -126,13 +126,13 @@ impl CacheInner { } // todo - pub fn is_allowed_sts(&self, args: &Args, parent: &str) -> bool { + pub fn is_allowed_sts(&self, _args: &Args, _parent: &str) -> bool { warn!("unimplement is_allowed_sts"); false } // todo - pub fn is_allowed_service_account(&self, args: &Args, parent: &str) -> bool { + pub fn is_allowed_service_account(&self, _args: &Args, _parent: &str) -> bool { warn!("unimplement is_allowed_sts"); false } @@ -141,7 +141,7 @@ impl CacheInner { todo!() } - pub fn policy_db_get(&self, name: &str, groups: &[String]) -> Vec { + pub fn policy_db_get(&self, _name: &str, _groups: &[String]) -> Vec { todo!() } } diff --git a/iam/src/error.rs b/iam/src/error.rs index c6b8a791c..cc92131d1 100644 --- a/iam/src/error.rs +++ b/iam/src/error.rs @@ -1,5 +1,3 @@ -use core::error; - use crate::policy; #[derive(thiserror::Error, Debug)] diff --git a/iam/src/handler.rs b/iam/src/handler.rs index eb291195b..50557f417 100644 --- a/iam/src/handler.rs +++ b/iam/src/handler.rs @@ -1,13 +1,12 @@ -use std::{borrow::Cow, collections::HashMap, f32::NAN}; +use std::{borrow::Cow, collections::HashMap}; use log::{info, warn}; -use time::OffsetDateTime; use crate::{ arn::ARN, - auth::{Credentials, UserIdentity}, - cache::{Cache, CacheInner}, - policy::{utils::get_values_from_claims, Args, MappedPolicy, Policy, UserType}, + auth::UserIdentity, + cache::CacheInner, + policy::{utils::get_values_from_claims, Args, Policy}, store::Store, Error, }; @@ -36,7 +35,7 @@ where .or_else(|| self.cache.sts_accounts.get(user_name)) } - async fn get_policy(&self, name: &str, groups: &[String]) -> crate::Result> { + async fn get_policy(&self, name: &str, _groups: &[String]) -> crate::Result> { if name.is_empty() { return Err(Error::InvalidArgument); } @@ -122,7 +121,7 @@ where false } - pub async fn get_combined_policy(&self, policyes: &[String]) -> Policy { + pub async fn get_combined_policy(&self, _policies: &[String]) -> Policy { todo!() } diff --git a/iam/src/policy/effect.rs b/iam/src/policy/effect.rs index f932fe247..48437f644 100644 --- a/iam/src/policy/effect.rs +++ b/iam/src/policy/effect.rs @@ -1,5 +1,3 @@ -use std::default; - use serde::{Deserialize, Serialize}; use strum::{EnumString, IntoStaticStr}; diff --git a/iam/src/policy/function.rs b/iam/src/policy/function.rs index f4b5b647b..b86ba19dc 100644 --- a/iam/src/policy/function.rs +++ b/iam/src/policy/function.rs @@ -1,7 +1,6 @@ use std::{collections::HashMap, ops::Deref}; use func::Func; -use key::Key; use serde::{de, Deserialize, Serialize}; pub mod addr; @@ -56,7 +55,7 @@ impl<'de> Deserialize<'de> for Functions { return Err(A::Error::custom("invalid codition")); } - let Some(name) = name else { return Err(A::Error::custom("invalid codition")) }; + let Some(_name) = name else { return Err(A::Error::custom("invalid codition")) }; let f = match qualifier { Some("ForAnyValues") => Func::ForAnyValues, diff --git a/iam/src/policy/statement.rs b/iam/src/policy/statement.rs index 04b1e7d4e..f10e7b8aa 100644 --- a/iam/src/policy/statement.rs +++ b/iam/src/policy/statement.rs @@ -1,5 +1,3 @@ -use std::borrow::Cow; - use serde::{Deserialize, Serialize}; use super::{action::Action, ActionSet, Args, Effect, Error, Functions, ResourceSet, Validator, ID}; diff --git a/iam/src/policy/utils/path.rs b/iam/src/policy/utils/path.rs index a6807ef3a..9eb52bf02 100644 --- a/iam/src/policy/utils/path.rs +++ b/iam/src/policy/utils/path.rs @@ -1,5 +1,3 @@ -use std::{fmt::Write, usize}; - struct LazyBuf<'a> { s: &'a str, buf: Option>, diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index 02f49324f..f884e2472 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -6,14 +6,14 @@ use ecstore::{ store_api::{HTTPRangeSpec, ObjectIO, ObjectInfo, ObjectOptions, PutObjReader}, utils::path::dir, }; -use futures::{future::try_join_all, SinkExt}; +use futures::future::try_join_all; use log::debug; use serde::{de::DeserializeOwned, Serialize}; use super::Store; use crate::{ auth::UserIdentity, - cache::{Cache, CacheEntity, CacheInner}, + cache::{Cache, CacheEntity}, policy::{utils::split_path, MappedPolicy, PolicyDoc, UserType}, Error, }; @@ -102,7 +102,7 @@ impl ObjectStore { Ok(Some(user)) } - async fn load_mapped_policy(&self, user_type: UserType, name: &str, is_group: bool) -> crate::Result { + async fn load_mapped_policy(&self, user_type: UserType, name: &str, _is_group: bool) -> crate::Result { let (p, _) = self .load_iam_config::(&format!("{base}{name}.json", base = user_type.prefix(), name = name)) .await?; From b38c1819922635739e11704b23966b93f04b2749 Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 5 Dec 2024 17:42:17 +0800 Subject: [PATCH 04/77] init metacache io --- ecstore/src/lib.rs | 2 +- ecstore/src/store.rs | 42 +++++++++++++++---------------- ecstore/src/store_list_objects.rs | 2 +- iam/src/store/object.rs | 16 ++++++------ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index 79f560e30..42623a660 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -25,7 +25,7 @@ pub mod store; pub mod store_api; pub mod store_err; mod store_init; -mod store_list_objects; +pub mod store_list_objects; pub mod utils; pub mod xhttp; diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 894a8bbae..d886df61c 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -1021,32 +1021,32 @@ pub struct PoolObjInfo { pub err: Option, } -#[derive(Debug, Default, Clone)] -pub struct ListPathOptions { - pub id: String, +// #[derive(Debug, Default, Clone)] +// pub struct ListPathOptions { +// pub id: String, - // Bucket of the listing. - pub bucket: String, +// // Bucket of the listing. +// pub bucket: String, - // Directory inside the bucket. - // When unset listPath will set this based on Prefix - pub base_dir: String, +// // Directory inside the bucket. +// // When unset listPath will set this based on Prefix +// pub base_dir: String, - // Scan/return only content with prefix. - pub prefix: String, +// // Scan/return only content with prefix. +// pub prefix: String, - // FilterPrefix will return only results with this prefix when scanning. - // Should never contain a slash. - // Prefix should still be set. - pub filter_prefix: String, +// // FilterPrefix will return only results with this prefix when scanning. +// // Should never contain a slash. +// // Prefix should still be set. +// pub filter_prefix: String, - // Marker to resume listing. - // The response will be the first entry >= this object name. - pub marker: String, +// // Marker to resume listing. +// // The response will be the first entry >= this object name. +// pub marker: String, - // Limit the number of results. - pub limit: i32, -} +// // Limit the number of results. +// pub limit: i32, +// } #[async_trait::async_trait] impl ObjectIO for ECStore { @@ -1526,7 +1526,7 @@ impl StorageAPI for ECStore { fetch_owner: bool, start_after: &str, ) -> Result { - self.inner_list_objects_v2(&bucket, &prefix, &continuation_token, &delimiter, max_keys, fetch_owner, start_after) + self.inner_list_objects_v2(bucket, prefix, continuation_token, delimiter, max_keys, fetch_owner, start_after) .await // let opts = ListPathOptions { diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 119cb738f..5ff4586f1 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -151,7 +151,7 @@ impl ECStore { todo!() } - async fn list_path(&self, o: &ListPathOptions) -> Result { + pub async fn list_path(&self, o: &ListPathOptions) -> Result { check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?; // if opts.prefix.ends_with(SLASH_SEPARATOR) { // return Err(Error::msg("eof")); diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index f884e2472..020e99c12 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -2,8 +2,9 @@ use std::{collections::HashMap, path::Path, sync::Arc}; use ecstore::{ config::error::is_not_found, - store::{ECStore, ListPathOptions}, + store::ECStore, store_api::{HTTPRangeSpec, ObjectIO, ObjectInfo, ObjectOptions, PutObjReader}, + store_list_objects::ListPathOptions, utils::path::dir, }; use futures::future::try_join_all; @@ -41,14 +42,11 @@ impl ObjectStore { futures.push(async move { let items = self .object_api - .list_path( - &ListPathOptions { - bucket: Self::BUCKET_NAME.into(), - prefix: prefix.clone(), - ..Default::default() - }, - "", - ) + .list_path(&ListPathOptions { + bucket: Self::BUCKET_NAME.into(), + prefix: prefix.clone(), + ..Default::default() + }) .await; match items { From ed0966cca355a1ee373888b5c39961a0993cf31f Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 5 Dec 2024 17:40:55 +0800 Subject: [PATCH 05/77] init metacache io --- ecstore/src/cache_value/metacache_set.rs | 47 +++--- ecstore/src/disk/local.rs | 12 +- ecstore/src/disk/mod.rs | 16 +- ecstore/src/disk/remote.rs | 2 +- ecstore/src/io.rs | 68 ++++++++ ecstore/src/lib.rs | 2 + ecstore/src/metacache/mod.rs | 1 + ecstore/src/metacache/writer.rs | 206 +++++++++++++++++++++++ ecstore/src/set_disk.rs | 7 +- rustfs/src/grpc.rs | 2 +- 10 files changed, 330 insertions(+), 33 deletions(-) create mode 100644 ecstore/src/io.rs create mode 100644 ecstore/src/metacache/mod.rs create mode 100644 ecstore/src/metacache/writer.rs diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index 79601ac87..4e2bbe579 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -12,6 +12,7 @@ use tokio::{ use crate::{ disk::{DiskAPI, DiskStore, MetaCacheEntries, MetaCacheEntry, WalkDirOptions}, error::{Error, Result}, + io::Writer, }; type AgreedFn = Box Pin + Send>> + Send + 'static>; @@ -77,16 +78,19 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - match disk .as_ref() .unwrap() - .walk_dir(WalkDirOptions { - bucket: opts_clone.bucket.clone(), - base_dir: opts_clone.path.clone(), - recursive: opts_clone.recursice, - report_notfound: opts_clone.report_not_found, - filter_prefix: opts_clone.filter_prefix.clone(), - forward_to: opts_clone.forward_to.clone(), - limit: opts_clone.per_disk_limit, - ..Default::default() - }) + .walk_dir( + WalkDirOptions { + bucket: opts_clone.bucket.clone(), + base_dir: opts_clone.path.clone(), + recursive: opts_clone.recursice, + report_notfound: opts_clone.report_not_found, + filter_prefix: opts_clone.filter_prefix.clone(), + forward_to: opts_clone.forward_to.clone(), + limit: opts_clone.per_disk_limit, + ..Default::default() + }, + Writer::NotUse, + ) .await { Ok(r) => { @@ -115,16 +119,19 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - match disk .as_ref() .unwrap() - .walk_dir(WalkDirOptions { - bucket: opts_clone.bucket.clone(), - base_dir: opts_clone.path.clone(), - recursive: opts_clone.recursice, - report_notfound: opts_clone.report_not_found, - filter_prefix: opts_clone.filter_prefix.clone(), - forward_to: opts_clone.forward_to.clone(), - limit: opts_clone.per_disk_limit, - ..Default::default() - }) + .walk_dir( + WalkDirOptions { + bucket: opts_clone.bucket.clone(), + base_dir: opts_clone.path.clone(), + recursive: opts_clone.recursice, + report_notfound: opts_clone.report_not_found, + filter_prefix: opts_clone.filter_prefix.clone(), + forward_to: opts_clone.forward_to.clone(), + limit: opts_clone.per_disk_limit, + ..Default::default() + }, + Writer::NotUse, + ) .await { Ok(r) => { diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 8cca640b6..268c672b5 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -1291,10 +1291,18 @@ impl DiskAPI for LocalDisk { Ok(entries) } - // TODO: io.writer - async fn walk_dir(&self, opts: WalkDirOptions) -> Result> { + // FIXME: TODO: io.writer + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { // warn!("walk_dir opts {:?}", &opts); + let volume_dir = self.get_bucket_path(&opts.bucket)?; + + if !skip_access_checks(&opts.bucket) { + if let Err(e) = access(&volume_dir).await { + return Err(convert_access_error(e, DiskError::VolumeAccessDenied)); + } + } + let mut metas = Vec::new(); if opts.base_dir.ends_with(SLASH_SEPARATOR) { diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index dd1fc6c09..c7c5a1003 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -22,6 +22,7 @@ use crate::{ data_usage_cache::{DataUsageCache, DataUsageEntry}, heal_commands::{HealScanMode, HealingTracker}, }, + io, store_api::{FileInfo, RawFileInfo}, }; use endpoint::Endpoint; @@ -208,10 +209,10 @@ impl DiskAPI for Disk { } } - async fn walk_dir(&self, opts: WalkDirOptions) -> Result> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { match self { - Disk::Local(local_disk) => local_disk.walk_dir(opts).await, - Disk::Remote(remote_disk) => remote_disk.walk_dir(opts).await, + Disk::Local(local_disk) => local_disk.walk_dir(opts, wr).await, + Disk::Remote(remote_disk) => remote_disk.walk_dir(opts, wr).await, } } @@ -403,7 +404,7 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { async fn delete_volume(&self, volume: &str) -> Result<()>; // 并发边读边写 TODO: wr io.Writer - async fn walk_dir(&self, opts: WalkDirOptions) -> Result>; + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result>; // Metadata operations async fn delete_version( @@ -599,10 +600,10 @@ pub struct MetaCacheEntry { pub metadata: Vec, // cached contains the metadata if decoded. - cached: Option, + pub cached: Option, // Indicates the entry can be reused and only one reference to metadata is expected. - _reusable: bool, + pub reusable: bool, } impl MetaCacheEntry { @@ -616,6 +617,7 @@ impl MetaCacheEntry { Ok(wr) } + pub fn is_dir(&self) -> bool { self.metadata.is_empty() && self.name.ends_with('/') } @@ -838,7 +840,7 @@ impl MetaCacheEntries { meta_ver: selected.as_ref().unwrap().cached.as_ref().unwrap().meta_ver, ..Default::default() }), - _reusable: true, + reusable: true, ..Default::default() }); diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 618365f6d..3259f9414 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -346,7 +346,7 @@ impl DiskAPI for RemoteDisk { Ok(response.volumes) } - async fn walk_dir(&self, opts: WalkDirOptions) -> Result> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { info!("walk_dir"); let walk_dir_options = serde_json::to_string(&opts)?; let mut client = node_service_time_out_client(&self.addr) diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs new file mode 100644 index 000000000..ca2c3904e --- /dev/null +++ b/ecstore/src/io.rs @@ -0,0 +1,68 @@ +use std::pin::Pin; +use std::task::{Context, Poll}; +use tokio::fs::File; +use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; + +#[derive(Default)] +pub enum Reader { + #[default] + NotUse, + File(File), +} + +impl AsyncRead for Reader { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll> { + match self.get_mut() { + Reader::File(file) => { + let file = Pin::new(file); + file.poll_read(cx, buf) + } + Reader::NotUse => Poll::Ready(Ok(())), + } + } +} + +#[derive(Default)] +pub enum Writer { + #[default] + NotUse, + File(File), +} + +impl AsyncWrite for Writer { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + match self.get_mut() { + Writer::File(file) => { + // Create a pinned reference from the file + let file = Pin::new(file); + file.poll_write(cx, buf) + } + Writer::NotUse => Poll::Ready(Ok(0)), + } + } + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + match self.get_mut() { + Writer::File(file) => { + let file = Pin::new(file); + file.poll_flush(cx) + } + Writer::NotUse => Poll::Ready(Ok(())), + } + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + match self.get_mut() { + Writer::File(file) => { + let file = Pin::new(file); + file.poll_shutdown(cx) + } + Writer::NotUse => Poll::Ready(Ok(())), + } + } +} + +// #[tokio::test] +// async fn test_reader{ + +// } diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index 42623a660..8aa575a33 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -13,6 +13,8 @@ mod file_meta; pub mod file_meta_inline; pub mod global; pub mod heal; +pub mod io; +pub mod metacache; pub mod metrics_realtime; pub mod notification_sys; pub mod peer; diff --git a/ecstore/src/metacache/mod.rs b/ecstore/src/metacache/mod.rs new file mode 100644 index 000000000..d3baa8178 --- /dev/null +++ b/ecstore/src/metacache/mod.rs @@ -0,0 +1 @@ +pub mod writer; diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs new file mode 100644 index 000000000..0be530eb8 --- /dev/null +++ b/ecstore/src/metacache/writer.rs @@ -0,0 +1,206 @@ +use std::io::ErrorKind; +use std::io::Read; +use std::io::Write; +use std::str::from_utf8; + +use crate::disk::MetaCacheEntry; +use crate::error::Error; +use crate::error::Result; + +const METACACHE_STREAM_VERSION: u8 = 2; + +pub struct MetacacheWriter { + wr: W, + buf: Vec, + created: bool, +} + +impl MetacacheWriter { + pub fn new(wr: W, block_size: usize) -> Self { + Self { + wr, + buf: Vec::with_capacity(block_size), + created: false, + } + } + + async fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { + if objs.is_empty() { + return Ok(()); + } + + if !self.created { + rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; + self.created = false; + } + + for obj in objs.iter() { + if obj.name.is_empty() { + return Err(Error::msg("metacacheWriter: no name")); + } + + rmp::encode::write_bool(&mut self.wr, true)?; + + rmp::encode::write_str(&mut self.wr, &obj.name)?; + + rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; + } + + Ok(()) + } + + async fn close(&mut self) -> Result<()> { + rmp::encode::write_bool(&mut self.wr, false)?; + + self.wr.flush()?; + Ok(()) + } +} + +pub struct MetacacheReader { + rd: R, + init: bool, + err: Option, + buf: Vec, +} + +impl MetacacheReader { + pub fn new(rd: R) -> Self { + Self { + rd, + init: false, + err: None, + buf: Vec::new(), + } + } + + pub fn check_init(&mut self) { + if !self.init { + let ver = match rmp::decode::read_u8(&mut self.rd) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + 0 + } + }; + match ver { + 1 | 2 => (), + _ => { + self.err = Some(Error::msg("invalid version")); + } + } + + self.init = true; + } + } + + pub fn peek(&mut self) -> Result { + self.check_init(); + + if let Some(err) = &self.err { + return Err(err.clone()); + } + + match rmp::decode::read_bool(&mut self.rd) { + Ok(res) => { + if !res { + self.err = Some(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + } + } + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + + let l = match rmp::decode::read_str_len(&mut self.rd) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + + self.buf.resize(l as usize, 0); + let name = match self.rd.read_exact(&mut self.buf) { + Ok(()) => { + let name_buf = self.buf.to_vec(); + match from_utf8(&name_buf) { + Ok(decoded) => Ok(decoded.to_owned()), + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + Err(Error::msg(err.to_string())) + } + } + } + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + Err(Error::msg(err.to_string())) + } + }?; + + let l = match rmp::decode::read_bin_len(&mut self.rd) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + self.buf.resize(l as usize, 0); + match self.rd.read_exact(&mut self.buf) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + + let metadata = self.buf.clone(); + + Ok(MetaCacheEntry { + name, + metadata, + cached: None, + reusable: false, + }) + } +} + +#[tokio::test] +async fn test_writer() { + use std::fs::File; + use std::fs::OpenOptions; + + let file_path = "./test_writer.txt"; + let f = OpenOptions::new() + .create(true) + .read(true) + .write(true) + .truncate(true) + .open(file_path) + .unwrap(); + + // let wr = Writer::File(f); + + let mut w = MetacacheWriter::new(f, 1024); + + let mut objs = Vec::new(); + for i in 0..10 { + objs.push(MetaCacheEntry { + name: format!("item{}", i), + metadata: vec![0u8, 10], + cached: None, + reusable: false, + }); + } + + w.write(&objs).await.unwrap(); + w.close().await.unwrap(); + + let nf = File::open(file_path).unwrap(); + + let meta = nf.metadata().unwrap(); + + println!("{}", meta.len()); +} diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 4061024bc..4a6b430e4 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -6,7 +6,6 @@ use std::{ time::Duration, }; -use crate::heal::heal_ops::{HealEntryFn, HealSequence}; use crate::{ bitrot::{bitrot_verify, close_bitrot_writers, new_bitrot_filereader, new_bitrot_filewriter, BitrotFileWriter}, cache_value::metacache_set::{list_path_raw, ListPathRawOptions}, @@ -56,6 +55,10 @@ use crate::{ heal::data_scanner::{globalHealConfig, HEAL_DELETE_DANGLING}, store_api::ListObjectVersionsInfo, }; +use crate::{ + heal::heal_ops::{HealEntryFn, HealSequence}, + io::Writer, +}; use futures::future::join_all; use glob::Pattern; use http::HeaderMap; @@ -1333,7 +1336,7 @@ impl SetDisks { let disk = disk.as_ref().unwrap(); let opts = opts.clone(); // let mut wr = &mut wr; - futures.push(disk.walk_dir(opts)); + futures.push(disk.walk_dir(opts, Writer::NotUse)); // tokio::spawn(async move { disk.walk_dir(opts, wr).await }); } diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index 25c3391d9..16c7c588c 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -743,7 +743,7 @@ impl Node for NodeService { })); } }; - match disk.walk_dir(opts).await { + match disk.walk_dir(opts, ecstore::io::Writer::NotUse).await { Ok(entries) => { let entries = entries .into_iter() From af6deab60d6687ae0e10c1e40baed30764a8b35b Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 6 Dec 2024 13:50:42 +0800 Subject: [PATCH 06/77] metacache done --- ecstore/src/disk/mod.rs | 2 +- ecstore/src/io.rs | 175 +++++++++++++++++++++++++++++++- ecstore/src/metacache/writer.rs | 97 ++++++++++-------- 3 files changed, 228 insertions(+), 46 deletions(-) diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index c7c5a1003..0b6080304 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -591,7 +591,7 @@ pub struct MetadataResolutionParams { pub candidates: Vec>, } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)] pub struct MetaCacheEntry { // name is the full name of the object including prefixes pub name: String, diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index ca2c3904e..cdaabaebc 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -1,3 +1,5 @@ +use std::io::Read; +use std::io::Write; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::fs::File; @@ -62,7 +64,174 @@ impl AsyncWrite for Writer { } } -// #[tokio::test] -// async fn test_reader{ +pub struct AsyncToSync { + inner: R, +} -// } +impl AsyncToSync { + pub fn new_reader(inner: R) -> Self { + Self { inner } + } + fn read_async(&mut self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll> { + let mut read_buf = ReadBuf::new(buf); + // Poll the underlying AsyncRead to fill the ReadBuf + match Pin::new(&mut self.inner).poll_read(cx, &mut read_buf) { + Poll::Ready(Ok(())) => Poll::Ready(Ok(read_buf.filled().len())), + Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Pending => Poll::Pending, + } + } +} + +impl AsyncToSync { + pub fn new_writer(inner: R) -> Self { + Self { inner } + } + // This function will perform a write using AsyncWrite + fn write_async(&mut self, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + let result = Pin::new(&mut self.inner).poll_write(cx, buf); + match result { + Poll::Ready(Ok(n)) => Poll::Ready(Ok(n)), + Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Pending => Poll::Pending, + } + } + + // This function will perform a flush using AsyncWrite + fn flush_async(&mut self, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.inner).poll_flush(cx) + } +} + +impl Read for AsyncToSync { + fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); + loop { + match self.read_async(&mut cx, buf) { + Poll::Ready(Ok(n)) => return Ok(n), + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => { + // If Pending, we need to wait for the readiness. + // Here, we can use an arbitrary mechanism to yield control, + // this might be blocking until some readiness occurs can be complex. + // A full blocking implementation would require an async runtime to block on. + std::thread::sleep(std::time::Duration::from_millis(1)); // Replace with proper waiting if needed + } + } + } + } +} + +impl Write for AsyncToSync { + fn write(&mut self, buf: &[u8]) -> std::io::Result { + let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); + loop { + match self.write_async(&mut cx, buf) { + Poll::Ready(Ok(n)) => return Ok(n), + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => { + // Here we are blocking and waiting for the async operation to complete. + std::thread::sleep(std::time::Duration::from_millis(1)); // Not efficient, see notes. + } + } + } + } + + fn flush(&mut self) -> std::io::Result<()> { + let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); + loop { + match self.flush_async(&mut cx) { + Poll::Ready(Ok(())) => return Ok(()), + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => { + // Again, blocking to wait for flush. + std::thread::sleep(std::time::Duration::from_millis(1)); // Not efficient, see notes. + } + } + } + } +} + +pub struct VecAsyncWriter { + buffer: Vec, +} + +impl VecAsyncWriter { + /// Create a new VecAsyncWriter with an empty Vec. + pub fn new(buffer: Vec) -> Self { + VecAsyncWriter { buffer } + } + + /// Retrieve the underlying buffer. + pub fn get_buffer(&self) -> &[u8] { + &self.buffer + } +} + +// Implementing AsyncWrite trait for VecAsyncWriter +impl AsyncWrite for VecAsyncWriter { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + let len = buf.len(); + + // Assume synchronous writing for simplicity + self.get_mut().buffer.extend_from_slice(buf); + + // Returning the length of written data + Poll::Ready(Ok(len)) + } + + fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { + // In this case, flushing is a no-op for a Vec + Poll::Ready(Ok(())) + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + // Similar to flush, shutdown has no effect here + Poll::Ready(Ok(())) + } +} + +pub struct VecAsyncReader { + buffer: Vec, + position: usize, +} + +impl VecAsyncReader { + /// Create a new VecAsyncReader with the given Vec. + pub fn new(buffer: Vec) -> Self { + VecAsyncReader { buffer, position: 0 } + } + + /// Reset the reader position. + pub fn reset(&mut self) { + self.position = 0; + } +} + +// Implementing AsyncRead trait for VecAsyncReader +impl AsyncRead for VecAsyncReader { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf) -> Poll> { + let this = self.get_mut(); + + // Check how many bytes are available to read + let len = this.buffer.len(); + let bytes_available = len - this.position; + + if bytes_available == 0 { + // If there's no more data to read, return ready with an Eof + return Poll::Ready(Ok(())); + } + + // Calculate how much we can read into the provided buffer + let to_read = std::cmp::min(bytes_available, buf.remaining()); + + // Write the data to the buf + buf.put_slice(&this.buffer[this.position..this.position + to_read]); + + // Update the position + this.position += to_read; + + // Indicate how many bytes were read + Poll::Ready(Ok(())) + } +} diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 0be530eb8..57b0d189e 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -1,30 +1,23 @@ -use std::io::ErrorKind; -use std::io::Read; -use std::io::Write; -use std::str::from_utf8; - use crate::disk::MetaCacheEntry; use crate::error::Error; use crate::error::Result; +use std::io::Read; +use std::io::Write; +use std::str::from_utf8; const METACACHE_STREAM_VERSION: u8 = 2; pub struct MetacacheWriter { wr: W, - buf: Vec, created: bool, } -impl MetacacheWriter { - pub fn new(wr: W, block_size: usize) -> Self { - Self { - wr, - buf: Vec::with_capacity(block_size), - created: false, - } +impl MetacacheWriter { + pub fn new(wr: W) -> Self { + Self { wr, created: false } } - async fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { + pub fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { if objs.is_empty() { return Ok(()); } @@ -49,9 +42,8 @@ impl MetacacheWriter { Ok(()) } - async fn close(&mut self) -> Result<()> { + pub fn close(&mut self) -> Result<()> { rmp::encode::write_bool(&mut self.wr, false)?; - self.wr.flush()?; Ok(()) } @@ -74,8 +66,15 @@ impl MetacacheReader { } } - pub fn check_init(&mut self) { + fn check_init(&mut self) { if !self.init { + // let mut buf = match self.read_buf(1).await { + // Ok(res) => res, + // Err(err) => { + // self.err = Some(Error::msg(err.to_string())); + // return; + // } + // }; let ver = match rmp::decode::read_u8(&mut self.rd) { Ok(res) => res, Err(err) => { @@ -94,7 +93,7 @@ impl MetacacheReader { } } - pub fn peek(&mut self) -> Result { + pub fn peek(&mut self) -> Result> { self.check_init(); if let Some(err) = &self.err { @@ -104,8 +103,7 @@ impl MetacacheReader { match rmp::decode::read_bool(&mut self.rd) { Ok(res) => { if !res { - self.err = Some(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); - return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + return Ok(None); } } Err(err) => { @@ -158,49 +156,64 @@ impl MetacacheReader { let metadata = self.buf.clone(); - Ok(MetaCacheEntry { + Ok(Some(MetaCacheEntry { name, metadata, cached: None, reusable: false, - }) + })) + } + + pub fn read_all(&mut self) -> Result> { + let mut ret = Vec::new(); + + loop { + if let Some(entry) = self.peek()? { + ret.push(entry); + continue; + } + + break; + } + + Ok(ret) } } #[tokio::test] async fn test_writer() { - use std::fs::File; - use std::fs::OpenOptions; + use crate::io::AsyncToSync; + use crate::io::VecAsyncReader; + use crate::io::VecAsyncWriter; - let file_path = "./test_writer.txt"; - let f = OpenOptions::new() - .create(true) - .read(true) - .write(true) - .truncate(true) - .open(file_path) - .unwrap(); + let mut f = VecAsyncWriter::new(Vec::new()); - // let wr = Writer::File(f); - - let mut w = MetacacheWriter::new(f, 1024); + let mut w = MetacacheWriter::new(AsyncToSync::new_writer(&mut f)); let mut objs = Vec::new(); for i in 0..10 { - objs.push(MetaCacheEntry { + let info = MetaCacheEntry { name: format!("item{}", i), metadata: vec![0u8, 10], cached: None, reusable: false, - }); + }; + println!("old {:?}", &info); + objs.push(info); } - w.write(&objs).await.unwrap(); - w.close().await.unwrap(); + w.write(&objs).unwrap(); - let nf = File::open(file_path).unwrap(); + w.close().unwrap(); - let meta = nf.metadata().unwrap(); + let nf = VecAsyncReader::new(f.get_buffer().to_vec()); - println!("{}", meta.len()); + let mut r = MetacacheReader::new(AsyncToSync::new_reader(nf)); + let nobjs = r.read_all().unwrap(); + + for info in nobjs.iter() { + println!("new {:?}", &info); + } + + assert_eq!(objs, nobjs) } From 810d555abd413600379dd5b77690c5456fbe2f59 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 9 Dec 2024 10:03:02 +0800 Subject: [PATCH 07/77] scandir --- ecstore/src/disk/local.rs | 255 +++++++++++++++++++++----------- ecstore/src/metacache/writer.rs | 74 +++++++-- 2 files changed, 236 insertions(+), 93 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 268c672b5..87b8af0df 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -26,6 +26,8 @@ use crate::heal::data_usage_cache::{DataUsageCache, DataUsageEntry}; use crate::heal::error::{ERR_IGNORE_FILE_CONTRIB, ERR_SKIP_FILE}; use crate::heal::heal_commands::{HealScanMode, HealingTracker}; use crate::heal::heal_ops::HEALING_TRACKER_FILENAME; +use crate::io::AsyncToSync; +use crate::metacache::writer::MetacacheWriter; use crate::new_object_layer_fn; use crate::set_disk::{ conv_part_err_to_int, CHECK_PART_FILE_CORRUPT, CHECK_PART_FILE_NOT_FOUND, CHECK_PART_SUCCESS, CHECK_PART_UNKNOWN, @@ -34,7 +36,7 @@ use crate::set_disk::{ use crate::store_api::{BitrotAlgorithm, StorageAPI}; use crate::utils::fs::{access, lstat, O_APPEND, O_CREATE, O_RDONLY, O_WRONLY}; use crate::utils::os::get_info; -use crate::utils::path::{clean, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; +use crate::utils::path::{clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; use crate::{ file_meta::FileMeta, store_api::{FileInfo, RawFileInfo}, @@ -45,7 +47,7 @@ use nix::NixPath; use path_absolutize::Absolutize; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; -use std::io::Cursor; +use std::io::{Cursor, Write}; use std::os::unix::fs::MetadataExt; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; @@ -59,7 +61,7 @@ use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{info, warn}; +use tracing::{error, info, warn}; use uuid::Uuid; #[derive(Debug)] @@ -711,6 +713,162 @@ impl LocalDisk { let n = file.read_to_end(&mut data).await?; bitrot_verify(&mut Cursor::new(data), n, part_size, algo, sum.to_vec(), shard_size) } + + async fn scan_dir( + &self, + current: &mut String, + opts: &WalkDirOptions, + out: &mut MetacacheWriter, + objs_returned: &mut i32, + ) -> Result<()> { + let forward = { + if !opts.forward_to.is_empty() && opts.forward_to.starts_with(&*current) { + let forward = opts.forward_to.trim_start_matches(&*current); + if let Some(idx) = forward.find('/') { + &forward[..idx] + } else { + forward + } + } else { + "" + } + }; + + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + + let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { + Ok(res) => res, + Err(e) => { + if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { + info!("list_dir err {:?}", &e); + } + + if opts.report_notfound && is_err_file_not_found(&e) { + return Err(e); + } + return Ok(()); + } + }; + + if entries.is_empty() { + return Ok(()); + } + + let s = SLASH_SEPARATOR.chars().next().unwrap_or_default(); + *current = current.trim_matches(s).to_owned(); + + let bucket = opts.bucket.as_str(); + + let mut dir_objes = HashSet::new(); + + // 第一层过滤 + for item in entries.iter_mut() { + // warn!("walk_dir get entry {:?}", &entry); + + let entry = item.clone(); + // check limit + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + // check prefix + if !opts.filter_prefix.is_empty() && !entry.starts_with(&opts.filter_prefix) { + *item = "".to_owned(); + continue; + } + + if !forward.is_empty() && entry.as_str() < forward { + *item = "".to_owned(); + continue; + } + + if entry.ends_with(SLASH_SEPARATOR) { + if entry.ends_with(GLOBAL_DIR_SUFFIX_WITH_SLASH) { + let entry = format!("{}{}", entry.as_str().trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH), SLASH_SEPARATOR); + dir_objes.insert(entry.clone()); + *item = entry; + continue; + } + + *item = entry.trim_end_matches(SLASH_SEPARATOR).to_owned(); + continue; + } + + *item = "".to_owned(); + + if entry.ends_with(STORAGE_FORMAT_FILE) { + // + let metadata = self + .read_metadata(self.get_object_path(bucket, format!("{}/{}", ¤t, &entry).as_str())?) + .await?; + let name = entry.trim_end_matches(STORAGE_FORMAT_FILE).trim_end_matches(SLASH_SEPARATOR); + let name = decode_dir_object(format!("{}/{}", ¤t, &name).as_str()); + + out.write_obj(&MetaCacheEntry { + name, + metadata, + ..Default::default() + })?; + *objs_returned += 1; + return Ok(()); + } + } + + entries.sort(); + + let mut entries = entries.as_slice(); + if !forward.is_empty() { + for (i, entry) in entries.iter().enumerate() { + if entry.as_str() >= forward || forward.starts_with(entry.as_str()) { + entries = &entries[i..]; + break; + } + } + } + + let prefix = ""; + let mut dir_stack: Vec = Vec::with_capacity(5); + + for entry in entries.iter() { + // + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + + if entry.is_empty() { + continue; + } + + let name = format!("{}{}", current, entry); + + if !dir_stack.is_empty() { + if let Some(pop) = dir_stack.pop() { + if pop < name { + // + out.write_obj(&MetaCacheEntry { + name: pop, + ..Default::default() + })?; + + if opts.recursive { + if let Err(er) = Box::pin(self.scan_dir(current, opts, out, objs_returned)).await { + error!("scan_dir err {:?}", er); + } + } + } + } + } + + if let Some(dir) = dir_objes.get(entry) { + // + } + } + + // FIXME:TODO: + + Ok(()) + } } fn is_root_path(path: impl AsRef) -> bool { @@ -1291,7 +1449,7 @@ impl DiskAPI for LocalDisk { Ok(entries) } - // FIXME: TODO: io.writer + // FIXME: TODO: io.writer TODO cancel async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { // warn!("walk_dir opts {:?}", &opts); @@ -1303,7 +1461,11 @@ impl DiskAPI for LocalDisk { } } - let mut metas = Vec::new(); + let mut wr = wr; + + let mut out = MetacacheWriter::new(AsyncToSync::new_writer(&mut wr)); + + let mut objs_returned = 0; if opts.base_dir.ends_with(SLASH_SEPARATOR) { let fpath = self.get_object_path( @@ -1316,87 +1478,14 @@ impl DiskAPI for LocalDisk { metadata: data, ..Default::default() }; - metas.push(meta); - return Ok(metas); + out.write_obj(&meta)?; + objs_returned += 1; } } - let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { - Ok(res) => res, - Err(e) => { - if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { - info!("list_dir err {:?}", &e); - } - - if opts.report_notfound && is_err_file_not_found(&e) { - return Err(e); - } - return Ok(Vec::new()); - } - }; - - if entries.is_empty() { - return Ok(Vec::new()); - } - - entries.sort(); - - // 已读计数 - let objs_returned = 0; - - let bucket = opts.bucket.as_str(); - - let mut dir_objes = HashSet::new(); - - // 第一层过滤 - for entry in entries.iter() { - // warn!("walk_dir get entry {:?}", &entry); - - // check limit - if opts.limit > 0 && objs_returned >= opts.limit { - return Ok(metas); - } - // check prefix - if !opts.filter_prefix.is_empty() && !entry.starts_with(&opts.filter_prefix) { - continue; - } - - let mut meta = MetaCacheEntry { ..Default::default() }; - - let mut name = { - if opts.base_dir.is_empty() { - entry.clone() - } else { - format!("{}{}{}", opts.base_dir.trim_end_matches(SLASH_SEPARATOR), SLASH_SEPARATOR, entry) - } - }; - - if name.ends_with(SLASH_SEPARATOR) { - if name.ends_with(GLOBAL_DIR_SUFFIX_WITH_SLASH) { - name = format!("{}{}", name.as_str().trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH), SLASH_SEPARATOR); - dir_objes.insert(name.clone()); - } else { - name = name.as_str().trim_end_matches(SLASH_SEPARATOR).to_owned(); - } - } - meta.name = name; - - let fpath = self.get_object_path(bucket, format!("{}/{}", &meta.name, STORAGE_FORMAT_FILE).as_str())?; - - if let Ok(data) = self.read_metadata(&fpath).await { - meta.metadata = data; - } else { - let fpath = self.get_object_path(bucket, &meta.name)?; - - if !is_empty_dir(fpath).await { - meta.name = format!("{}{}", &meta.name, SLASH_SEPARATOR); - } - } - - metas.push(meta); - } - - Ok(metas) + let mut current = opts.base_dir.clone(); + self.scan_dir(&mut current, &opts, &mut out, &mut objs_returned).await?; + Ok(Vec::new()) } // #[tracing::instrument(skip(self))] diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 57b0d189e..cc23cf6ec 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -4,17 +4,35 @@ use crate::error::Result; use std::io::Read; use std::io::Write; use std::str::from_utf8; +// use std::sync::Arc; +// use tokio::sync::mpsc; +// use tokio::sync::mpsc::Sender; +// use tokio::task; const METACACHE_STREAM_VERSION: u8 = 2; +#[derive(Debug)] pub struct MetacacheWriter { wr: W, created: bool, + // err: Option, } impl MetacacheWriter { pub fn new(wr: W) -> Self { - Self { wr, created: false } + Self { + wr, + created: false, + // err: None, + } + } + + pub fn init(&mut self) -> Result<()> { + if !self.created { + rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; + self.created = true; + } + Ok(()) } pub fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { @@ -22,26 +40,62 @@ impl MetacacheWriter { return Ok(()); } - if !self.created { - rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; - self.created = false; - } + self.init()?; for obj in objs.iter() { if obj.name.is_empty() { return Err(Error::msg("metacacheWriter: no name")); } - rmp::encode::write_bool(&mut self.wr, true)?; - - rmp::encode::write_str(&mut self.wr, &obj.name)?; - - rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; + self.write_obj(obj)?; } Ok(()) } + pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + self.init()?; + rmp::encode::write_bool(&mut self.wr, true)?; + + rmp::encode::write_str(&mut self.wr, &obj.name)?; + + rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; + Ok(()) + } + + // pub async fn stream(&mut self) -> Result> { + // let (sender, mut receiver) = mpsc::channel::(100); + + // let wr = Arc::new(self); + + // task::spawn(async move { + // while let Some(obj) = receiver.recv().await { + // // if obj.name.is_empty() || self.err.is_some() { + // // continue; + // // } + + // let _ = wr.write_obj(&obj); + + // // if let Err(err) = rmp::encode::write_bool(&mut self.wr, true) { + // // self.err = Some(Error::new(err)); + // // continue; + // // } + + // // if let Err(err) = rmp::encode::write_str(&mut self.wr, &obj.name) { + // // self.err = Some(Error::new(err)); + // // continue; + // // } + + // // if let Err(err) = rmp::encode::write_bin(&mut self.wr, &obj.metadata) { + // // self.err = Some(Error::new(err)); + // // continue; + // // } + // } + // }); + + // Ok(sender) + // } + pub fn close(&mut self) -> Result<()> { rmp::encode::write_bool(&mut self.wr, false)?; self.wr.flush()?; From e7f62c2f2023118fdbd12a92de18840a4c0fe7ba Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 9 Dec 2024 15:55:02 +0800 Subject: [PATCH 08/77] test walk --- ecstore/src/disk/local.rs | 108 ++++++++++++++++++++++++++++++-- ecstore/src/metacache/writer.rs | 2 + 2 files changed, 106 insertions(+), 4 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 87b8af0df..d44fa68d4 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -6,7 +6,8 @@ use super::{endpoint::Endpoint, error::DiskError, format::FormatV3}; use super::{ os, CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskMetrics, FileInfoVersions, FileReader, FileWriter, Info, MetaCacheEntry, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, - UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET, STORAGE_FORMAT_FILE_BACKUP, + UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, FORMAT_CONFIG_FILE, RUSTFS_META_BUCKET, + STORAGE_FORMAT_FILE_BACKUP, }; use crate::bitrot::bitrot_verify; use crate::bucket::metadata_sys::{self}; @@ -738,9 +739,12 @@ impl LocalDisk { return Ok(()); } + println!("list_dir opts {} {}", &opts.bucket, &opts.base_dir); + let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { Ok(res) => res, Err(e) => { + println!("list_dir err {:?}", &e); if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { info!("list_dir err {:?}", &e); } @@ -748,10 +752,13 @@ impl LocalDisk { if opts.report_notfound && is_err_file_not_found(&e) { return Err(e); } + return Ok(()); } }; + println!("list_dir entries {:?}", &entries); + if entries.is_empty() { return Ok(()); } @@ -860,12 +867,71 @@ impl LocalDisk { } } - if let Some(dir) = dir_objes.get(entry) { - // + let mut meta = MetaCacheEntry { + name, + ..Default::default() + }; + + let mut is_dir_obj = false; + + if let Some(_dir) = dir_objes.get(entry) { + is_dir_obj = true; + meta.name + .truncate(meta.name.len() - meta.name.chars().last().unwrap().len_utf8()); + meta.name.push_str(GLOBAL_DIR_SUFFIX_WITH_SLASH); } + + match self + .read_metadata(self.get_object_path(&opts.bucket, format!("{}/{}", &meta.name, FORMAT_CONFIG_FILE).as_str())?) + .await + { + Ok(res) => { + if is_dir_obj { + meta.name = meta.name.trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH).to_owned(); + meta.name.push_str(SLASH_SEPARATOR); + } + + meta.metadata = res; + + out.write_obj(&meta)?; + *objs_returned += 1; + } + Err(err) => { + warn!("scan dir read_metadata err {:?}", err); + if let Some(e) = err.downcast_ref::() { + if os_is_not_exist(e) || is_sys_err_is_dir(e) { + // NOT an object, append to stack (with slash) + // If dirObject, but no metadata (which is unexpected) we skip it. + if !is_dir_obj && !is_empty_dir(self.get_object_path(&opts.bucket, &meta.name)?).await { + meta.name.push_str(SLASH_SEPARATOR); + dir_stack.push(meta.name); + } + } + } + + continue; + } + }; } - // FIXME:TODO: + while let Some(dir) = dir_stack.pop() { + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + + out.write_obj(&MetaCacheEntry { + name: dir.clone(), + ..Default::default() + })?; + *objs_returned += 1; + + if opts.recursive { + let mut dir = dir; + if let Err(er) = Box::pin(self.scan_dir(&mut dir, opts, out, objs_returned)).await { + warn!("scan_dir err {:?}", &er); + } + } + } Ok(()) } @@ -1450,6 +1516,7 @@ impl DiskAPI for LocalDisk { } // FIXME: TODO: io.writer TODO cancel + #[tracing::instrument(level = "debug", skip(self, wr))] async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { // warn!("walk_dir opts {:?}", &opts); @@ -2262,6 +2329,9 @@ async fn get_disk_info(drive_path: PathBuf) -> Result<(Info, bool)> { #[cfg(test)] mod test { + use utils::fs::open_file; + use utils::fs::O_RDWR; + use super::*; #[tokio::test] @@ -2341,4 +2411,34 @@ mod test { let _ = fs::remove_dir_all(&p).await; } + + #[tokio::test] + async fn test_walk_dir() { + let ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + let disk = match LocalDisk::new(&ep, false).await { + Ok(res) => res, + Err(err) => { + println!("LocalDisk::new err {:?}", err); + return; + } + }; + + let mut f = match open_file("./testfile.txt", O_CREATE | O_RDWR).await { + Ok(res) => res, + Err(err) => { + println!("openfile err {:?}", err); + return; + } + }; + + let opts = WalkDirOptions { + bucket: "dada".to_owned(), + // base_dir: "dada".to_owned(), + recursive: true, + ..Default::default() + }; + if let Err(err) = disk.walk_dir(opts, crate::io::Writer::File(f)).await { + println!("walk_dir err {:?}", err); + } + } } diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index cc23cf6ec..0ce58d9a5 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -54,6 +54,8 @@ impl MetacacheWriter { } pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + println!("write_obj {:?}", &obj); + self.init()?; rmp::encode::write_bool(&mut self.wr, true)?; From 6232b62e3eeab9dd38508d90312d24c27e4a68c2 Mon Sep 17 00:00:00 2001 From: Nugine Date: Thu, 5 Dec 2024 15:12:52 +0800 Subject: [PATCH 09/77] style: workspace lints (#148) * fix: clippy error * style: workspace lints * test: ignore failures --- Cargo.toml | 6 ++++++ api/admin/Cargo.toml | 3 +++ common/common/Cargo.toml | 3 +++ common/lock/Cargo.toml | 3 +++ common/protos/Cargo.toml | 3 +++ common/protos/src/lib.rs | 2 ++ common/workers/Cargo.toml | 3 +++ crypto/Cargo.toml | 6 +++--- crypto/src/lib.rs | 2 ++ e2e_test/Cargo.toml | 3 +++ ecstore/Cargo.toml | 2 ++ ecstore/src/cache_value/cache.rs | 2 ++ ecstore/src/utils/os/linux.rs | 4 ++-- iam/Cargo.toml | 3 +++ madmin/Cargo.toml | 3 +++ reader/Cargo.toml | 2 ++ rustfs/Cargo.toml | 3 +++ rustfs/src/admin/handlers.rs | 1 + 18 files changed, 49 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d9fefaae3..7736c02f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,12 @@ repository = "https://github.com/rustfs/rustfs" rust-version = "1.75" version = "0.0.1" +[workspace.lints.rust] +unsafe_code = "deny" + +[workspace.lints.clippy] +all = "warn" + [workspace.dependencies] madmin = { path = "./madmin" } async-trait = "0.1.83" diff --git a/api/admin/Cargo.toml b/api/admin/Cargo.toml index 40a762cde..7c86092cd 100644 --- a/api/admin/Cargo.toml +++ b/api/admin/Cargo.toml @@ -6,6 +6,9 @@ repository.workspace = true rust-version.workspace = true version.workspace = true +[lints] +workspace = true + [dependencies] axum.workspace = true mime.workspace = true diff --git a/common/common/Cargo.toml b/common/common/Cargo.toml index 9031424e8..78eba0acd 100644 --- a/common/common/Cargo.toml +++ b/common/common/Cargo.toml @@ -3,6 +3,9 @@ name = "common" version.workspace = true edition.workspace = true +[lints] +workspace = true + [dependencies] async-trait.workspace = true lazy_static.workspace = true diff --git a/common/lock/Cargo.toml b/common/lock/Cargo.toml index a057759c9..a657f7dca 100644 --- a/common/lock/Cargo.toml +++ b/common/lock/Cargo.toml @@ -3,6 +3,9 @@ name = "lock" version.workspace = true edition.workspace = true +[lints] +workspace = true + [dependencies] async-trait.workspace = true backon.workspace = true diff --git a/common/protos/Cargo.toml b/common/protos/Cargo.toml index 4856fa060..e9197762e 100644 --- a/common/protos/Cargo.toml +++ b/common/protos/Cargo.toml @@ -3,6 +3,9 @@ name = "protos" version.workspace = true edition.workspace = true +[lints] +workspace = true + [dependencies] #async-backtrace = { workspace = true, optional = true } common.workspace = true diff --git a/common/protos/src/lib.rs b/common/protos/src/lib.rs index edc0aae9e..e1b86f2d0 100644 --- a/common/protos/src/lib.rs +++ b/common/protos/src/lib.rs @@ -1,4 +1,6 @@ +#[allow(unsafe_code)] mod generated; + use std::{error::Error, time::Duration}; use common::globals::GLOBAL_Conn_Map; diff --git a/common/workers/Cargo.toml b/common/workers/Cargo.toml index dfb70d140..fa9186886 100644 --- a/common/workers/Cargo.toml +++ b/common/workers/Cargo.toml @@ -6,6 +6,9 @@ repository.workspace = true rust-version.workspace = true version.workspace = true +[lints] +workspace = true + [dependencies] common.workspace = true tokio.workspace = true \ No newline at end of file diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index 179abb6d5..c28bf7006 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -6,6 +6,9 @@ repository.workspace = true rust-version.workspace = true version.workspace = true +[lints] +workspace = true + [dependencies] aes-gcm = { version = "0.10.3", features = ["std"], optional = true } argon2 = { version = "0.5.3", features = ["std"], optional = true } @@ -34,6 +37,3 @@ crypto = [ "dep:rand", "dep:sha2", ] - -[lints.clippy] -unwrap_used = "deny" diff --git a/crypto/src/lib.rs b/crypto/src/lib.rs index 4deec394f..311828049 100644 --- a/crypto/src/lib.rs +++ b/crypto/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::unwrap_used)] + mod encdec; mod error; mod jwt; diff --git a/e2e_test/Cargo.toml b/e2e_test/Cargo.toml index 6700f01b8..58974bad4 100644 --- a/e2e_test/Cargo.toml +++ b/e2e_test/Cargo.toml @@ -8,6 +8,9 @@ rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true + [dependencies] ecstore.workspace = true flatbuffers.workspace = true diff --git a/ecstore/Cargo.toml b/ecstore/Cargo.toml index 316355bef..cb06b6858 100644 --- a/ecstore/Cargo.toml +++ b/ecstore/Cargo.toml @@ -7,6 +7,8 @@ repository.workspace = true rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true [dependencies] async-trait.workspace = true diff --git a/ecstore/src/cache_value/cache.rs b/ecstore/src/cache_value/cache.rs index 15f116dec..96833dd96 100644 --- a/ecstore/src/cache_value/cache.rs +++ b/ecstore/src/cache_value/cache.rs @@ -1,3 +1,5 @@ +#![allow(unsafe_code)] // TODO: audit unsafe code + use std::{ fmt::Debug, future::Future, diff --git a/ecstore/src/utils/os/linux.rs b/ecstore/src/utils/os/linux.rs index 1ee5c3f5e..bd8782bc1 100644 --- a/ecstore/src/utils/os/linux.rs +++ b/ecstore/src/utils/os/linux.rs @@ -160,14 +160,13 @@ fn read_stat(file_name: &str) -> Result> { // 读取第一行 let mut stats = Vec::new(); - for line in reader.lines() { + if let Some(line) = reader.lines().next() { let line = line?; // 分割行并解析为 u64 for token in line.trim().split_whitespace() { let ui64: u64 = token.parse()?; stats.push(ui64); } - break; // 只读取第一行 } Ok(stats) @@ -177,6 +176,7 @@ fn read_stat(file_name: &str) -> Result> { mod test { use super::get_drive_stats; + #[ignore] // FIXME: failed in github actions #[test] fn test_stats() { let major = 7; diff --git a/iam/Cargo.toml b/iam/Cargo.toml index debdcd252..8b67c3536 100644 --- a/iam/Cargo.toml +++ b/iam/Cargo.toml @@ -6,6 +6,9 @@ repository.workspace = true rust-version.workspace = true version.workspace = true +[lints] +workspace = true + [dependencies] tokio.workspace = true log.workspace = true diff --git a/madmin/Cargo.toml b/madmin/Cargo.toml index 83b540932..9893a41db 100644 --- a/madmin/Cargo.toml +++ b/madmin/Cargo.toml @@ -6,6 +6,9 @@ repository.workspace = true rust-version.workspace = true version.workspace = true +[lints] +workspace = true + [dependencies] chrono.workspace = true common.workspace = true diff --git a/reader/Cargo.toml b/reader/Cargo.toml index 87779642e..2e171e942 100644 --- a/reader/Cargo.toml +++ b/reader/Cargo.toml @@ -6,6 +6,8 @@ repository.workspace = true rust-version.workspace = true version.workspace = true +[lints] +workspace = true [dependencies] tracing.workspace = true diff --git a/rustfs/Cargo.toml b/rustfs/Cargo.toml index 9b51bad3c..82b13aaca 100644 --- a/rustfs/Cargo.toml +++ b/rustfs/Cargo.toml @@ -8,6 +8,9 @@ rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true + [dependencies] madmin.workspace = true log.workspace = true diff --git a/rustfs/src/admin/handlers.rs b/rustfs/src/admin/handlers.rs index a91b6f7a1..14e8fd1c3 100644 --- a/rustfs/src/admin/handlers.rs +++ b/rustfs/src/admin/handlers.rs @@ -913,6 +913,7 @@ impl Operation for RebalanceStop { mod test { use ecstore::heal::heal_commands::HealOpts; + #[ignore] // FIXME: failed in github actions #[test] fn test_decode() { let b = b"{\"recursive\":false,\"dryRun\":false,\"remove\":false,\"recreate\":false,\"scanMode\":1,\"updateParity\":false,\"nolock\":false}"; From b6708c511bbfd2fca4c62cc1f473f362dae13f7b Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:02:33 +0800 Subject: [PATCH 10/77] Create mint.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试mint检测手段之确定启动参数 --- .github/workflows/mint.yml | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/mint.yml diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml new file mode 100644 index 000000000..0c017a6c7 --- /dev/null +++ b/.github/workflows/mint.yml @@ -0,0 +1,47 @@ +name: mint-test + +on: + workflow_dispatch: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + mintest: + runs-on: ubuntu-22.04 + timeout-minutes: 30 + steps: + - name: install protoc + run: | + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip + unzip protoc-27.0-linux-x86_64.zip -d protoc3 + mv protoc3/bin/* /usr/local/bin/ + chmod +x /usr/local/bin/protoc + rm -rf protoc-27.0-linux-x86_64.zip protoc3 + + - name: install flatc + run: | + wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip + unzip Linux.flatc.binary.g++-13.zip + mv flatc /usr/local/bin/ + chmod +x /usr/local/bin/flatc + rm -rf Linux.flatc.binary.g++-13.zip + + - name: checkout source code + uses: actions/checkout@v4 + + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: stable + + - name: cargo build & release + run: cargo build --release + + - name: run this rustfs server + run: ./target/release/rustfs --help + From 2042f6aa67349fe3eb71a0f9b34f0d08bbc0a692 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:06:27 +0800 Subject: [PATCH 11/77] Update mint.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试mint之查看启动参数 --- .github/workflows/mint.yml | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 0c017a6c7..679c82e7c 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -14,33 +14,33 @@ jobs: mintest: runs-on: ubuntu-22.04 timeout-minutes: 30 - steps: - - name: install protoc - run: | - wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip - unzip protoc-27.0-linux-x86_64.zip -d protoc3 - mv protoc3/bin/* /usr/local/bin/ - chmod +x /usr/local/bin/protoc - rm -rf protoc-27.0-linux-x86_64.zip protoc3 - - - name: install flatc - run: | - wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip - unzip Linux.flatc.binary.g++-13.zip - mv flatc /usr/local/bin/ - chmod +x /usr/local/bin/flatc - rm -rf Linux.flatc.binary.g++-13.zip - - - name: checkout source code - uses: actions/checkout@v4 - - - name: rust-toolchain - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - - - name: cargo build & release - run: cargo build --release + steps: + - name: install protoc + run: | + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip + unzip protoc-27.0-linux-x86_64.zip -d protoc3 + mv protoc3/bin/* /usr/local/bin/ + chmod +x /usr/local/bin/protoc + rm -rf protoc-27.0-linux-x86_64.zip protoc3 + + - name: install flatc + run: | + wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip + unzip Linux.flatc.binary.g++-13.zip + mv flatc /usr/local/bin/ + chmod +x /usr/local/bin/flatc + rm -rf Linux.flatc.binary.g++-13.zip + + - name: checkout source code + uses: actions/checkout@v4 + + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: stable + + - name: cargo build & release + run: cargo build --release - name: run this rustfs server run: ./target/release/rustfs --help From 087cb64b8cf7976f17dc49a0afaec0ad2eff7615 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:08:13 +0800 Subject: [PATCH 12/77] Update mint.yml --- .github/workflows/mint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 679c82e7c..e97e37b20 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -42,6 +42,6 @@ jobs: - name: cargo build & release run: cargo build --release - - name: run this rustfs server - run: ./target/release/rustfs --help + - name: run this rustfs server + run: ./target/release/rustfs --help From 1bfd370606fbf6e32555f229ed67f8a9da736b03 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:23:36 +0800 Subject: [PATCH 13/77] Update mint.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试运行结果 --- .github/workflows/mint.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index e97e37b20..275b1cb5e 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -43,5 +43,15 @@ jobs: run: cargo build --release - name: run this rustfs server - run: ./target/release/rustfs --help + run: | + # RUSTFS_ROOT_USER=rustfsadmin + # RUSTFS_ROOT_PASSWORD=rustfsadmin + RUSTFS_VOLUMES="/data/rustfs" + RUSTFS_OPTS="--address 0.0.0.0:9001" + mkdir ${RUSTFS_VOLUMES} + nohub ./target/release/rustfs ${RUSTFS_OPTS} ${RUSTFS_VOLUMES} & + + - name: run mint test task + run: | + docker run -e SERVER_ENDPOINT=localhost:9001 minio/mint From e6dafd2402a0e12608ca6f4ac357b2e516bb552c Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:36:27 +0800 Subject: [PATCH 14/77] Update mint.yml --- .github/workflows/mint.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 275b1cb5e..1d4645137 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -44,14 +44,22 @@ jobs: - name: run this rustfs server run: | - # RUSTFS_ROOT_USER=rustfsadmin - # RUSTFS_ROOT_PASSWORD=rustfsadmin - RUSTFS_VOLUMES="/data/rustfs" - RUSTFS_OPTS="--address 0.0.0.0:9001" - mkdir ${RUSTFS_VOLUMES} - nohub ./target/release/rustfs ${RUSTFS_OPTS} ${RUSTFS_VOLUMES} & + mkdir -p /data/rustfs + nohub ./target/release/rustfs \ + --address 0.0.0.0:9000 \ + --access-key rustfsadmin \ + --secret-key rustfsadmin \ + --domain-name localhost:9000 \ + /data/rustfs & - name: run mint test task run: | - docker run -e SERVER_ENDPOINT=localhost:9001 minio/mint + docker run -itd -e SERVER_ENDPOINT=localhost:9000 \ + -e ACCESS_KEY=rustfsadmin \ + -e SECRET_KEY=rustfsadmin \ + -e ENABLE_HTTPS=1 \ + -v /tmp/logs:/mint/log \ + minio/mint + ls -l /tmp/logs + From d40581f9d4eb9996abe456c2b58ad8a48c641a2c Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:51:59 +0800 Subject: [PATCH 15/77] Update mint.yml --- .github/workflows/mint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 1d4645137..1723bdb2e 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -44,13 +44,13 @@ jobs: - name: run this rustfs server run: | - mkdir -p /data/rustfs + mkdir -p data/rustfs nohub ./target/release/rustfs \ --address 0.0.0.0:9000 \ --access-key rustfsadmin \ --secret-key rustfsadmin \ --domain-name localhost:9000 \ - /data/rustfs & + data/rustfs & - name: run mint test task run: | From a362c0788d728cab9b7df7337863b680996a7231 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:02:59 +0800 Subject: [PATCH 16/77] Update mint.yml --- .github/workflows/mint.yml | 88 ++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 1723bdb2e..cf03c5ebc 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -15,44 +15,9 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 30 steps: - - name: install protoc - run: | - wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip - unzip protoc-27.0-linux-x86_64.zip -d protoc3 - mv protoc3/bin/* /usr/local/bin/ - chmod +x /usr/local/bin/protoc - rm -rf protoc-27.0-linux-x86_64.zip protoc3 - - - name: install flatc - run: | - wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip - unzip Linux.flatc.binary.g++-13.zip - mv flatc /usr/local/bin/ - chmod +x /usr/local/bin/flatc - rm -rf Linux.flatc.binary.g++-13.zip - - - name: checkout source code - uses: actions/checkout@v4 - - - name: rust-toolchain - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - - - name: cargo build & release - run: cargo build --release - - - name: run this rustfs server - run: | - mkdir -p data/rustfs - nohub ./target/release/rustfs \ - --address 0.0.0.0:9000 \ - --access-key rustfsadmin \ - --secret-key rustfsadmin \ - --domain-name localhost:9000 \ - data/rustfs & - - - name: run mint test task + - name: craete dir + run: mkdir -p data/rustfs + - name: test docker mint run: | docker run -itd -e SERVER_ENDPOINT=localhost:9000 \ -e ACCESS_KEY=rustfsadmin \ @@ -62,4 +27,51 @@ jobs: minio/mint ls -l /tmp/logs + # - name: install protoc + # run: | + # wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip + # unzip protoc-27.0-linux-x86_64.zip -d protoc3 + # mv protoc3/bin/* /usr/local/bin/ + # chmod +x /usr/local/bin/protoc + # rm -rf protoc-27.0-linux-x86_64.zip protoc3 + + # - name: install flatc + # run: | + # wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip + # unzip Linux.flatc.binary.g++-13.zip + # mv flatc /usr/local/bin/ + # chmod +x /usr/local/bin/flatc + # rm -rf Linux.flatc.binary.g++-13.zip + + # - name: checkout source code + # uses: actions/checkout@v4 + + # - name: rust-toolchain + # uses: actions-rs/toolchain@v1.0.6 + # with: + # toolchain: stable + + # - name: cargo build & release + # run: cargo build --release + + # - name: run this rustfs server + # run: | + # mkdir -p data/rustfs + # nohub ./target/release/rustfs \ + # --address 0.0.0.0:9000 \ + # --access-key rustfsadmin \ + # --secret-key rustfsadmin \ + # --domain-name localhost:9000 \ + # data/rustfs & + + # - name: run mint test task + # run: | + # docker run -itd -e SERVER_ENDPOINT=localhost:9000 \ + # -e ACCESS_KEY=rustfsadmin \ + # -e SECRET_KEY=rustfsadmin \ + # -e ENABLE_HTTPS=1 \ + # -v /tmp/logs:/mint/log \ + # minio/mint + # ls -l /tmp/logs + From e960e6255debe973c87266a9a131705f4dcc60b6 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:08:10 +0800 Subject: [PATCH 17/77] Update mint.yml --- .github/workflows/mint.yml | 88 ++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index cf03c5ebc..67c246095 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -15,9 +15,44 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 30 steps: - - name: craete dir - run: mkdir -p data/rustfs - - name: test docker mint + - name: install protoc + run: | + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip + unzip protoc-27.0-linux-x86_64.zip -d protoc3 + mv protoc3/bin/* /usr/local/bin/ + chmod +x /usr/local/bin/protoc + rm -rf protoc-27.0-linux-x86_64.zip protoc3 + + - name: install flatc + run: | + wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip + unzip Linux.flatc.binary.g++-13.zip + mv flatc /usr/local/bin/ + chmod +x /usr/local/bin/flatc + rm -rf Linux.flatc.binary.g++-13.zip + + - name: checkout source code + uses: actions/checkout@v4 + + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: stable + + - name: cargo build & release + run: cargo build --release + + - name: run this rustfs server + run: | + mkdir -p data/rustfs + nohup ./target/release/rustfs \ + --address 0.0.0.0:9000 \ + --access-key rustfsadmin \ + --secret-key rustfsadmin \ + --domain-name localhost:9000 \ + data/rustfs & + + - name: run mint test task run: | docker run -itd -e SERVER_ENDPOINT=localhost:9000 \ -e ACCESS_KEY=rustfsadmin \ @@ -27,51 +62,4 @@ jobs: minio/mint ls -l /tmp/logs - # - name: install protoc - # run: | - # wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip - # unzip protoc-27.0-linux-x86_64.zip -d protoc3 - # mv protoc3/bin/* /usr/local/bin/ - # chmod +x /usr/local/bin/protoc - # rm -rf protoc-27.0-linux-x86_64.zip protoc3 - - # - name: install flatc - # run: | - # wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip - # unzip Linux.flatc.binary.g++-13.zip - # mv flatc /usr/local/bin/ - # chmod +x /usr/local/bin/flatc - # rm -rf Linux.flatc.binary.g++-13.zip - - # - name: checkout source code - # uses: actions/checkout@v4 - - # - name: rust-toolchain - # uses: actions-rs/toolchain@v1.0.6 - # with: - # toolchain: stable - - # - name: cargo build & release - # run: cargo build --release - - # - name: run this rustfs server - # run: | - # mkdir -p data/rustfs - # nohub ./target/release/rustfs \ - # --address 0.0.0.0:9000 \ - # --access-key rustfsadmin \ - # --secret-key rustfsadmin \ - # --domain-name localhost:9000 \ - # data/rustfs & - - # - name: run mint test task - # run: | - # docker run -itd -e SERVER_ENDPOINT=localhost:9000 \ - # -e ACCESS_KEY=rustfsadmin \ - # -e SECRET_KEY=rustfsadmin \ - # -e ENABLE_HTTPS=1 \ - # -v /tmp/logs:/mint/log \ - # minio/mint - # ls -l /tmp/logs - From 1b26715cc86ff6930c3c0549cce5b839445ecb1c Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:25:01 +0800 Subject: [PATCH 18/77] Update mint.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试执行 --- .github/workflows/mint.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 67c246095..45b443ad5 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -54,12 +54,10 @@ jobs: - name: run mint test task run: | - docker run -itd -e SERVER_ENDPOINT=localhost:9000 \ + ps aux | grep rustfs + docker run -e SERVER_ENDPOINT=localhost:9000 \ -e ACCESS_KEY=rustfsadmin \ -e SECRET_KEY=rustfsadmin \ -e ENABLE_HTTPS=1 \ - -v /tmp/logs:/mint/log \ minio/mint - ls -l /tmp/logs - - + From edd9bb5da69d371814860fa0ad469e61a37f506e Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:31:58 +0800 Subject: [PATCH 19/77] Update mint.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试执行 --- .github/workflows/mint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 45b443ad5..bdedb9bcb 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -38,6 +38,9 @@ jobs: uses: actions-rs/toolchain@v1.0.6 with: toolchain: stable + + - name: cache rust dependencies + uses: Swatinem/rust-cache@v2 - name: cargo build & release run: cargo build --release From f1f310ad862dda75e8eb017009b105d36aa33398 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:15:39 +0800 Subject: [PATCH 20/77] =?UTF-8?q?mint=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/mint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index bdedb9bcb..93136570b 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -61,6 +61,6 @@ jobs: docker run -e SERVER_ENDPOINT=localhost:9000 \ -e ACCESS_KEY=rustfsadmin \ -e SECRET_KEY=rustfsadmin \ - -e ENABLE_HTTPS=1 \ + -e ENABLE_HTTPS=0 \ minio/mint From a4588521a1724f411790dd11d3a24ded319d0cda Mon Sep 17 00:00:00 2001 From: mujunxiang <1948535941@qq.com> Date: Fri, 6 Dec 2024 14:32:17 +0800 Subject: [PATCH 21/77] tmp(1) Signed-off-by: mujunxiang <1948535941@qq.com> --- Cargo.lock | 9 ++ Cargo.toml | 1 + ecstore/src/disk/local.rs | 4 +- ecstore/src/disk/mod.rs | 7 +- ecstore/src/disk/remote.rs | 2 + ecstore/src/endpoints.rs | 3 +- ecstore/src/heal/background_heal_ops.rs | 3 +- ecstore/src/heal/data_scanner.rs | 81 ++++++++++- ecstore/src/heal/heal_commands.rs | 44 ------ ecstore/src/heal/heal_ops.rs | 10 +- ecstore/src/lib.rs | 2 +- ecstore/src/notification_sys.rs | 10 +- ecstore/src/peer.rs | 4 +- ecstore/src/peer_rest_client.rs | 2 +- ecstore/src/set_disk.rs | 7 +- ecstore/src/sets.rs | 4 +- ecstore/src/store.rs | 3 +- ecstore/src/store_api.rs | 4 +- ecstore/src/utils/mod.rs | 1 - ecstore/src/utils/time.rs | 55 -------- madmin/Cargo.toml | 3 + madmin/src/heal_commands.rs | 46 +++++++ madmin/src/lib.rs | 4 + madmin/src/service_commands.rs | 103 ++++++++++++++ madmin/src/trace.rs | 172 ++++++++++++++++++++++++ madmin/src/utils.rs | 37 +++++ rustfs/src/admin/handlers.rs | 7 +- rustfs/src/admin/handlers/trace.rs | 37 +++++ rustfs/src/grpc.rs | 2 +- 29 files changed, 532 insertions(+), 135 deletions(-) delete mode 100644 ecstore/src/utils/time.rs create mode 100644 madmin/src/heal_commands.rs create mode 100644 madmin/src/service_commands.rs create mode 100644 madmin/src/trace.rs create mode 100644 madmin/src/utils.rs create mode 100644 rustfs/src/admin/handlers/trace.rs diff --git a/Cargo.lock b/Cargo.lock index 624ea2695..755756bfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1207,6 +1207,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hybrid-array" version = "0.2.1" @@ -1676,9 +1682,12 @@ version = "0.0.1" dependencies = [ "chrono", "common", + "humantime", + "hyper", "psutil", "serde", "time", + "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7736c02f8..310288570 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,7 @@ hyper-util = { version = "0.1.10", features = [ ] } http = "1.1.0" http-body = "1.0.1" +humantime = "2.1.0" lock = { path = "./common/lock" } lazy_static = "1.5.0" mime = "0.3.17" diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index d44fa68d4..51ba61c41 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -21,7 +21,7 @@ use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE}; use crate::error::{Error, Result}; use crate::file_meta::read_xl_meta_no_data; use crate::global::{GLOBAL_IsErasureSD, GLOBAL_RootDiskThreshold}; -use crate::heal::data_scanner::{has_active_rules, scan_data_folder, ScannerItem, SizeSummary}; +use crate::heal::data_scanner::{has_active_rules, scan_data_folder, ScannerItem, ShouldSleepFn, SizeSummary}; use crate::heal::data_scanner_metric::{ScannerMetric, ScannerMetrics}; use crate::heal::data_usage_cache::{DataUsageCache, DataUsageEntry}; use crate::heal::error::{ERR_IGNORE_FILE_CONTRIB, ERR_SKIP_FILE}; @@ -2164,6 +2164,7 @@ impl DiskAPI for LocalDisk { cache: &DataUsageCache, updates: Sender, scan_mode: HealScanMode, + we_sleep: ShouldSleepFn, ) -> Result { self.scanning.fetch_add(1, Ordering::SeqCst); defer!(|| { self.scanning.fetch_sub(1, Ordering::SeqCst) }); @@ -2279,6 +2280,7 @@ impl DiskAPI for LocalDisk { }) }), scan_mode, + we_sleep, ) .await?; data_usage_info.info.last_update = Some(SystemTime::now()); diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 0b6080304..35e54ce1d 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -19,6 +19,7 @@ use crate::{ error::{Error, Result}, file_meta::{merge_file_meta_versions, FileMeta, FileMetaShallowVersion}, heal::{ + data_scanner::ShouldSleepFn, data_usage_cache::{DataUsageCache, DataUsageEntry}, heal_commands::{HealScanMode, HealingTracker}, }, @@ -351,11 +352,12 @@ impl DiskAPI for Disk { cache: &DataUsageCache, updates: Sender, scan_mode: HealScanMode, + we_sleep: ShouldSleepFn, ) -> Result { info!("ns_scanner"); match self { - Disk::Local(local_disk) => local_disk.ns_scanner(cache, updates, scan_mode).await, - Disk::Remote(remote_disk) => remote_disk.ns_scanner(cache, updates, scan_mode).await, + Disk::Local(local_disk) => local_disk.ns_scanner(cache, updates, scan_mode, we_sleep).await, + Disk::Remote(remote_disk) => remote_disk.ns_scanner(cache, updates, scan_mode, we_sleep).await, } } @@ -468,6 +470,7 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { cache: &DataUsageCache, updates: Sender, scan_mode: HealScanMode, + we_sleep: ShouldSleepFn, ) -> Result; async fn healing(&self) -> Option; } diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 3259f9414..a8239f652 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -25,6 +25,7 @@ use crate::{ disk::error::DiskError, error::{Error, Result}, heal::{ + data_scanner::ShouldSleepFn, data_usage_cache::{DataUsageCache, DataUsageEntry}, heal_commands::{HealScanMode, HealingTracker}, }, @@ -759,6 +760,7 @@ impl DiskAPI for RemoteDisk { cache: &DataUsageCache, updates: Sender, scan_mode: HealScanMode, + _we_sleep: ShouldSleepFn, ) -> Result { info!("ns_scanner"); let cache = serde_json::to_string(cache)?; diff --git a/ecstore/src/endpoints.rs b/ecstore/src/endpoints.rs index 334c74d65..b1205b87d 100644 --- a/ecstore/src/endpoints.rs +++ b/ecstore/src/endpoints.rs @@ -1,4 +1,5 @@ -use tracing::warn; +use tracing::{info, warn}; +use url::Url; use crate::{ disk::endpoint::{Endpoint, EndpointType}, diff --git a/ecstore/src/heal/background_heal_ops.rs b/ecstore/src/heal/background_heal_ops.rs index fa9a1f63d..4e49d7f5c 100644 --- a/ecstore/src/heal/background_heal_ops.rs +++ b/ecstore/src/heal/background_heal_ops.rs @@ -1,3 +1,4 @@ +use madmin::heal_commands::HealResultItem; use std::{cmp::Ordering, env, path::PathBuf, sync::Arc, time::Duration}; use tokio::{ sync::{ @@ -10,7 +11,7 @@ use tracing::{error, info}; use uuid::Uuid; use super::{ - heal_commands::{HealOpts, HealResultItem}, + heal_commands::HealOpts, heal_ops::{new_bg_heal_sequence, HealSequence}, }; use crate::heal::error::ERR_RETRY_HEALING; diff --git a/ecstore/src/heal/data_scanner.rs b/ecstore/src/heal/data_scanner.rs index 0f5790933..05b883af9 100644 --- a/ecstore/src/heal/data_scanner.rs +++ b/ecstore/src/heal/data_scanner.rs @@ -62,7 +62,7 @@ use crate::{ store_api::{FileInfo, ObjectInfo}, }; -const _DATA_SCANNER_SLEEP_PER_FOLDER: Duration = Duration::from_millis(1); // Time to wait between folders. +const DATA_SCANNER_SLEEP_PER_FOLDER: Duration = Duration::from_millis(1); // Time to wait between folders. const DATA_USAGE_UPDATE_DIR_CYCLES: u32 = 16; // Visit all folders every n cycles. const DATA_SCANNER_COMPACT_LEAST_OBJECT: u64 = 500; // Compact when there are less than this many objects in a branch. const DATA_SCANNER_COMPACT_AT_CHILDREN: u64 = 10000; // Compact when there are this many children in a branch. @@ -73,7 +73,6 @@ const DATA_SCANNER_START_DELAY: Duration = Duration::from_secs(60); // Time to w pub const HEAL_DELETE_DANGLING: bool = true; const HEAL_OBJECT_SELECT_PROB: u64 = 1024; // Overall probability of a file being scanned; one in n. -// static SCANNER_SLEEPER: () = new_dynamic_sleeper(2, Duration::from_secs(1), true); // Keep defaults same as config defaults static SCANNER_CYCLE: AtomicU64 = AtomicU64::new(DATA_SCANNER_START_DELAY.as_secs()); static _SCANNER_IDLE_MODE: AtomicU32 = AtomicU32::new(0); // default is throttled when idle static SCANNER_EXCESS_OBJECT_VERSIONS: AtomicU64 = AtomicU64::new(100); @@ -81,9 +80,67 @@ static SCANNER_EXCESS_OBJECT_VERSIONS_TOTAL_SIZE: AtomicU64 = AtomicU64::new(102 static SCANNER_EXCESS_FOLDERS: AtomicU64 = AtomicU64::new(50_000); lazy_static! { + static ref SCANNER_SLEEPER: RwLock = RwLock::new(new_dynamic_sleeper(2.0, Duration::from_secs(1), true)); pub static ref globalHealConfig: Arc> = Arc::new(RwLock::new(Config::default())); } +struct DynamicSleeper { + factor: f64, + max_sleep: Duration, + min_sleep: Duration, + _is_scanner: bool, +} + +type TimerFn = Pin + Send>>; +impl DynamicSleeper { + fn timer() -> TimerFn { + let t = SystemTime::now(); + Box::pin(async move { + let done_at = SystemTime::now().duration_since(t).unwrap_or_default(); + SCANNER_SLEEPER.read().await.sleep(done_at).await; + }) + } + + async fn sleep(&self, base: Duration) { + let (min_wait, max_wait) = (self.min_sleep, self.max_sleep); + let factor = self.factor; + + let want_sleep = { + let tmp = base.mul_f64(factor); + if tmp < min_wait { + return; + } + + if max_wait > Duration::from_secs(0) && tmp > max_wait { + max_wait + } else { + tmp + } + }; + sleep(want_sleep).await; + } + + fn _update(&mut self, factor: f64, max_wait: Duration) -> Result<()> { + if (self.factor - factor).abs() < 1e-10 && self.max_sleep == max_wait { + return Ok(()); + } + + self.factor = factor; + self.max_sleep = max_wait; + + Ok(()) + } +} + +fn new_dynamic_sleeper(factor: f64, max_wait: Duration, is_scanner: bool) -> DynamicSleeper { + DynamicSleeper { + factor, + max_sleep: max_wait, + min_sleep: Duration::from_micros(100), + _is_scanner: is_scanner, + } +} + pub async fn init_data_scanner() { tokio::spawn(async move { loop { @@ -457,6 +514,7 @@ struct CachedFolder { pub type GetSizeFn = Box Pin> + Send>> + Send + Sync + 'static>; pub type UpdateCurrentPathFn = Arc Pin + Send>> + Send + Sync + 'static>; +pub type ShouldSleepFn = Option bool + Send + Sync + 'static>>; struct FolderScanner { root: String, @@ -474,6 +532,7 @@ struct FolderScanner { update_current_path: UpdateCurrentPathFn, skip_heal: AtomicBool, drive: LocalDrive, + we_sleep: ShouldSleepFn, } impl FolderScanner { @@ -514,6 +573,12 @@ impl FolderScanner { None }; + if let Some(should_sleep) = &self.we_sleep { + if should_sleep() { + SCANNER_SLEEPER.read().await.sleep(DATA_SCANNER_SLEEP_PER_FOLDER).await; + } + } + let mut existing_folders = Vec::new(); let mut new_folders = Vec::new(); let mut found_objects: bool = false; @@ -553,6 +618,16 @@ impl FolderScanner { continue; } + let _wait = if let Some(should_sleep) = &self.we_sleep { + if should_sleep() { + DynamicSleeper::timer() + } else { + Box::pin(async {}) + } + } else { + Box::pin(async {}) + }; + let mut item = ScannerItem { path: Path::new(&self.root).join(&ent_name).to_string_lossy().to_string(), bucket, @@ -1001,6 +1076,7 @@ pub async fn scan_data_folder( cache: &DataUsageCache, get_size_fn: GetSizeFn, heal_scan_mode: HealScanMode, + should_sleep: ShouldSleepFn, ) -> Result { if cache.info.name.is_empty() || cache.info.name == DATA_USAGE_ROOT { return Err(Error::from_string("internal error: root scan attempted")); @@ -1029,6 +1105,7 @@ pub async fn scan_data_folder( disks_quorum: disks.len() / 2, skip_heal, drive: drive.clone(), + we_sleep: should_sleep, }; if *GLOBAL_IsErasure.read().await || !cache.info.skip_healing { diff --git a/ecstore/src/heal/heal_commands.rs b/ecstore/src/heal/heal_commands.rs index 0ce859109..3aee3cd54 100644 --- a/ecstore/src/heal/heal_commands.rs +++ b/ecstore/src/heal/heal_commands.rs @@ -24,7 +24,6 @@ use crate::{ use super::{background_heal_ops::get_local_disks_to_heal, heal_ops::BG_HEALING_UUID}; pub type HealScanMode = usize; -pub type HealItemType = String; pub const HEAL_UNKNOWN_SCAN: HealScanMode = 0; pub const HEAL_NORMAL_SCAN: HealScanMode = 1; @@ -66,49 +65,6 @@ pub struct HealOpts { pub set: Option, } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct HealDriveInfo { - pub uuid: String, - pub endpoint: String, - pub state: String, -} - -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct Infos { - #[serde(rename = "drives")] - pub drives: Vec, -} - -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct HealResultItem { - #[serde(rename = "resultId")] - pub result_index: usize, - #[serde(rename = "type")] - pub heal_item_type: HealItemType, - #[serde(rename = "bucket")] - pub bucket: String, - #[serde(rename = "object")] - pub object: String, - #[serde(rename = "versionId")] - pub version_id: String, - #[serde(rename = "detail")] - pub detail: String, - #[serde(rename = "parityBlocks")] - pub parity_blocks: usize, - #[serde(rename = "dataBlocks")] - pub data_blocks: usize, - #[serde(rename = "diskCount")] - pub disk_count: usize, - #[serde(rename = "setCount")] - pub set_count: usize, - #[serde(rename = "before")] - pub before: Infos, - #[serde(rename = "after")] - pub after: Infos, - #[serde(rename = "objectSize")] - pub object_size: usize, -} - #[derive(Debug, Serialize, Deserialize)] pub struct HealStartSuccess { #[serde(rename = "clientToken")] diff --git a/ecstore/src/heal/heal_ops.rs b/ecstore/src/heal/heal_ops.rs index 53b5551a0..ed774ecbe 100644 --- a/ecstore/src/heal/heal_ops.rs +++ b/ecstore/src/heal/heal_ops.rs @@ -2,19 +2,14 @@ use super::{ background_heal_ops::HealTask, data_scanner::HEAL_DELETE_DANGLING, error::ERR_SKIP_FILE, - heal_commands::{ - HealItemType, HealOpts, HealResultItem, HealScanMode, HealStopSuccess, HealingTracker, HEAL_ITEM_BUCKET_METADATA, - }, + heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingDisk, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, }; use crate::store_api::StorageAPI; use crate::{ config::common::CONFIG_PREFIX, disk::RUSTFS_META_BUCKET, global::GLOBAL_BackgroundHealRoutine, - heal::{ - error::ERR_HEAL_STOP_SIGNALLED, - heal_commands::{HealDriveInfo, DRIVE_STATE_OK}, - }, + heal::{error::ERR_HEAL_STOP_SIGNALLED, heal_commands::DRIVE_STATE_OK}, }; use crate::{ disk::{endpoint::Endpoint, MetaCacheEntry}, @@ -32,6 +27,7 @@ use crate::{ use chrono::Utc; use futures::join; use lazy_static::lazy_static; +use madmin::heal_commands::{HealDriveInfo, HealItemType, HealResultItem}; use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index 8aa575a33..0043ad04d 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -18,7 +18,7 @@ pub mod metacache; pub mod metrics_realtime; pub mod notification_sys; pub mod peer; -mod peer_rest_client; +pub mod peer_rest_client; pub mod pools; mod quorum; pub mod set_disk; diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index c0735900f..aaf6d4d12 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -25,14 +25,14 @@ pub fn get_global_notification_sys() -> Option<&'static NotificationSys> { } pub struct NotificationSys { - peer_clients: Vec>, + pub peer_clients: Vec>, #[allow(dead_code)] - all_peer_clients: Vec>, + pub all_peer_clients: Vec>, } impl NotificationSys { pub async fn new(eps: EndpointServerPools) -> Self { - let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(eps).await; + let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(&eps).await; Self { peer_clients, all_peer_clients, @@ -46,9 +46,7 @@ pub struct NotificationPeerErr { } impl NotificationSys { - pub fn rest_client_from_hash(&self, s:&str) ->Option{ - - + pub fn rest_client_from_hash(&self, s: &str) -> Option { None } pub async fn delete_policy(&self) -> Vec { diff --git a/ecstore/src/peer.rs b/ecstore/src/peer.rs index a5217ba95..e9d02c608 100644 --- a/ecstore/src/peer.rs +++ b/ecstore/src/peer.rs @@ -1,5 +1,6 @@ use async_trait::async_trait; use futures::future::join_all; +use madmin::heal_commands::{HealDriveInfo, HealResultItem}; use protos::node_service_time_out_client; use protos::proto_gen::node_service::{ DeleteBucketRequest, GetBucketInfoRequest, HealBucketRequest, ListBucketRequest, MakeBucketRequest, @@ -14,8 +15,7 @@ use crate::disk::error::is_all_buckets_not_found; use crate::disk::{DiskAPI, DiskStore}; use crate::global::GLOBAL_LOCAL_DISK_MAP; use crate::heal::heal_commands::{ - HealDriveInfo, HealOpts, HealResultItem, DRIVE_STATE_CORRUPT, DRIVE_STATE_MISSING, DRIVE_STATE_OFFLINE, DRIVE_STATE_OK, - HEAL_ITEM_BUCKET, + HealOpts, DRIVE_STATE_CORRUPT, DRIVE_STATE_MISSING, DRIVE_STATE_OFFLINE, DRIVE_STATE_OK, HEAL_ITEM_BUCKET, }; use crate::heal::heal_ops::RUESTFS_RESERVED_BUCKET; use crate::quorum::{bucket_op_ignored_errs, reduce_write_quorum_errs}; diff --git a/ecstore/src/peer_rest_client.rs b/ecstore/src/peer_rest_client.rs index 76aaee692..f67925759 100644 --- a/ecstore/src/peer_rest_client.rs +++ b/ecstore/src/peer_rest_client.rs @@ -35,7 +35,7 @@ pub const PEER_RESTSIGNAL: &str = "signal"; pub const PEER_RESTSUB_SYS: &str = "sub-sys"; pub const PEER_RESTDRY_RUN: &str = "dry-run"; -#[derive(Debug, Clone)] +#[derive(Clone, Debug)] pub struct PeerRestClient { pub host: XHost, pub grid_host: String, diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 4a6b430e4..d938671db 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -30,8 +30,8 @@ use crate::{ data_usage::{DATA_USAGE_CACHE_NAME, DATA_USAGE_ROOT}, data_usage_cache::{DataUsageCacheInfo, DataUsageEntry, DataUsageEntryInfo}, heal_commands::{ - HealDriveInfo, HealOpts, HealResultItem, HealScanMode, HealingTracker, DRIVE_STATE_CORRUPT, DRIVE_STATE_MISSING, - DRIVE_STATE_OFFLINE, DRIVE_STATE_OK, HEAL_DEEP_SCAN, HEAL_ITEM_OBJECT, HEAL_NORMAL_SCAN, + HealOpts, HealScanMode, HealingTracker, DRIVE_STATE_CORRUPT, DRIVE_STATE_MISSING, DRIVE_STATE_OFFLINE, + DRIVE_STATE_OK, HEAL_DEEP_SCAN, HEAL_ITEM_OBJECT, HEAL_NORMAL_SCAN, }, heal_ops::BG_HEALING_UUID, }, @@ -67,6 +67,7 @@ use lock::{ namespace_lock::{new_nslock, NsLockMap}, LockApi, }; +use madmin::heal_commands::{HealDriveInfo, HealResultItem}; use rand::{ thread_rng, {seq::SliceRandom, Rng}, @@ -2816,7 +2817,7 @@ impl SetDisks { }); // Calc usage let before = cache.info.last_update; - let cache = match disk.clone().ns_scanner(&cache, tx, heal_scan_mode).await { + let cache = match disk.clone().ns_scanner(&cache, tx, heal_scan_mode, None).await { Ok(cache) => cache, Err(_) => { if cache.info.last_update > before { diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index 708805a9d..505610579 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -5,6 +5,7 @@ use common::globals::GLOBAL_Local_Node_Name; use futures::future::join_all; use http::HeaderMap; use lock::{namespace_lock::NsLockMap, new_lock_api, LockApi}; +use madmin::heal_commands::{HealDriveInfo, HealResultItem}; use tokio::sync::RwLock; use uuid::Uuid; @@ -18,8 +19,7 @@ use crate::{ error::{Error, Result}, global::{is_dist_erasure, GLOBAL_LOCAL_DISK_SET_DRIVES}, heal::heal_commands::{ - HealDriveInfo, HealOpts, HealResultItem, DRIVE_STATE_CORRUPT, DRIVE_STATE_MISSING, DRIVE_STATE_OFFLINE, DRIVE_STATE_OK, - HEAL_ITEM_METADATA, + HealOpts, DRIVE_STATE_CORRUPT, DRIVE_STATE_MISSING, DRIVE_STATE_OFFLINE, DRIVE_STATE_OK, HEAL_ITEM_METADATA, }, set_disk::SetDisks, store_api::{ diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index d886df61c..86dda946e 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -12,7 +12,7 @@ use crate::global::{ }; use crate::heal::data_usage::{DataUsageInfo, DATA_USAGE_ROOT}; use crate::heal::data_usage_cache::{DataUsageCache, DataUsageCacheInfo}; -use crate::heal::heal_commands::{HealOpts, HealResultItem, HealScanMode, HEAL_ITEM_METADATA}; +use crate::heal::heal_commands::{HealOpts, HealScanMode, HEAL_ITEM_METADATA}; use crate::heal::heal_ops::{HealEntryFn, HealSequence}; use crate::new_object_layer_fn; use crate::notification_sys::get_global_notification_sys; @@ -45,6 +45,7 @@ use futures::future::join_all; use glob::Pattern; use http::HeaderMap; use lazy_static::lazy_static; +use madmin::heal_commands::HealResultItem; use rand::Rng; use s3s::dto::{BucketVersioningStatus, ObjectLockConfiguration, ObjectLockEnabled, VersioningConfiguration}; use std::cmp::Ordering; diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index 715d21810..48a860fee 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -2,12 +2,14 @@ use crate::heal::heal_ops::HealSequence; use crate::{ disk::DiskStore, error::{Error, Result}, - heal::heal_commands::{HealOpts, HealResultItem}, + heal::heal_commands::HealOpts, utils::path::decode_dir_object, xhttp, }; use futures::StreamExt; use http::HeaderMap; +use madmin::heal_commands::HealResultItem; +use madmin::info_commands::DiskMetrics; use rmp_serde::Serializer; use s3s::{dto::StreamingBlob, Body}; use serde::{Deserialize, Serialize}; diff --git a/ecstore/src/utils/mod.rs b/ecstore/src/utils/mod.rs index 467d8cdfa..65aac72b2 100644 --- a/ecstore/src/utils/mod.rs +++ b/ecstore/src/utils/mod.rs @@ -6,6 +6,5 @@ pub mod hash; pub mod net; pub mod os; pub mod path; -pub mod time; pub mod wildcard; pub mod xml; diff --git a/ecstore/src/utils/time.rs b/ecstore/src/utils/time.rs deleted file mode 100644 index 791db2d44..000000000 --- a/ecstore/src/utils/time.rs +++ /dev/null @@ -1,55 +0,0 @@ -use std::time::Duration; - -use tracing::info; - -pub fn parse_duration(s: &str) -> Option { - if s.ends_with("ms") { - if let Ok(s) = s.trim_end_matches("ms").parse::() { - return Some(Duration::from_millis(s)); - } - } else if s.ends_with("s") { - if let Ok(s) = s.trim_end_matches('s').parse::() { - return Some(Duration::from_secs(s)); - } - } else if s.ends_with("m") { - if let Ok(s) = s.trim_end_matches('m').parse::() { - return Some(Duration::from_secs(s * 60)); - } - } else if s.ends_with("h") { - if let Ok(s) = s.trim_end_matches('h').parse::() { - return Some(Duration::from_secs(s * 60 * 60)); - } - } - info!("can not parse duration, s: {}", s); - None -} - -#[cfg(test)] -mod test { - use std::time::Duration; - - use super::parse_duration; - - #[test] - fn test_parse_dur() { - let s = String::from("3s"); - let dur = parse_duration(&s); - println!("{:?}", dur); - assert_eq!(Some(Duration::from_secs(3)), dur); - - let s = String::from("3ms"); - let dur = parse_duration(&s); - println!("{:?}", dur); - assert_eq!(Some(Duration::from_millis(3)), dur); - - let s = String::from("3m"); - let dur = parse_duration(&s); - println!("{:?}", dur); - assert_eq!(Some(Duration::from_secs(3 * 60)), dur); - - let s = String::from("3h"); - let dur = parse_duration(&s); - println!("{:?}", dur); - assert_eq!(Some(Duration::from_secs(3 * 60 * 60)), dur); - } -} diff --git a/madmin/Cargo.toml b/madmin/Cargo.toml index 9893a41db..06c1a835d 100644 --- a/madmin/Cargo.toml +++ b/madmin/Cargo.toml @@ -12,6 +12,9 @@ workspace = true [dependencies] chrono.workspace = true common.workspace = true +humantime.workspace = true +hyper.workspace = true psutil = "3.3.0" serde.workspace = true time.workspace =true +tracing.workspace = truetime.workspace =true diff --git a/madmin/src/heal_commands.rs b/madmin/src/heal_commands.rs new file mode 100644 index 000000000..eec724acf --- /dev/null +++ b/madmin/src/heal_commands.rs @@ -0,0 +1,46 @@ +use serde::{Deserialize, Serialize}; + +pub type HealItemType = String; + +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub struct HealDriveInfo { + pub uuid: String, + pub endpoint: String, + pub state: String, +} + +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub struct Infos { + #[serde(rename = "drives")] + pub drives: Vec, +} + +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub struct HealResultItem { + #[serde(rename = "resultId")] + pub result_index: usize, + #[serde(rename = "type")] + pub heal_item_type: HealItemType, + #[serde(rename = "bucket")] + pub bucket: String, + #[serde(rename = "object")] + pub object: String, + #[serde(rename = "versionId")] + pub version_id: String, + #[serde(rename = "detail")] + pub detail: String, + #[serde(rename = "parityBlocks")] + pub parity_blocks: usize, + #[serde(rename = "dataBlocks")] + pub data_blocks: usize, + #[serde(rename = "diskCount")] + pub disk_count: usize, + #[serde(rename = "setCount")] + pub set_count: usize, + #[serde(rename = "before")] + pub before: Infos, + #[serde(rename = "after")] + pub after: Infos, + #[serde(rename = "objectSize")] + pub object_size: usize, +} diff --git a/madmin/src/lib.rs b/madmin/src/lib.rs index fd416c428..4f8f29ed8 100644 --- a/madmin/src/lib.rs +++ b/madmin/src/lib.rs @@ -1,6 +1,10 @@ +pub mod heal_commands; pub mod health; pub mod info_commands; pub mod metrics; pub mod net; +pub mod service_commands; +pub mod trace; +pub mod utils; pub use info_commands::*; diff --git a/madmin/src/service_commands.rs b/madmin/src/service_commands.rs new file mode 100644 index 000000000..9db8b57d2 --- /dev/null +++ b/madmin/src/service_commands.rs @@ -0,0 +1,103 @@ +use std::{collections::HashMap, time::Duration}; + +use hyper::Uri; + +use crate::{trace::TraceType, utils::parse_duration}; + +#[derive(Debug, Default)] +pub struct ServiceTraceOpts { + s3: bool, + internal: bool, + storage: bool, + os: bool, + scanner: bool, + decommission: bool, + healing: bool, + batch_replication: bool, + batch_key_rotation: bool, + batch_expire: bool, + batch_all: bool, + rebalance: bool, + replication_resync: bool, + bootstrap: bool, + ftp: bool, + ilm: bool, + only_errors: bool, + threshold: Duration, +} + +impl ServiceTraceOpts { + fn trace_types(&self) -> TraceType { + let mut tt = TraceType::default(); + tt.set_if(self.s3, &TraceType::S3); + tt.set_if(self.internal, &TraceType::INTERNAL); + tt.set_if(self.storage, &TraceType::STORAGE); + tt.set_if(self.os, &TraceType::OS); + tt.set_if(self.scanner, &TraceType::SCANNER); + tt.set_if(self.decommission, &TraceType::DECOMMISSION); + tt.set_if(self.healing, &TraceType::HEALING); + + if self.batch_all { + tt.set_if(true, &TraceType::BATCH_REPLICATION); + tt.set_if(true, &TraceType::BATCH_KEY_ROTATION); + tt.set_if(true, &TraceType::BATCH_EXPIRE); + } else { + tt.set_if(self.batch_replication, &TraceType::BATCH_REPLICATION); + tt.set_if(self.batch_key_rotation, &TraceType::BATCH_KEY_ROTATION); + tt.set_if(self.batch_expire, &TraceType::BATCH_EXPIRE); + } + + tt.set_if(self.rebalance, &TraceType::REBALANCE); + tt.set_if(self.replication_resync, &TraceType::REPLICATION_RESYNC); + tt.set_if(self.bootstrap, &TraceType::BOOTSTRAP); + tt.set_if(self.ftp, &TraceType::FTP); + tt.set_if(self.ilm, &TraceType::ILM); + + tt + } + + pub fn parse_params(&mut self, uri: &Uri) -> Result<(), String> { + let query_pairs: HashMap<_, _> = uri + .query() + .unwrap_or("") + .split('&') + .filter_map(|pair| { + let mut split = pair.split('='); + let key = split.next()?.to_string(); + let value = split.next().map(|v| v.to_string()).unwrap_or_else(|| "false".to_string()); + Some((key, value)) + }) + .collect(); + + self.s3 = query_pairs.get("s3").map_or(false, |v| v == "true"); + self.os = query_pairs.get("os").map_or(false, |v| v == "true"); + self.scanner = query_pairs.get("scanner").map_or(false, |v| v == "true"); + self.decommission = query_pairs.get("decommission").map_or(false, |v| v == "true"); + self.healing = query_pairs.get("healing").map_or(false, |v| v == "true"); + self.batch_replication = query_pairs.get("batch-replication").map_or(false, |v| v == "true"); + self.batch_key_rotation = query_pairs.get("batch-keyrotation").map_or(false, |v| v == "true"); + self.batch_expire = query_pairs.get("batch-expire").map_or(false, |v| v == "true"); + if query_pairs.get("all").map_or(false, |v| v == "true") { + self.s3 = true; + self.internal = true; + self.storage = true; + self.os = true; + } + + self.rebalance = query_pairs.get("rebalance").map_or(false, |v| v == "true"); + self.storage = query_pairs.get("storage").map_or(false, |v| v == "true"); + self.internal = query_pairs.get("internal").map_or(false, |v| v == "true"); + self.only_errors = query_pairs.get("err").map_or(false, |v| v == "true"); + self.replication_resync = query_pairs.get("replication-resync").map_or(false, |v| v == "true"); + self.bootstrap = query_pairs.get("bootstrap").map_or(false, |v| v == "true"); + self.ftp = query_pairs.get("ftp").map_or(false, |v| v == "true"); + self.ilm = query_pairs.get("ilm").map_or(false, |v| v == "true"); + + if let Some(threshold) = query_pairs.get("threshold") { + let duration = parse_duration(threshold)?; + self.threshold = duration; + } + + Ok(()) + } +} diff --git a/madmin/src/trace.rs b/madmin/src/trace.rs new file mode 100644 index 000000000..702362f80 --- /dev/null +++ b/madmin/src/trace.rs @@ -0,0 +1,172 @@ +use std::{collections::HashMap, time::Duration}; + +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; + +use crate::heal_commands::HealResultItem; + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub struct TraceType(u64); + +impl TraceType { + // 定义一些常量 + pub const OS: TraceType = TraceType(1 << 0); + pub const STORAGE: TraceType = TraceType(1 << 1); + pub const S3: TraceType = TraceType(1 << 2); + pub const INTERNAL: TraceType = TraceType(1 << 3); + pub const SCANNER: TraceType = TraceType(1 << 4); + pub const DECOMMISSION: TraceType = TraceType(1 << 5); + pub const HEALING: TraceType = TraceType(1 << 6); + pub const BATCH_REPLICATION: TraceType = TraceType(1 << 7); + pub const BATCH_KEY_ROTATION: TraceType = TraceType(1 << 8); + pub const BATCH_EXPIRE: TraceType = TraceType(1 << 9); + pub const REBALANCE: TraceType = TraceType(1 << 10); + pub const REPLICATION_RESYNC: TraceType = TraceType(1 << 11); + pub const BOOTSTRAP: TraceType = TraceType(1 << 12); + pub const FTP: TraceType = TraceType(1 << 13); + pub const ILM: TraceType = TraceType(1 << 14); + + // MetricsAll must be last. + pub const ALL: TraceType = TraceType((1 << 15) - 1); + + pub fn new(t: u64) -> Self { + Self(t) + } +} + +impl Default for TraceType { + fn default() -> Self { + Self(0) + } +} + +impl TraceType { + pub fn contains(&self, x: &TraceType) -> bool { + (self.0 & x.0) == x.0 + } + + pub fn overlaps(&self, x: &TraceType) -> bool { + (self.0 & x.0) != 0 + } + + pub fn single_type(&self) -> bool { + todo!() + } + + pub fn merge(&mut self, other: &TraceType) { + self.0 = self.0 | other.0 + } + + pub fn set_if(&mut self, b: bool, other: &TraceType) { + if b { + self.0 = self.0 | other.0 + } + } + + pub fn mask(&self) -> u64 { + self.0 + } +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct TraceInfo { + #[serde(rename = "type")] + trace_type: u64, + #[serde(rename = "nodename")] + node_name: String, + #[serde(rename = "funcname")] + func_name: String, + #[serde(rename = "time")] + time: DateTime, + #[serde(rename = "path")] + path: String, + #[serde(rename = "dur")] + duration: Duration, + #[serde(rename = "bytes", skip_serializing_if = "Option::is_none")] + bytes: Option, + #[serde(rename = "msg", skip_serializing_if = "Option::is_none")] + message: Option, + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + error: Option, + #[serde(rename = "custom", skip_serializing_if = "Option::is_none")] + custom: Option>, + #[serde(rename = "http", skip_serializing_if = "Option::is_none")] + http: Option, + #[serde(rename = "healResult", skip_serializing_if = "Option::is_none")] + heal_result: Option, +} + +impl TraceInfo { + pub fn mask(&self) -> u64 { + TraceType::new(self.trace_type).mask() + } +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct TraceInfoLegacy { + trace_info: TraceInfo, + #[serde(rename = "request")] + req_info: Option, + #[serde(rename = "response")] + resp_info: Option, + #[serde(rename = "stats")] + call_stats: Option, + #[serde(rename = "storageStats")] + storage_stats: Option, + #[serde(rename = "osStats")] + os_stats: Option, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct StorageStats { + path: String, + duration: Duration, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct OSStats { + path: String, + duration: Duration, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct TraceHTTPStats { + req_info: TraceRequestInfo, + resp_info: TraceResponseInfo, + call_stats: TraceCallStats, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct TraceCallStats { + input_bytes: i32, + output_bytes: i32, + latency: Duration, + time_to_first_byte: Duration, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct TraceRequestInfo { + time: DateTime, + proto: String, + method: String, + #[serde(skip_serializing_if = "Option::is_none")] + path: Option, + #[serde(skip_serializing_if = "Option::is_none")] + raw_query: Option, + #[serde(skip_serializing_if = "Option::is_none")] + headers: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + body: Option>, + client: String, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct TraceResponseInfo { + time: DateTime, + #[serde(skip_serializing_if = "Option::is_none")] + headers: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + body: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + status_code: Option, +} diff --git a/madmin/src/utils.rs b/madmin/src/utils.rs new file mode 100644 index 000000000..a25b4f66e --- /dev/null +++ b/madmin/src/utils.rs @@ -0,0 +1,37 @@ +use std::time::Duration; + +pub fn parse_duration(s: &str) -> Result { + // Implement your own duration parsing logic here + // For example, you could use the humantime crate or a custom parser + humantime::parse_duration(s).map_err(|e| e.to_string()) +} + +#[cfg(test)] +mod test { + use std::time::Duration; + + use super::parse_duration; + + #[test] + fn test_parse_dur() { + let s = String::from("3s"); + let dur = parse_duration(&s); + println!("{:?}", dur); + assert_eq!(Ok(Duration::from_secs(3)), dur); + + let s = String::from("3ms"); + let dur = parse_duration(&s); + println!("{:?}", dur); + assert_eq!(Ok(Duration::from_millis(3)), dur); + + let s = String::from("3m"); + let dur = parse_duration(&s); + println!("{:?}", dur); + assert_eq!(Ok(Duration::from_secs(3 * 60)), dur); + + let s = String::from("3h"); + let dur = parse_duration(&s); + println!("{:?}", dur); + assert_eq!(Ok(Duration::from_secs(3 * 60 * 60)), dur); + } +} diff --git a/rustfs/src/admin/handlers.rs b/rustfs/src/admin/handlers.rs index 14e8fd1c3..297fff8f7 100644 --- a/rustfs/src/admin/handlers.rs +++ b/rustfs/src/admin/handlers.rs @@ -15,13 +15,13 @@ use ecstore::peer::is_reserved_or_invalid_bucket; use ecstore::store::is_valid_object_prefix; use ecstore::store_api::StorageAPI; use ecstore::utils::path::path_join; -use ecstore::utils::time::parse_duration; use ecstore::utils::xml; use ecstore::GLOBAL_Endpoints; use futures::{Stream, StreamExt}; use http::Uri; use hyper::StatusCode; use madmin::metrics::RealtimeMetrics; +use madmin::utils::parse_duration; use matchit::Params; use s3s::stream::{ByteStream, DynByteStream}; use s3s::{ @@ -45,6 +45,7 @@ use tokio_stream::wrappers::ReceiverStream; use tracing::{error, info, warn}; pub mod service_account; +pub mod trace; #[derive(Deserialize, Debug, Default)] #[serde(rename_all = "PascalCase", default)] @@ -370,8 +371,8 @@ impl Operation for MetricsHandler { info!("mp: {:?}", mp); let tick = match parse_duration(&mp.tick) { - Some(i) => i, - None => std_Duration::from_secs(1), + Ok(i) => i, + Err(_) => std_Duration::from_secs(1), }; let mut n = mp.n; diff --git a/rustfs/src/admin/handlers/trace.rs b/rustfs/src/admin/handlers/trace.rs new file mode 100644 index 000000000..cf3c1710a --- /dev/null +++ b/rustfs/src/admin/handlers/trace.rs @@ -0,0 +1,37 @@ +use ecstore::{peer_rest_client::PeerRestClient, GLOBAL_Endpoints}; +use http::StatusCode; +use hyper::Uri; +use madmin::service_commands::ServiceTraceOpts; +use matchit::Params; +use s3s::{s3_error, Body, S3Request, S3Response, S3Result}; +use tokio::sync::mpsc; +use tracing::warn; + +use crate::admin::router::Operation; + +fn extract_trace_options(uri: &Uri) -> S3Result { + let mut st_opts = ServiceTraceOpts::default(); + st_opts + .parse_params(uri) + .map_err(|_| s3_error!(InvalidRequest, "invalid params"))?; + + Ok(st_opts) +} + +pub struct Trace {} + +#[async_trait::async_trait] +impl Operation for Trace { + async fn call(&self, req: S3Request, _params: Params<'_, '_>) -> S3Result> { + warn!("handle Trace"); + + let trace_opts = extract_trace_options(&req.uri)?; + + // let (tx, rx) = mpsc::channel(10000); + let perrs = match GLOBAL_Endpoints.get() { + Some(ep) => PeerRestClient::new_clients(ep).await, + None => (Vec::new(), Vec::new()), + }; + return Err(s3_error!(NotImplemented)); + } +} diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index 16c7c588c..c529ac8ca 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -1349,7 +1349,7 @@ impl Node for NodeService { } } }); - let data_usage_cache = disk.ns_scanner(&cache, updates_tx, request.scan_mode as usize).await; + let data_usage_cache = disk.ns_scanner(&cache, updates_tx, request.scan_mode as usize, None).await; let _ = task.await; match data_usage_cache { Ok(data_usage_cache) => { From b286689025a84bc9d1ef619e488a6e6fa7fbe87c Mon Sep 17 00:00:00 2001 From: junxiang Mu <1948535941@qq.com> Date: Mon, 9 Dec 2024 14:55:38 +0800 Subject: [PATCH 22/77] fix GLOBAL_LOCAL_DISK_MAP key Signed-off-by: junxiang Mu <1948535941@qq.com> --- ecstore/src/disk/mod.rs | 27 ++++++++++++------ ecstore/src/disk/remote.rs | 56 +++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 35e54ce1d..e7387504a 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -1050,7 +1050,7 @@ type NodeClient = NodeServiceClient< #[derive(Debug)] pub struct RemoteFileWriter { - pub root: PathBuf, + pub endpoint: Endpoint, pub volume: String, pub path: String, pub is_append: bool, @@ -1059,7 +1059,13 @@ pub struct RemoteFileWriter { } impl RemoteFileWriter { - pub async fn new(root: PathBuf, volume: String, path: String, is_append: bool, mut client: NodeClient) -> Result { + pub async fn new( + endpoint: Endpoint, + volume: String, + path: String, + is_append: bool, + mut client: NodeClient, + ) -> Result { let (tx, rx) = mpsc::channel(128); let in_stream = ReceiverStream::new(rx); @@ -1068,7 +1074,7 @@ impl RemoteFileWriter { let resp_stream = response.into_inner(); Ok(Self { - root, + endpoint, volume, path, is_append, @@ -1086,7 +1092,7 @@ impl Writer for RemoteFileWriter { async fn write(&mut self, buf: &[u8]) -> Result<()> { let request = WriteRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: self.volume.to_string(), path: self.path.to_string(), is_append: self.is_append, @@ -1241,7 +1247,7 @@ impl Reader for LocalFileReader { #[derive(Debug)] pub struct RemoteFileReader { - pub root: PathBuf, + pub endpoint: Endpoint, pub volume: String, pub path: String, tx: Sender, @@ -1249,7 +1255,12 @@ pub struct RemoteFileReader { } impl RemoteFileReader { - pub async fn new(root: PathBuf, volume: String, path: String, mut client: NodeClient) -> Result { + pub async fn new( + endpoint: Endpoint, + volume: String, + path: String, + mut client: NodeClient, + ) -> Result { let (tx, rx) = mpsc::channel(128); let in_stream = ReceiverStream::new(rx); @@ -1258,7 +1269,7 @@ impl RemoteFileReader { let resp_stream = response.into_inner(); Ok(Self { - root, + endpoint, volume, path, tx, @@ -1271,7 +1282,7 @@ impl RemoteFileReader { impl Reader for RemoteFileReader { async fn read_at(&mut self, offset: usize, buf: &mut [u8]) -> Result { let request = ReadAtRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: self.volume.to_string(), path: self.path.to_string(), offset: offset.try_into().unwrap(), diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index a8239f652..6f5534c79 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -130,7 +130,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(ReadAllRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), }); @@ -152,7 +152,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(WriteAllRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), data, @@ -174,7 +174,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(DeleteRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), options, @@ -196,7 +196,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(VerifyFileRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), file_info, @@ -220,7 +220,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(CheckPartsRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), file_info, @@ -243,7 +243,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(RenamePartRequst { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), src_volume: src_volume.to_string(), src_path: src_path.to_string(), dst_volume: dst_volume.to_string(), @@ -265,7 +265,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(RenameFileRequst { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), src_volume: src_volume.to_string(), src_path: src_path.to_string(), dst_volume: dst_volume.to_string(), @@ -285,7 +285,7 @@ impl DiskAPI for RemoteDisk { info!("create_file"); Ok(FileWriter::Remote( RemoteFileWriter::new( - self.root.clone(), + self.endpoint.clone(), volume.to_string(), path.to_string(), false, @@ -301,7 +301,7 @@ impl DiskAPI for RemoteDisk { info!("append_file"); Ok(FileWriter::Remote( RemoteFileWriter::new( - self.root.clone(), + self.endpoint.clone(), volume.to_string(), path.to_string(), true, @@ -317,7 +317,7 @@ impl DiskAPI for RemoteDisk { info!("read_file"); Ok(FileReader::Remote( RemoteFileReader::new( - self.root.clone(), + self.endpoint.clone(), volume.to_string(), path.to_string(), node_service_time_out_client(&self.addr) @@ -334,7 +334,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(ListDirRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), }); @@ -354,7 +354,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(WalkDirRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), walk_dir_options, }); @@ -387,7 +387,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(RenameDataRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), src_volume: src_volume.to_string(), src_path: src_path.to_string(), file_info, @@ -412,7 +412,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(MakeVolumesRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volumes: volumes.iter().map(|s| (*s).to_string()).collect(), }); @@ -431,7 +431,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(MakeVolumeRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), }); @@ -450,7 +450,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(ListVolumesRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), }); let response = client.list_volumes(request).await?.into_inner(); @@ -474,7 +474,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(StatVolumeRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), }); @@ -496,7 +496,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(DeletePathsRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), paths, }); @@ -518,7 +518,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(UpdateMetadataRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), file_info, @@ -541,7 +541,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(WriteMetadataRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), file_info, @@ -570,7 +570,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(ReadVersionRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), version_id: version_id.to_string(), @@ -594,7 +594,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(ReadXlRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), read_data, @@ -626,7 +626,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(DeleteVersionRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), path: path.to_string(), file_info, @@ -660,7 +660,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(DeleteVersionsRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), versions: versions_str, opts, @@ -695,7 +695,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(ReadMultipleRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), read_multiple_req, }); @@ -720,7 +720,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(DeleteVolumeRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), volume: volume.to_string(), }); @@ -740,7 +740,7 @@ impl DiskAPI for RemoteDisk { .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(DiskInfoRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), opts, }); @@ -772,7 +772,7 @@ impl DiskAPI for RemoteDisk { let in_stream = ReceiverStream::new(rx); let mut response = client.ns_scanner(in_stream).await?.into_inner(); let request = NsScannerRequest { - disk: self.root.to_string_lossy().to_string(), + disk: self.endpoint.to_string(), cache, scan_mode: scan_mode as u64, }; From 9608ef917b76bd9720971c5dfe268565e033130b Mon Sep 17 00:00:00 2001 From: junxiang Mu <1948535941@qq.com> Date: Mon, 9 Dec 2024 15:31:10 +0800 Subject: [PATCH 23/77] rebase main Signed-off-by: junxiang Mu <1948535941@qq.com> --- .../generated/flatbuffers_generated/models.rs | 207 +- .../src/generated/proto_gen/node_service.rs | 3832 +++++++++++++---- ecstore/src/disk/mod.rs | 15 +- ecstore/src/heal/heal_ops.rs | 2 +- ecstore/src/notification_sys.rs | 2 +- madmin/Cargo.toml | 2 +- rustfs/src/admin/handlers/trace.rs | 7 +- 7 files changed, 3161 insertions(+), 906 deletions(-) diff --git a/common/protos/src/generated/flatbuffers_generated/models.rs b/common/protos/src/generated/flatbuffers_generated/models.rs index e4949fdcf..aa1f6ae2f 100644 --- a/common/protos/src/generated/flatbuffers_generated/models.rs +++ b/common/protos/src/generated/flatbuffers_generated/models.rs @@ -1,9 +1,10 @@ // automatically generated by the FlatBuffers compiler, do not modify + // @generated -use core::cmp::Ordering; use core::mem; +use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -11,114 +12,112 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod models { - use core::cmp::Ordering; - use core::mem; + use core::mem; + use core::cmp::Ordering; - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; - pub enum PingBodyOffset {} - #[derive(Copy, Clone, PartialEq)] +pub enum PingBodyOffset {} +#[derive(Copy, Clone, PartialEq)] - pub struct PingBody<'a> { - pub _tab: flatbuffers::Table<'a>, +pub struct PingBody<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { + type Inner = PingBody<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> PingBody<'a> { + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; + + pub const fn get_fully_qualified_name() -> &'static str { + "models.PingBody" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PingBody { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PingBodyArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = PingBodyBuilder::new(_fbb); + if let Some(x) = args.payload { builder.add_payload(x); } + builder.finish() + } + + + #[inline] + pub fn payload(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(PingBody::VT_PAYLOAD, None)} + } +} + +impl flatbuffers::Verifiable for PingBody<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>("payload", Self::VT_PAYLOAD, false)? + .finish(); + Ok(()) + } +} +pub struct PingBodyArgs<'a> { + pub payload: Option>>, +} +impl<'a> Default for PingBodyArgs<'a> { + #[inline] + fn default() -> Self { + PingBodyArgs { + payload: None, } + } +} - impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { - type Inner = PingBody<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: flatbuffers::Table::new(buf, loc), - } - } +pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { + #[inline] + pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(PingBody::VT_PAYLOAD, payload); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PingBodyBuilder { + fbb_: _fbb, + start_: start, } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} - impl<'a> PingBody<'a> { - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; +impl core::fmt::Debug for PingBody<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PingBody"); + ds.field("payload", &self.payload()); + ds.finish() + } +} +} // pub mod models - pub const fn get_fully_qualified_name() -> &'static str { - "models.PingBody" - } - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PingBody { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PingBodyArgs<'args>, - ) -> flatbuffers::WIPOffset> { - let mut builder = PingBodyBuilder::new(_fbb); - if let Some(x) = args.payload { - builder.add_payload(x); - } - builder.finish() - } - - #[inline] - pub fn payload(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::>>(PingBody::VT_PAYLOAD, None) - } - } - } - - impl flatbuffers::Verifiable for PingBody<'_> { - #[inline] - fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("payload", Self::VT_PAYLOAD, false)? - .finish(); - Ok(()) - } - } - pub struct PingBodyArgs<'a> { - pub payload: Option>>, - } - impl<'a> Default for PingBodyArgs<'a> { - #[inline] - fn default() -> Self { - PingBodyArgs { payload: None } - } - } - - pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, - } - impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::>(PingBody::VT_PAYLOAD, payload); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PingBodyBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } - } - - impl core::fmt::Debug for PingBody<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PingBody"); - ds.field("payload", &self.payload()); - ds.finish() - } - } -} // pub mod models diff --git a/common/protos/src/generated/proto_gen/node_service.rs b/common/protos/src/generated/proto_gen/node_service.rs index 6c4aef0e1..74e524da1 100644 --- a/common/protos/src/generated/proto_gen/node_service.rs +++ b/common/protos/src/generated/proto_gen/node_service.rs @@ -615,7 +615,10 @@ pub struct GenerallyLockResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mss { #[prost(map = "string, string", tag = "1")] - pub value: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + pub value: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct LocalStorageInfoRequest { @@ -779,7 +782,10 @@ pub struct DownloadProfileDataResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(map = "string, bytes", tag = "2")] - pub data: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::vec::Vec>, + pub data: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, #[prost(string, optional, tag = "3")] pub error_info: ::core::option::Option<::prost::alloc::string::String>, } @@ -1046,9 +1052,15 @@ pub struct LoadTransitionTierConfigResponse { } /// Generated client implementations. pub mod node_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] - use tonic::codegen::http::Uri; + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct NodeServiceClient { inner: tonic::client::Grpc, @@ -1079,16 +1091,22 @@ pub mod node_service_client { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: F) -> NodeServiceClient> + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> NodeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, - Response = http::Response<>::ResponseBody>, + Response = http::Response< + >::ResponseBody, + >, >, - >>::Error: - Into + std::marker::Send + std::marker::Sync, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, { NodeServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -1131,9 +1149,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Ping"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Ping", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Ping")); @@ -1142,13 +1166,22 @@ pub mod node_service_client { pub async fn heal_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/HealBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/HealBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "HealBucket")); @@ -1157,13 +1190,22 @@ pub mod node_service_client { pub async fn list_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListBucket")); @@ -1172,13 +1214,22 @@ pub mod node_service_client { pub async fn make_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeBucket")); @@ -1187,13 +1238,22 @@ pub mod node_service_client { pub async fn get_bucket_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetBucketInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketInfo")); @@ -1202,13 +1262,22 @@ pub mod node_service_client { pub async fn delete_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucket")); @@ -1217,13 +1286,22 @@ pub mod node_service_client { pub async fn read_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAll"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadAll", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAll")); @@ -1232,13 +1310,22 @@ pub mod node_service_client { pub async fn write_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteAll"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteAll", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteAll")); @@ -1251,9 +1338,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Delete"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Delete", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Delete")); @@ -1262,13 +1355,22 @@ pub mod node_service_client { pub async fn verify_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/VerifyFile"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/VerifyFile", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "VerifyFile")); @@ -1277,13 +1379,22 @@ pub mod node_service_client { pub async fn check_parts( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/CheckParts"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/CheckParts", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "CheckParts")); @@ -1292,13 +1403,22 @@ pub mod node_service_client { pub async fn rename_part( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenamePart"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenamePart", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenamePart")); @@ -1307,13 +1427,22 @@ pub mod node_service_client { pub async fn rename_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameFile"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenameFile", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameFile")); @@ -1326,9 +1455,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Write"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Write", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Write")); @@ -1337,13 +1472,22 @@ pub mod node_service_client { pub async fn write_stream( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteStream"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteStream", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteStream")); @@ -1353,13 +1497,22 @@ pub mod node_service_client { pub async fn read_at( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAt"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadAt", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAt")); @@ -1368,13 +1521,22 @@ pub mod node_service_client { pub async fn list_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListDir"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListDir", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListDir")); @@ -1383,13 +1545,22 @@ pub mod node_service_client { pub async fn walk_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WalkDir"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WalkDir", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WalkDir")); @@ -1398,13 +1569,22 @@ pub mod node_service_client { pub async fn rename_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameData"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenameData", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameData")); @@ -1413,13 +1593,22 @@ pub mod node_service_client { pub async fn make_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolumes"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeVolumes", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolumes")); @@ -1428,13 +1617,22 @@ pub mod node_service_client { pub async fn make_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolume")); @@ -1443,13 +1641,22 @@ pub mod node_service_client { pub async fn list_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListVolumes"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListVolumes", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListVolumes")); @@ -1458,13 +1665,22 @@ pub mod node_service_client { pub async fn stat_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StatVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StatVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StatVolume")); @@ -1473,13 +1689,22 @@ pub mod node_service_client { pub async fn delete_paths( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePaths"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeletePaths", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePaths")); @@ -1488,13 +1713,22 @@ pub mod node_service_client { pub async fn update_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UpdateMetadata", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetadata")); @@ -1503,13 +1737,22 @@ pub mod node_service_client { pub async fn write_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteMetadata", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteMetadata")); @@ -1518,13 +1761,22 @@ pub mod node_service_client { pub async fn read_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadVersion"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadVersion", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadVersion")); @@ -1537,9 +1789,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadXL"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadXL", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadXL")); @@ -1548,13 +1806,22 @@ pub mod node_service_client { pub async fn delete_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersion"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVersion", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersion")); @@ -1563,13 +1830,22 @@ pub mod node_service_client { pub async fn delete_versions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersions"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVersions", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersions")); @@ -1578,13 +1854,22 @@ pub mod node_service_client { pub async fn read_multiple( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadMultiple"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadMultiple", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadMultiple")); @@ -1593,13 +1878,22 @@ pub mod node_service_client { pub async fn delete_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVolume")); @@ -1608,13 +1902,22 @@ pub mod node_service_client { pub async fn disk_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DiskInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DiskInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DiskInfo")); @@ -1623,13 +1926,22 @@ pub mod node_service_client { pub async fn ns_scanner( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/NsScanner"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/NsScanner", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "NsScanner")); @@ -1638,13 +1950,22 @@ pub mod node_service_client { pub async fn lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Lock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Lock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Lock")); @@ -1653,13 +1974,22 @@ pub mod node_service_client { pub async fn un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UnLock")); @@ -1668,13 +1998,22 @@ pub mod node_service_client { pub async fn r_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RLock")); @@ -1683,13 +2022,22 @@ pub mod node_service_client { pub async fn r_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RUnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RUnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RUnLock")); @@ -1698,13 +2046,22 @@ pub mod node_service_client { pub async fn force_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ForceUnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ForceUnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ForceUnLock")); @@ -1713,13 +2070,22 @@ pub mod node_service_client { pub async fn refresh( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Refresh"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Refresh", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Refresh")); @@ -1728,13 +2094,22 @@ pub mod node_service_client { pub async fn local_storage_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LocalStorageInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LocalStorageInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LocalStorageInfo")); @@ -1743,13 +2118,22 @@ pub mod node_service_client { pub async fn server_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ServerInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ServerInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ServerInfo")); @@ -1758,13 +2142,22 @@ pub mod node_service_client { pub async fn get_cpus( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetCpus"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetCpus", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetCpus")); @@ -1773,13 +2166,22 @@ pub mod node_service_client { pub async fn get_net_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetNetInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetNetInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetNetInfo")); @@ -1788,13 +2190,22 @@ pub mod node_service_client { pub async fn get_partitions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetPartitions"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetPartitions", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetPartitions")); @@ -1803,13 +2214,22 @@ pub mod node_service_client { pub async fn get_os_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetOsInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetOsInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetOsInfo")); @@ -1818,13 +2238,22 @@ pub mod node_service_client { pub async fn get_se_linux_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSELinuxInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSELinuxInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSELinuxInfo")); @@ -1833,13 +2262,22 @@ pub mod node_service_client { pub async fn get_sys_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSysConfig", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysConfig")); @@ -1848,13 +2286,22 @@ pub mod node_service_client { pub async fn get_sys_errors( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysErrors"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSysErrors", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysErrors")); @@ -1863,13 +2310,22 @@ pub mod node_service_client { pub async fn get_mem_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMemInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMemInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMemInfo")); @@ -1878,13 +2334,22 @@ pub mod node_service_client { pub async fn get_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetrics"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMetrics", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMetrics")); @@ -1893,13 +2358,22 @@ pub mod node_service_client { pub async fn get_proc_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetProcInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetProcInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetProcInfo")); @@ -1908,13 +2382,22 @@ pub mod node_service_client { pub async fn start_profiling( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StartProfiling"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StartProfiling", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StartProfiling")); @@ -1923,28 +2406,48 @@ pub mod node_service_client { pub async fn download_profile_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DownloadProfileData"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DownloadProfileData", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DownloadProfileData")); + .insert( + GrpcMethod::new("node_service.NodeService", "DownloadProfileData"), + ); self.inner.unary(req, path, codec).await } pub async fn get_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketStats"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetBucketStats", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketStats")); @@ -1953,13 +2456,22 @@ pub mod node_service_client { pub async fn get_sr_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSRMetrics"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSRMetrics", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSRMetrics")); @@ -1968,58 +2480,100 @@ pub mod node_service_client { pub async fn get_all_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetAllBucketStats"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetAllBucketStats", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "GetAllBucketStats")); + .insert( + GrpcMethod::new("node_service.NodeService", "GetAllBucketStats"), + ); self.inner.unary(req, path, codec).await } pub async fn load_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadBucketMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadBucketMetadata", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucketMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteBucketMetadata", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata")); + .insert( + GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePolicy"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeletePolicy", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePolicy")); @@ -2028,13 +2582,22 @@ pub mod node_service_client { pub async fn load_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicy"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadPolicy", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicy")); @@ -2043,28 +2606,48 @@ pub mod node_service_client { pub async fn load_policy_mapping( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicyMapping"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadPolicyMapping", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteUser"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteUser", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteUser")); @@ -2073,28 +2656,48 @@ pub mod node_service_client { pub async fn delete_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteServiceAccount"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteServiceAccount", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount")); + .insert( + GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount"), + ); self.inner.unary(req, path, codec).await } pub async fn load_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadUser"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadUser", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadUser")); @@ -2103,28 +2706,48 @@ pub mod node_service_client { pub async fn load_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadServiceAccount"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadServiceAccount", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadServiceAccount")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadServiceAccount"), + ); self.inner.unary(req, path, codec).await } pub async fn load_group( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadGroup"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadGroup", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadGroup")); @@ -2133,16 +2756,30 @@ pub mod node_service_client { pub async fn reload_site_replication_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadSiteReplicationConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReloadSiteReplicationConfig", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "ReloadSiteReplicationConfig")); + .insert( + GrpcMethod::new( + "node_service.NodeService", + "ReloadSiteReplicationConfig", + ), + ); self.inner.unary(req, path, codec).await } /// rpc VerifyBinary() returns () {}; @@ -2150,13 +2787,22 @@ pub mod node_service_client { pub async fn signal_service( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/SignalService"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/SignalService", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "SignalService")); @@ -2165,58 +2811,100 @@ pub mod node_service_client { pub async fn background_heal_status( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/BackgroundHealStatus"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/BackgroundHealStatus", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus")); + .insert( + GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus"), + ); self.inner.unary(req, path, codec).await } pub async fn get_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetacacheListing"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMetacacheListing", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "GetMetacacheListing")); + .insert( + GrpcMethod::new("node_service.NodeService", "GetMetacacheListing"), + ); self.inner.unary(req, path, codec).await } pub async fn update_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetacacheListing"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UpdateMetacacheListing", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing")); + .insert( + GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing"), + ); self.inner.unary(req, path, codec).await } pub async fn reload_pool_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadPoolMeta"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReloadPoolMeta", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReloadPoolMeta")); @@ -2225,13 +2913,22 @@ pub mod node_service_client { pub async fn stop_rebalance( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StopRebalance"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StopRebalance", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StopRebalance")); @@ -2240,38 +2937,69 @@ pub mod node_service_client { pub async fn load_rebalance_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadRebalanceMeta"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadRebalanceMeta", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta"), + ); self.inner.unary(req, path, codec).await } pub async fn load_transition_tier_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadTransitionTierConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadTransitionTierConfig", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadTransitionTierConfig")); + .insert( + GrpcMethod::new( + "node_service.NodeService", + "LoadTransitionTierConfig", + ), + ); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod node_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with NodeServiceServer. #[async_trait] @@ -2284,23 +3012,38 @@ pub mod node_service_server { async fn heal_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn list_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_bucket_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_all( &self, request: tonic::Request, @@ -2308,7 +3051,10 @@ pub mod node_service_server { async fn write_all( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete( &self, request: tonic::Request, @@ -2316,33 +3062,52 @@ pub mod node_service_server { async fn verify_file( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn check_parts( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn rename_part( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn rename_file( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn write( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WriteStream method. - type WriteStreamStream: tonic::codegen::tokio_stream::Stream> + type WriteStreamStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn write_stream( &self, request: tonic::Request>, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the ReadAt method. - type ReadAtStream: tonic::codegen::tokio_stream::Stream> + type ReadAtStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; /// rpc Append(AppendRequest) returns (AppendResponse) {}; @@ -2361,39 +3126,66 @@ pub mod node_service_server { async fn rename_data( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_volumes( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn list_volumes( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn stat_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_paths( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn write_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_version( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_xl( &self, request: tonic::Request, @@ -2401,25 +3193,42 @@ pub mod node_service_server { async fn delete_version( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_versions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_multiple( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn disk_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the NsScanner method. - type NsScannerStream: tonic::codegen::tokio_stream::Stream> + type NsScannerStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn ns_scanner( @@ -2429,35 +3238,59 @@ pub mod node_service_server { async fn lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn r_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn r_un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn force_un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn refresh( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn local_storage_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn server_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_cpus( &self, request: tonic::Request, @@ -2465,137 +3298,236 @@ pub mod node_service_server { async fn get_net_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_partitions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_os_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_se_linux_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sys_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sys_errors( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_mem_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_metrics( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_proc_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn start_profiling( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn download_profile_data( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sr_metrics( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_all_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_policy( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_policy( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_policy_mapping( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_user( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_service_account( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_user( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_service_account( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_group( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn reload_site_replication_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// rpc VerifyBinary() returns () {}; /// rpc CommitBinary() returns () {}; async fn signal_service( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn background_heal_status( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn reload_pool_meta( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn stop_rebalance( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_rebalance_meta( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_transition_tier_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } #[derive(Debug)] pub struct NodeServiceServer { @@ -2618,7 +3550,10 @@ pub mod node_service_server { max_encoding_message_size: None, } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -2662,7 +3597,10 @@ pub mod node_service_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -2670,12 +3608,21 @@ pub mod node_service_server { "/node_service.NodeService/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl tonic::server::UnaryService for PingSvc { + impl tonic::server::UnaryService + for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::ping(&inner, request).await }; + let fut = async move { + ::ping(&inner, request).await + }; Box::pin(fut) } } @@ -2688,8 +3635,14 @@ pub mod node_service_server { let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2698,12 +3651,23 @@ pub mod node_service_server { "/node_service.NodeService/HealBucket" => { #[allow(non_camel_case_types)] struct HealBucketSvc(pub Arc); - impl tonic::server::UnaryService for HealBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for HealBucketSvc { type Response = super::HealBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::heal_bucket(&inner, request).await }; + let fut = async move { + ::heal_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2716,8 +3680,14 @@ pub mod node_service_server { let method = HealBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2726,12 +3696,23 @@ pub mod node_service_server { "/node_service.NodeService/ListBucket" => { #[allow(non_camel_case_types)] struct ListBucketSvc(pub Arc); - impl tonic::server::UnaryService for ListBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListBucketSvc { type Response = super::ListBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_bucket(&inner, request).await }; + let fut = async move { + ::list_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2744,8 +3725,14 @@ pub mod node_service_server { let method = ListBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2754,12 +3741,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeBucket" => { #[allow(non_camel_case_types)] struct MakeBucketSvc(pub Arc); - impl tonic::server::UnaryService for MakeBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeBucketSvc { type Response = super::MakeBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_bucket(&inner, request).await }; + let fut = async move { + ::make_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2772,8 +3770,14 @@ pub mod node_service_server { let method = MakeBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2782,12 +3786,23 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketInfo" => { #[allow(non_camel_case_types)] struct GetBucketInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetBucketInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetBucketInfoSvc { type Response = super::GetBucketInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_bucket_info(&inner, request).await }; + let fut = async move { + ::get_bucket_info(&inner, request).await + }; Box::pin(fut) } } @@ -2800,8 +3815,14 @@ pub mod node_service_server { let method = GetBucketInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2810,12 +3831,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucket" => { #[allow(non_camel_case_types)] struct DeleteBucketSvc(pub Arc); - impl tonic::server::UnaryService for DeleteBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteBucketSvc { type Response = super::DeleteBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_bucket(&inner, request).await }; + let fut = async move { + ::delete_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2828,8 +3860,14 @@ pub mod node_service_server { let method = DeleteBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2838,12 +3876,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadAll" => { #[allow(non_camel_case_types)] struct ReadAllSvc(pub Arc); - impl tonic::server::UnaryService for ReadAllSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadAllSvc { type Response = super::ReadAllResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_all(&inner, request).await }; + let fut = async move { + ::read_all(&inner, request).await + }; Box::pin(fut) } } @@ -2856,8 +3905,14 @@ pub mod node_service_server { let method = ReadAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2866,12 +3921,23 @@ pub mod node_service_server { "/node_service.NodeService/WriteAll" => { #[allow(non_camel_case_types)] struct WriteAllSvc(pub Arc); - impl tonic::server::UnaryService for WriteAllSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WriteAllSvc { type Response = super::WriteAllResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_all(&inner, request).await }; + let fut = async move { + ::write_all(&inner, request).await + }; Box::pin(fut) } } @@ -2884,8 +3950,14 @@ pub mod node_service_server { let method = WriteAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2894,12 +3966,23 @@ pub mod node_service_server { "/node_service.NodeService/Delete" => { #[allow(non_camel_case_types)] struct DeleteSvc(pub Arc); - impl tonic::server::UnaryService for DeleteSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteSvc { type Response = super::DeleteResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete(&inner, request).await }; + let fut = async move { + ::delete(&inner, request).await + }; Box::pin(fut) } } @@ -2912,8 +3995,14 @@ pub mod node_service_server { let method = DeleteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2922,12 +4011,23 @@ pub mod node_service_server { "/node_service.NodeService/VerifyFile" => { #[allow(non_camel_case_types)] struct VerifyFileSvc(pub Arc); - impl tonic::server::UnaryService for VerifyFileSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for VerifyFileSvc { type Response = super::VerifyFileResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::verify_file(&inner, request).await }; + let fut = async move { + ::verify_file(&inner, request).await + }; Box::pin(fut) } } @@ -2940,8 +4040,14 @@ pub mod node_service_server { let method = VerifyFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2950,12 +4056,23 @@ pub mod node_service_server { "/node_service.NodeService/CheckParts" => { #[allow(non_camel_case_types)] struct CheckPartsSvc(pub Arc); - impl tonic::server::UnaryService for CheckPartsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for CheckPartsSvc { type Response = super::CheckPartsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::check_parts(&inner, request).await }; + let fut = async move { + ::check_parts(&inner, request).await + }; Box::pin(fut) } } @@ -2968,8 +4085,14 @@ pub mod node_service_server { let method = CheckPartsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2978,12 +4101,23 @@ pub mod node_service_server { "/node_service.NodeService/RenamePart" => { #[allow(non_camel_case_types)] struct RenamePartSvc(pub Arc); - impl tonic::server::UnaryService for RenamePartSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenamePartSvc { type Response = super::RenamePartResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_part(&inner, request).await }; + let fut = async move { + ::rename_part(&inner, request).await + }; Box::pin(fut) } } @@ -2996,8 +4130,14 @@ pub mod node_service_server { let method = RenamePartSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3006,12 +4146,23 @@ pub mod node_service_server { "/node_service.NodeService/RenameFile" => { #[allow(non_camel_case_types)] struct RenameFileSvc(pub Arc); - impl tonic::server::UnaryService for RenameFileSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenameFileSvc { type Response = super::RenameFileResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_file(&inner, request).await }; + let fut = async move { + ::rename_file(&inner, request).await + }; Box::pin(fut) } } @@ -3024,8 +4175,14 @@ pub mod node_service_server { let method = RenameFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3034,12 +4191,21 @@ pub mod node_service_server { "/node_service.NodeService/Write" => { #[allow(non_camel_case_types)] struct WriteSvc(pub Arc); - impl tonic::server::UnaryService for WriteSvc { + impl tonic::server::UnaryService + for WriteSvc { type Response = super::WriteResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write(&inner, request).await }; + let fut = async move { + ::write(&inner, request).await + }; Box::pin(fut) } } @@ -3052,8 +4218,14 @@ pub mod node_service_server { let method = WriteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3062,13 +4234,26 @@ pub mod node_service_server { "/node_service.NodeService/WriteStream" => { #[allow(non_camel_case_types)] struct WriteStreamSvc(pub Arc); - impl tonic::server::StreamingService for WriteStreamSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for WriteStreamSvc { type Response = super::WriteResponse; type ResponseStream = T::WriteStreamStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_stream(&inner, request).await }; + let fut = async move { + ::write_stream(&inner, request).await + }; Box::pin(fut) } } @@ -3081,8 +4266,14 @@ pub mod node_service_server { let method = WriteStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3091,13 +4282,26 @@ pub mod node_service_server { "/node_service.NodeService/ReadAt" => { #[allow(non_camel_case_types)] struct ReadAtSvc(pub Arc); - impl tonic::server::StreamingService for ReadAtSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for ReadAtSvc { type Response = super::ReadAtResponse; type ResponseStream = T::ReadAtStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_at(&inner, request).await }; + let fut = async move { + ::read_at(&inner, request).await + }; Box::pin(fut) } } @@ -3110,8 +4314,14 @@ pub mod node_service_server { let method = ReadAtSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3120,12 +4330,23 @@ pub mod node_service_server { "/node_service.NodeService/ListDir" => { #[allow(non_camel_case_types)] struct ListDirSvc(pub Arc); - impl tonic::server::UnaryService for ListDirSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListDirSvc { type Response = super::ListDirResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_dir(&inner, request).await }; + let fut = async move { + ::list_dir(&inner, request).await + }; Box::pin(fut) } } @@ -3138,8 +4359,14 @@ pub mod node_service_server { let method = ListDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3148,12 +4375,23 @@ pub mod node_service_server { "/node_service.NodeService/WalkDir" => { #[allow(non_camel_case_types)] struct WalkDirSvc(pub Arc); - impl tonic::server::UnaryService for WalkDirSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WalkDirSvc { type Response = super::WalkDirResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::walk_dir(&inner, request).await }; + let fut = async move { + ::walk_dir(&inner, request).await + }; Box::pin(fut) } } @@ -3166,8 +4404,14 @@ pub mod node_service_server { let method = WalkDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3176,12 +4420,23 @@ pub mod node_service_server { "/node_service.NodeService/RenameData" => { #[allow(non_camel_case_types)] struct RenameDataSvc(pub Arc); - impl tonic::server::UnaryService for RenameDataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenameDataSvc { type Response = super::RenameDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_data(&inner, request).await }; + let fut = async move { + ::rename_data(&inner, request).await + }; Box::pin(fut) } } @@ -3194,8 +4449,14 @@ pub mod node_service_server { let method = RenameDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3204,12 +4465,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolumes" => { #[allow(non_camel_case_types)] struct MakeVolumesSvc(pub Arc); - impl tonic::server::UnaryService for MakeVolumesSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeVolumesSvc { type Response = super::MakeVolumesResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_volumes(&inner, request).await }; + let fut = async move { + ::make_volumes(&inner, request).await + }; Box::pin(fut) } } @@ -3222,8 +4494,14 @@ pub mod node_service_server { let method = MakeVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3232,12 +4510,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolume" => { #[allow(non_camel_case_types)] struct MakeVolumeSvc(pub Arc); - impl tonic::server::UnaryService for MakeVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeVolumeSvc { type Response = super::MakeVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_volume(&inner, request).await }; + let fut = async move { + ::make_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3250,8 +4539,14 @@ pub mod node_service_server { let method = MakeVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3260,12 +4555,23 @@ pub mod node_service_server { "/node_service.NodeService/ListVolumes" => { #[allow(non_camel_case_types)] struct ListVolumesSvc(pub Arc); - impl tonic::server::UnaryService for ListVolumesSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListVolumesSvc { type Response = super::ListVolumesResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_volumes(&inner, request).await }; + let fut = async move { + ::list_volumes(&inner, request).await + }; Box::pin(fut) } } @@ -3278,8 +4584,14 @@ pub mod node_service_server { let method = ListVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3288,12 +4600,23 @@ pub mod node_service_server { "/node_service.NodeService/StatVolume" => { #[allow(non_camel_case_types)] struct StatVolumeSvc(pub Arc); - impl tonic::server::UnaryService for StatVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StatVolumeSvc { type Response = super::StatVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::stat_volume(&inner, request).await }; + let fut = async move { + ::stat_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3306,8 +4629,14 @@ pub mod node_service_server { let method = StatVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3316,12 +4645,23 @@ pub mod node_service_server { "/node_service.NodeService/DeletePaths" => { #[allow(non_camel_case_types)] struct DeletePathsSvc(pub Arc); - impl tonic::server::UnaryService for DeletePathsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeletePathsSvc { type Response = super::DeletePathsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_paths(&inner, request).await }; + let fut = async move { + ::delete_paths(&inner, request).await + }; Box::pin(fut) } } @@ -3334,8 +4674,14 @@ pub mod node_service_server { let method = DeletePathsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3344,12 +4690,23 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetadata" => { #[allow(non_camel_case_types)] struct UpdateMetadataSvc(pub Arc); - impl tonic::server::UnaryService for UpdateMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UpdateMetadataSvc { type Response = super::UpdateMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::update_metadata(&inner, request).await }; + let fut = async move { + ::update_metadata(&inner, request).await + }; Box::pin(fut) } } @@ -3362,8 +4719,14 @@ pub mod node_service_server { let method = UpdateMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3372,12 +4735,23 @@ pub mod node_service_server { "/node_service.NodeService/WriteMetadata" => { #[allow(non_camel_case_types)] struct WriteMetadataSvc(pub Arc); - impl tonic::server::UnaryService for WriteMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WriteMetadataSvc { type Response = super::WriteMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_metadata(&inner, request).await }; + let fut = async move { + ::write_metadata(&inner, request).await + }; Box::pin(fut) } } @@ -3390,8 +4764,14 @@ pub mod node_service_server { let method = WriteMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3400,12 +4780,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadVersion" => { #[allow(non_camel_case_types)] struct ReadVersionSvc(pub Arc); - impl tonic::server::UnaryService for ReadVersionSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadVersionSvc { type Response = super::ReadVersionResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_version(&inner, request).await }; + let fut = async move { + ::read_version(&inner, request).await + }; Box::pin(fut) } } @@ -3418,8 +4809,14 @@ pub mod node_service_server { let method = ReadVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3428,12 +4825,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadXL" => { #[allow(non_camel_case_types)] struct ReadXLSvc(pub Arc); - impl tonic::server::UnaryService for ReadXLSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadXLSvc { type Response = super::ReadXlResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_xl(&inner, request).await }; + let fut = async move { + ::read_xl(&inner, request).await + }; Box::pin(fut) } } @@ -3446,8 +4854,14 @@ pub mod node_service_server { let method = ReadXLSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3456,12 +4870,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersion" => { #[allow(non_camel_case_types)] struct DeleteVersionSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVersionSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVersionSvc { type Response = super::DeleteVersionResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_version(&inner, request).await }; + let fut = async move { + ::delete_version(&inner, request).await + }; Box::pin(fut) } } @@ -3474,8 +4899,14 @@ pub mod node_service_server { let method = DeleteVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3484,12 +4915,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersions" => { #[allow(non_camel_case_types)] struct DeleteVersionsSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVersionsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVersionsSvc { type Response = super::DeleteVersionsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_versions(&inner, request).await }; + let fut = async move { + ::delete_versions(&inner, request).await + }; Box::pin(fut) } } @@ -3502,8 +4944,14 @@ pub mod node_service_server { let method = DeleteVersionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3512,12 +4960,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadMultiple" => { #[allow(non_camel_case_types)] struct ReadMultipleSvc(pub Arc); - impl tonic::server::UnaryService for ReadMultipleSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadMultipleSvc { type Response = super::ReadMultipleResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_multiple(&inner, request).await }; + let fut = async move { + ::read_multiple(&inner, request).await + }; Box::pin(fut) } } @@ -3530,8 +4989,14 @@ pub mod node_service_server { let method = ReadMultipleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3540,12 +5005,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVolume" => { #[allow(non_camel_case_types)] struct DeleteVolumeSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVolumeSvc { type Response = super::DeleteVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_volume(&inner, request).await }; + let fut = async move { + ::delete_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3558,8 +5034,14 @@ pub mod node_service_server { let method = DeleteVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3568,12 +5050,23 @@ pub mod node_service_server { "/node_service.NodeService/DiskInfo" => { #[allow(non_camel_case_types)] struct DiskInfoSvc(pub Arc); - impl tonic::server::UnaryService for DiskInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DiskInfoSvc { type Response = super::DiskInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::disk_info(&inner, request).await }; + let fut = async move { + ::disk_info(&inner, request).await + }; Box::pin(fut) } } @@ -3586,8 +5079,14 @@ pub mod node_service_server { let method = DiskInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3596,13 +5095,26 @@ pub mod node_service_server { "/node_service.NodeService/NsScanner" => { #[allow(non_camel_case_types)] struct NsScannerSvc(pub Arc); - impl tonic::server::StreamingService for NsScannerSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for NsScannerSvc { type Response = super::NsScannerResponse; type ResponseStream = T::NsScannerStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::ns_scanner(&inner, request).await }; + let fut = async move { + ::ns_scanner(&inner, request).await + }; Box::pin(fut) } } @@ -3615,8 +5127,14 @@ pub mod node_service_server { let method = NsScannerSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3625,12 +5143,23 @@ pub mod node_service_server { "/node_service.NodeService/Lock" => { #[allow(non_camel_case_types)] struct LockSvc(pub Arc); - impl tonic::server::UnaryService for LockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::lock(&inner, request).await }; + let fut = async move { + ::lock(&inner, request).await + }; Box::pin(fut) } } @@ -3643,8 +5172,14 @@ pub mod node_service_server { let method = LockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3653,12 +5188,23 @@ pub mod node_service_server { "/node_service.NodeService/UnLock" => { #[allow(non_camel_case_types)] struct UnLockSvc(pub Arc); - impl tonic::server::UnaryService for UnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::un_lock(&inner, request).await }; + let fut = async move { + ::un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3671,8 +5217,14 @@ pub mod node_service_server { let method = UnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3681,12 +5233,23 @@ pub mod node_service_server { "/node_service.NodeService/RLock" => { #[allow(non_camel_case_types)] struct RLockSvc(pub Arc); - impl tonic::server::UnaryService for RLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::r_lock(&inner, request).await }; + let fut = async move { + ::r_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3699,8 +5262,14 @@ pub mod node_service_server { let method = RLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3709,12 +5278,23 @@ pub mod node_service_server { "/node_service.NodeService/RUnLock" => { #[allow(non_camel_case_types)] struct RUnLockSvc(pub Arc); - impl tonic::server::UnaryService for RUnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::r_un_lock(&inner, request).await }; + let fut = async move { + ::r_un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3727,8 +5307,14 @@ pub mod node_service_server { let method = RUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3737,12 +5323,23 @@ pub mod node_service_server { "/node_service.NodeService/ForceUnLock" => { #[allow(non_camel_case_types)] struct ForceUnLockSvc(pub Arc); - impl tonic::server::UnaryService for ForceUnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ForceUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::force_un_lock(&inner, request).await }; + let fut = async move { + ::force_un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3755,8 +5352,14 @@ pub mod node_service_server { let method = ForceUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3765,12 +5368,23 @@ pub mod node_service_server { "/node_service.NodeService/Refresh" => { #[allow(non_camel_case_types)] struct RefreshSvc(pub Arc); - impl tonic::server::UnaryService for RefreshSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RefreshSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::refresh(&inner, request).await }; + let fut = async move { + ::refresh(&inner, request).await + }; Box::pin(fut) } } @@ -3783,8 +5397,14 @@ pub mod node_service_server { let method = RefreshSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3793,12 +5413,24 @@ pub mod node_service_server { "/node_service.NodeService/LocalStorageInfo" => { #[allow(non_camel_case_types)] struct LocalStorageInfoSvc(pub Arc); - impl tonic::server::UnaryService for LocalStorageInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LocalStorageInfoSvc { type Response = super::LocalStorageInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::local_storage_info(&inner, request).await }; + let fut = async move { + ::local_storage_info(&inner, request) + .await + }; Box::pin(fut) } } @@ -3811,8 +5443,14 @@ pub mod node_service_server { let method = LocalStorageInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3821,12 +5459,23 @@ pub mod node_service_server { "/node_service.NodeService/ServerInfo" => { #[allow(non_camel_case_types)] struct ServerInfoSvc(pub Arc); - impl tonic::server::UnaryService for ServerInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ServerInfoSvc { type Response = super::ServerInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::server_info(&inner, request).await }; + let fut = async move { + ::server_info(&inner, request).await + }; Box::pin(fut) } } @@ -3839,8 +5488,14 @@ pub mod node_service_server { let method = ServerInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3849,12 +5504,23 @@ pub mod node_service_server { "/node_service.NodeService/GetCpus" => { #[allow(non_camel_case_types)] struct GetCpusSvc(pub Arc); - impl tonic::server::UnaryService for GetCpusSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetCpusSvc { type Response = super::GetCpusResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_cpus(&inner, request).await }; + let fut = async move { + ::get_cpus(&inner, request).await + }; Box::pin(fut) } } @@ -3867,8 +5533,14 @@ pub mod node_service_server { let method = GetCpusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3877,12 +5549,23 @@ pub mod node_service_server { "/node_service.NodeService/GetNetInfo" => { #[allow(non_camel_case_types)] struct GetNetInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetNetInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetNetInfoSvc { type Response = super::GetNetInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_net_info(&inner, request).await }; + let fut = async move { + ::get_net_info(&inner, request).await + }; Box::pin(fut) } } @@ -3895,8 +5578,14 @@ pub mod node_service_server { let method = GetNetInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3905,12 +5594,23 @@ pub mod node_service_server { "/node_service.NodeService/GetPartitions" => { #[allow(non_camel_case_types)] struct GetPartitionsSvc(pub Arc); - impl tonic::server::UnaryService for GetPartitionsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetPartitionsSvc { type Response = super::GetPartitionsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_partitions(&inner, request).await }; + let fut = async move { + ::get_partitions(&inner, request).await + }; Box::pin(fut) } } @@ -3923,8 +5623,14 @@ pub mod node_service_server { let method = GetPartitionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3933,12 +5639,23 @@ pub mod node_service_server { "/node_service.NodeService/GetOsInfo" => { #[allow(non_camel_case_types)] struct GetOsInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetOsInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetOsInfoSvc { type Response = super::GetOsInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_os_info(&inner, request).await }; + let fut = async move { + ::get_os_info(&inner, request).await + }; Box::pin(fut) } } @@ -3951,8 +5668,14 @@ pub mod node_service_server { let method = GetOsInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3961,12 +5684,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSELinuxInfo" => { #[allow(non_camel_case_types)] struct GetSELinuxInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetSELinuxInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSELinuxInfoSvc { type Response = super::GetSeLinuxInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_se_linux_info(&inner, request).await }; + let fut = async move { + ::get_se_linux_info(&inner, request).await + }; Box::pin(fut) } } @@ -3979,8 +5713,14 @@ pub mod node_service_server { let method = GetSELinuxInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3989,12 +5729,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSysConfig" => { #[allow(non_camel_case_types)] struct GetSysConfigSvc(pub Arc); - impl tonic::server::UnaryService for GetSysConfigSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSysConfigSvc { type Response = super::GetSysConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sys_config(&inner, request).await }; + let fut = async move { + ::get_sys_config(&inner, request).await + }; Box::pin(fut) } } @@ -4007,8 +5758,14 @@ pub mod node_service_server { let method = GetSysConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4017,12 +5774,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSysErrors" => { #[allow(non_camel_case_types)] struct GetSysErrorsSvc(pub Arc); - impl tonic::server::UnaryService for GetSysErrorsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSysErrorsSvc { type Response = super::GetSysErrorsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sys_errors(&inner, request).await }; + let fut = async move { + ::get_sys_errors(&inner, request).await + }; Box::pin(fut) } } @@ -4035,8 +5803,14 @@ pub mod node_service_server { let method = GetSysErrorsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4045,12 +5819,23 @@ pub mod node_service_server { "/node_service.NodeService/GetMemInfo" => { #[allow(non_camel_case_types)] struct GetMemInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetMemInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMemInfoSvc { type Response = super::GetMemInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_mem_info(&inner, request).await }; + let fut = async move { + ::get_mem_info(&inner, request).await + }; Box::pin(fut) } } @@ -4063,8 +5848,14 @@ pub mod node_service_server { let method = GetMemInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4073,12 +5864,23 @@ pub mod node_service_server { "/node_service.NodeService/GetMetrics" => { #[allow(non_camel_case_types)] struct GetMetricsSvc(pub Arc); - impl tonic::server::UnaryService for GetMetricsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMetricsSvc { type Response = super::GetMetricsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_metrics(&inner, request).await }; + let fut = async move { + ::get_metrics(&inner, request).await + }; Box::pin(fut) } } @@ -4091,8 +5893,14 @@ pub mod node_service_server { let method = GetMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4101,12 +5909,23 @@ pub mod node_service_server { "/node_service.NodeService/GetProcInfo" => { #[allow(non_camel_case_types)] struct GetProcInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetProcInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetProcInfoSvc { type Response = super::GetProcInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_proc_info(&inner, request).await }; + let fut = async move { + ::get_proc_info(&inner, request).await + }; Box::pin(fut) } } @@ -4119,8 +5938,14 @@ pub mod node_service_server { let method = GetProcInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4129,12 +5954,23 @@ pub mod node_service_server { "/node_service.NodeService/StartProfiling" => { #[allow(non_camel_case_types)] struct StartProfilingSvc(pub Arc); - impl tonic::server::UnaryService for StartProfilingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StartProfilingSvc { type Response = super::StartProfilingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::start_profiling(&inner, request).await }; + let fut = async move { + ::start_profiling(&inner, request).await + }; Box::pin(fut) } } @@ -4147,8 +5983,14 @@ pub mod node_service_server { let method = StartProfilingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4157,12 +5999,24 @@ pub mod node_service_server { "/node_service.NodeService/DownloadProfileData" => { #[allow(non_camel_case_types)] struct DownloadProfileDataSvc(pub Arc); - impl tonic::server::UnaryService for DownloadProfileDataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DownloadProfileDataSvc { type Response = super::DownloadProfileDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::download_profile_data(&inner, request).await }; + let fut = async move { + ::download_profile_data(&inner, request) + .await + }; Box::pin(fut) } } @@ -4175,8 +6029,14 @@ pub mod node_service_server { let method = DownloadProfileDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4185,12 +6045,23 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketStats" => { #[allow(non_camel_case_types)] struct GetBucketStatsSvc(pub Arc); - impl tonic::server::UnaryService for GetBucketStatsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetBucketStatsSvc { type Response = super::GetBucketStatsDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_bucket_stats(&inner, request).await }; + let fut = async move { + ::get_bucket_stats(&inner, request).await + }; Box::pin(fut) } } @@ -4203,8 +6074,14 @@ pub mod node_service_server { let method = GetBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4213,12 +6090,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSRMetrics" => { #[allow(non_camel_case_types)] struct GetSRMetricsSvc(pub Arc); - impl tonic::server::UnaryService for GetSRMetricsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSRMetricsSvc { type Response = super::GetSrMetricsDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sr_metrics(&inner, request).await }; + let fut = async move { + ::get_sr_metrics(&inner, request).await + }; Box::pin(fut) } } @@ -4231,8 +6119,14 @@ pub mod node_service_server { let method = GetSRMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4241,12 +6135,24 @@ pub mod node_service_server { "/node_service.NodeService/GetAllBucketStats" => { #[allow(non_camel_case_types)] struct GetAllBucketStatsSvc(pub Arc); - impl tonic::server::UnaryService for GetAllBucketStatsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetAllBucketStatsSvc { type Response = super::GetAllBucketStatsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_all_bucket_stats(&inner, request).await }; + let fut = async move { + ::get_all_bucket_stats(&inner, request) + .await + }; Box::pin(fut) } } @@ -4259,8 +6165,14 @@ pub mod node_service_server { let method = GetAllBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4269,12 +6181,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadBucketMetadata" => { #[allow(non_camel_case_types)] struct LoadBucketMetadataSvc(pub Arc); - impl tonic::server::UnaryService for LoadBucketMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadBucketMetadataSvc { type Response = super::LoadBucketMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_bucket_metadata(&inner, request).await }; + let fut = async move { + ::load_bucket_metadata(&inner, request) + .await + }; Box::pin(fut) } } @@ -4287,8 +6211,14 @@ pub mod node_service_server { let method = LoadBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4297,12 +6227,24 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucketMetadata" => { #[allow(non_camel_case_types)] struct DeleteBucketMetadataSvc(pub Arc); - impl tonic::server::UnaryService for DeleteBucketMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteBucketMetadataSvc { type Response = super::DeleteBucketMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_bucket_metadata(&inner, request).await }; + let fut = async move { + ::delete_bucket_metadata(&inner, request) + .await + }; Box::pin(fut) } } @@ -4315,8 +6257,14 @@ pub mod node_service_server { let method = DeleteBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4325,12 +6273,23 @@ pub mod node_service_server { "/node_service.NodeService/DeletePolicy" => { #[allow(non_camel_case_types)] struct DeletePolicySvc(pub Arc); - impl tonic::server::UnaryService for DeletePolicySvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeletePolicySvc { type Response = super::DeletePolicyResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_policy(&inner, request).await }; + let fut = async move { + ::delete_policy(&inner, request).await + }; Box::pin(fut) } } @@ -4343,8 +6302,14 @@ pub mod node_service_server { let method = DeletePolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4353,12 +6318,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicy" => { #[allow(non_camel_case_types)] struct LoadPolicySvc(pub Arc); - impl tonic::server::UnaryService for LoadPolicySvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadPolicySvc { type Response = super::LoadPolicyResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_policy(&inner, request).await }; + let fut = async move { + ::load_policy(&inner, request).await + }; Box::pin(fut) } } @@ -4371,8 +6347,14 @@ pub mod node_service_server { let method = LoadPolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4381,12 +6363,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicyMapping" => { #[allow(non_camel_case_types)] struct LoadPolicyMappingSvc(pub Arc); - impl tonic::server::UnaryService for LoadPolicyMappingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadPolicyMappingSvc { type Response = super::LoadPolicyMappingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_policy_mapping(&inner, request).await }; + let fut = async move { + ::load_policy_mapping(&inner, request) + .await + }; Box::pin(fut) } } @@ -4399,8 +6393,14 @@ pub mod node_service_server { let method = LoadPolicyMappingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4409,12 +6409,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteUser" => { #[allow(non_camel_case_types)] struct DeleteUserSvc(pub Arc); - impl tonic::server::UnaryService for DeleteUserSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteUserSvc { type Response = super::DeleteUserResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_user(&inner, request).await }; + let fut = async move { + ::delete_user(&inner, request).await + }; Box::pin(fut) } } @@ -4427,8 +6438,14 @@ pub mod node_service_server { let method = DeleteUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4437,12 +6454,24 @@ pub mod node_service_server { "/node_service.NodeService/DeleteServiceAccount" => { #[allow(non_camel_case_types)] struct DeleteServiceAccountSvc(pub Arc); - impl tonic::server::UnaryService for DeleteServiceAccountSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteServiceAccountSvc { type Response = super::DeleteServiceAccountResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_service_account(&inner, request).await }; + let fut = async move { + ::delete_service_account(&inner, request) + .await + }; Box::pin(fut) } } @@ -4455,8 +6484,14 @@ pub mod node_service_server { let method = DeleteServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4465,12 +6500,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadUser" => { #[allow(non_camel_case_types)] struct LoadUserSvc(pub Arc); - impl tonic::server::UnaryService for LoadUserSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadUserSvc { type Response = super::LoadUserResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_user(&inner, request).await }; + let fut = async move { + ::load_user(&inner, request).await + }; Box::pin(fut) } } @@ -4483,8 +6529,14 @@ pub mod node_service_server { let method = LoadUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4493,12 +6545,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadServiceAccount" => { #[allow(non_camel_case_types)] struct LoadServiceAccountSvc(pub Arc); - impl tonic::server::UnaryService for LoadServiceAccountSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadServiceAccountSvc { type Response = super::LoadServiceAccountResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_service_account(&inner, request).await }; + let fut = async move { + ::load_service_account(&inner, request) + .await + }; Box::pin(fut) } } @@ -4511,8 +6575,14 @@ pub mod node_service_server { let method = LoadServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4521,12 +6591,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadGroup" => { #[allow(non_camel_case_types)] struct LoadGroupSvc(pub Arc); - impl tonic::server::UnaryService for LoadGroupSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadGroupSvc { type Response = super::LoadGroupResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_group(&inner, request).await }; + let fut = async move { + ::load_group(&inner, request).await + }; Box::pin(fut) } } @@ -4539,8 +6620,14 @@ pub mod node_service_server { let method = LoadGroupSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4549,14 +6636,30 @@ pub mod node_service_server { "/node_service.NodeService/ReloadSiteReplicationConfig" => { #[allow(non_camel_case_types)] struct ReloadSiteReplicationConfigSvc(pub Arc); - impl tonic::server::UnaryService - for ReloadSiteReplicationConfigSvc - { + impl< + T: NodeService, + > tonic::server::UnaryService< + super::ReloadSiteReplicationConfigRequest, + > for ReloadSiteReplicationConfigSvc { type Response = super::ReloadSiteReplicationConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::ReloadSiteReplicationConfigRequest, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::reload_site_replication_config(&inner, request).await }; + let fut = async move { + ::reload_site_replication_config( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4569,8 +6672,14 @@ pub mod node_service_server { let method = ReloadSiteReplicationConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4579,12 +6688,23 @@ pub mod node_service_server { "/node_service.NodeService/SignalService" => { #[allow(non_camel_case_types)] struct SignalServiceSvc(pub Arc); - impl tonic::server::UnaryService for SignalServiceSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for SignalServiceSvc { type Response = super::SignalServiceResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::signal_service(&inner, request).await }; + let fut = async move { + ::signal_service(&inner, request).await + }; Box::pin(fut) } } @@ -4597,8 +6717,14 @@ pub mod node_service_server { let method = SignalServiceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4607,12 +6733,24 @@ pub mod node_service_server { "/node_service.NodeService/BackgroundHealStatus" => { #[allow(non_camel_case_types)] struct BackgroundHealStatusSvc(pub Arc); - impl tonic::server::UnaryService for BackgroundHealStatusSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for BackgroundHealStatusSvc { type Response = super::BackgroundHealStatusResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::background_heal_status(&inner, request).await }; + let fut = async move { + ::background_heal_status(&inner, request) + .await + }; Box::pin(fut) } } @@ -4625,8 +6763,14 @@ pub mod node_service_server { let method = BackgroundHealStatusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4635,12 +6779,24 @@ pub mod node_service_server { "/node_service.NodeService/GetMetacacheListing" => { #[allow(non_camel_case_types)] struct GetMetacacheListingSvc(pub Arc); - impl tonic::server::UnaryService for GetMetacacheListingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMetacacheListingSvc { type Response = super::GetMetacacheListingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_metacache_listing(&inner, request).await }; + let fut = async move { + ::get_metacache_listing(&inner, request) + .await + }; Box::pin(fut) } } @@ -4653,8 +6809,14 @@ pub mod node_service_server { let method = GetMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4663,12 +6825,27 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetacacheListing" => { #[allow(non_camel_case_types)] struct UpdateMetacacheListingSvc(pub Arc); - impl tonic::server::UnaryService for UpdateMetacacheListingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UpdateMetacacheListingSvc { type Response = super::UpdateMetacacheListingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::update_metacache_listing(&inner, request).await }; + let fut = async move { + ::update_metacache_listing( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4681,8 +6858,14 @@ pub mod node_service_server { let method = UpdateMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4691,12 +6874,23 @@ pub mod node_service_server { "/node_service.NodeService/ReloadPoolMeta" => { #[allow(non_camel_case_types)] struct ReloadPoolMetaSvc(pub Arc); - impl tonic::server::UnaryService for ReloadPoolMetaSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReloadPoolMetaSvc { type Response = super::ReloadPoolMetaResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::reload_pool_meta(&inner, request).await }; + let fut = async move { + ::reload_pool_meta(&inner, request).await + }; Box::pin(fut) } } @@ -4709,8 +6903,14 @@ pub mod node_service_server { let method = ReloadPoolMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4719,12 +6919,23 @@ pub mod node_service_server { "/node_service.NodeService/StopRebalance" => { #[allow(non_camel_case_types)] struct StopRebalanceSvc(pub Arc); - impl tonic::server::UnaryService for StopRebalanceSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StopRebalanceSvc { type Response = super::StopRebalanceResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::stop_rebalance(&inner, request).await }; + let fut = async move { + ::stop_rebalance(&inner, request).await + }; Box::pin(fut) } } @@ -4737,8 +6948,14 @@ pub mod node_service_server { let method = StopRebalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4747,12 +6964,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadRebalanceMeta" => { #[allow(non_camel_case_types)] struct LoadRebalanceMetaSvc(pub Arc); - impl tonic::server::UnaryService for LoadRebalanceMetaSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadRebalanceMetaSvc { type Response = super::LoadRebalanceMetaResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_rebalance_meta(&inner, request).await }; + let fut = async move { + ::load_rebalance_meta(&inner, request) + .await + }; Box::pin(fut) } } @@ -4765,8 +6994,14 @@ pub mod node_service_server { let method = LoadRebalanceMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4775,12 +7010,29 @@ pub mod node_service_server { "/node_service.NodeService/LoadTransitionTierConfig" => { #[allow(non_camel_case_types)] struct LoadTransitionTierConfigSvc(pub Arc); - impl tonic::server::UnaryService for LoadTransitionTierConfigSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadTransitionTierConfigSvc { type Response = super::LoadTransitionTierConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::LoadTransitionTierConfigRequest, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_transition_tier_config(&inner, request).await }; + let fut = async move { + ::load_transition_tier_config( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4793,20 +7045,36 @@ pub mod node_service_server { let method = LoadTransitionTierConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } - _ => Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers.insert(tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into()); - headers.insert(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE); - Ok(response) - }), + _ => { + Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } } } } diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index e7387504a..5fec3bc29 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -1059,13 +1059,7 @@ pub struct RemoteFileWriter { } impl RemoteFileWriter { - pub async fn new( - endpoint: Endpoint, - volume: String, - path: String, - is_append: bool, - mut client: NodeClient, - ) -> Result { + pub async fn new(endpoint: Endpoint, volume: String, path: String, is_append: bool, mut client: NodeClient) -> Result { let (tx, rx) = mpsc::channel(128); let in_stream = ReceiverStream::new(rx); @@ -1255,12 +1249,7 @@ pub struct RemoteFileReader { } impl RemoteFileReader { - pub async fn new( - endpoint: Endpoint, - volume: String, - path: String, - mut client: NodeClient, - ) -> Result { + pub async fn new(endpoint: Endpoint, volume: String, path: String, mut client: NodeClient) -> Result { let (tx, rx) = mpsc::channel(128); let in_stream = ReceiverStream::new(rx); diff --git a/ecstore/src/heal/heal_ops.rs b/ecstore/src/heal/heal_ops.rs index ed774ecbe..b7b694b41 100644 --- a/ecstore/src/heal/heal_ops.rs +++ b/ecstore/src/heal/heal_ops.rs @@ -2,7 +2,7 @@ use super::{ background_heal_ops::HealTask, data_scanner::HEAL_DELETE_DANGLING, error::ERR_SKIP_FILE, - heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingDisk, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, + heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, }; use crate::store_api::StorageAPI; use crate::{ diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index aaf6d4d12..063db66b9 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -32,7 +32,7 @@ pub struct NotificationSys { impl NotificationSys { pub async fn new(eps: EndpointServerPools) -> Self { - let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(&eps).await; + let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(eps).await; Self { peer_clients, all_peer_clients, diff --git a/madmin/Cargo.toml b/madmin/Cargo.toml index 06c1a835d..5a32ec152 100644 --- a/madmin/Cargo.toml +++ b/madmin/Cargo.toml @@ -17,4 +17,4 @@ hyper.workspace = true psutil = "3.3.0" serde.workspace = true time.workspace =true -tracing.workspace = truetime.workspace =true +tracing.workspace = true diff --git a/rustfs/src/admin/handlers/trace.rs b/rustfs/src/admin/handlers/trace.rs index cf3c1710a..0134c4fd6 100644 --- a/rustfs/src/admin/handlers/trace.rs +++ b/rustfs/src/admin/handlers/trace.rs @@ -4,7 +4,6 @@ use hyper::Uri; use madmin::service_commands::ServiceTraceOpts; use matchit::Params; use s3s::{s3_error, Body, S3Request, S3Response, S3Result}; -use tokio::sync::mpsc; use tracing::warn; use crate::admin::router::Operation; @@ -25,11 +24,11 @@ impl Operation for Trace { async fn call(&self, req: S3Request, _params: Params<'_, '_>) -> S3Result> { warn!("handle Trace"); - let trace_opts = extract_trace_options(&req.uri)?; + let _trace_opts = extract_trace_options(&req.uri)?; // let (tx, rx) = mpsc::channel(10000); - let perrs = match GLOBAL_Endpoints.get() { - Some(ep) => PeerRestClient::new_clients(ep).await, + let _perrs = match GLOBAL_Endpoints.get() { + Some(ep) => PeerRestClient::new_clients(ep.clone()).await, None => (Vec::new(), Vec::new()), }; return Err(s3_error!(NotImplemented)); From 76c0de5f382db01d2039b822b578c5866359c846 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:01:14 +0800 Subject: [PATCH 24/77] Update mint.yml --- .github/workflows/mint.yml | 79 ++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 93136570b..49cecbb62 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -15,52 +15,49 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 30 steps: - - name: install protoc - run: | - wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip - unzip protoc-27.0-linux-x86_64.zip -d protoc3 - mv protoc3/bin/* /usr/local/bin/ - chmod +x /usr/local/bin/protoc - rm -rf protoc-27.0-linux-x86_64.zip protoc3 + - name: get hostip + run: ifconfig + # - name: install protoc + # run: | + # wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip + # unzip protoc-27.0-linux-x86_64.zip -d protoc3 + # mv protoc3/bin/* /usr/local/bin/ + # chmod +x /usr/local/bin/protoc + # rm -rf protoc-27.0-linux-x86_64.zip protoc3 - - name: install flatc - run: | - wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip - unzip Linux.flatc.binary.g++-13.zip - mv flatc /usr/local/bin/ - chmod +x /usr/local/bin/flatc - rm -rf Linux.flatc.binary.g++-13.zip + # - name: install flatc + # run: | + # wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip + # unzip Linux.flatc.binary.g++-13.zip + # mv flatc /usr/local/bin/ + # chmod +x /usr/local/bin/flatc + # rm -rf Linux.flatc.binary.g++-13.zip - - name: checkout source code - uses: actions/checkout@v4 + # - name: checkout source code + # uses: actions/checkout@v4 - - name: rust-toolchain - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable + # - name: rust-toolchain + # uses: actions-rs/toolchain@v1.0.6 + # with: + # toolchain: stable - - name: cache rust dependencies - uses: Swatinem/rust-cache@v2 + # - name: cache rust dependencies + # uses: Swatinem/rust-cache@v2 - - name: cargo build & release - run: cargo build --release + # - name: cargo build & release + # run: cargo build --release - - name: run this rustfs server - run: | - mkdir -p data/rustfs - nohup ./target/release/rustfs \ - --address 0.0.0.0:9000 \ - --access-key rustfsadmin \ - --secret-key rustfsadmin \ - --domain-name localhost:9000 \ - data/rustfs & + # - name: run this rustfs server + # run: | + # sudo mkdir -p /data/rustfs + # sudo nohup ./target/release/rustfs /data/rustfs & - - name: run mint test task - run: | - ps aux | grep rustfs - docker run -e SERVER_ENDPOINT=localhost:9000 \ - -e ACCESS_KEY=rustfsadmin \ - -e SECRET_KEY=rustfsadmin \ - -e ENABLE_HTTPS=0 \ - minio/mint + # - name: run mint test task + # run: | + # ps aux | grep rustfs + # docker run -e SERVER_ENDPOINT=localhost:9000 \ + # -e ACCESS_KEY=rustfsadmin \ + # -e SECRET_KEY=rustfsadmin \ + # -e ENABLE_HTTPS=0 \ + # minio/mint From f32e5edcefe02251555fc9e30b557633fdab22f2 Mon Sep 17 00:00:00 2001 From: mirschao <119988085+mirschao@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:03:48 +0800 Subject: [PATCH 25/77] Update mint.yml --- .github/workflows/mint.yml | 75 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index 49cecbb62..75e45666a 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -15,49 +15,48 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 30 steps: - - name: get hostip - run: ifconfig - # - name: install protoc - # run: | - # wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip - # unzip protoc-27.0-linux-x86_64.zip -d protoc3 - # mv protoc3/bin/* /usr/local/bin/ - # chmod +x /usr/local/bin/protoc - # rm -rf protoc-27.0-linux-x86_64.zip protoc3 + - name: install protoc + run: | + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip + unzip protoc-27.0-linux-x86_64.zip -d protoc3 + mv protoc3/bin/* /usr/local/bin/ + chmod +x /usr/local/bin/protoc + rm -rf protoc-27.0-linux-x86_64.zip protoc3 - # - name: install flatc - # run: | - # wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip - # unzip Linux.flatc.binary.g++-13.zip - # mv flatc /usr/local/bin/ - # chmod +x /usr/local/bin/flatc - # rm -rf Linux.flatc.binary.g++-13.zip + - name: install flatc + run: | + wget https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.g++-13.zip + unzip Linux.flatc.binary.g++-13.zip + mv flatc /usr/local/bin/ + chmod +x /usr/local/bin/flatc + rm -rf Linux.flatc.binary.g++-13.zip - # - name: checkout source code - # uses: actions/checkout@v4 + - name: checkout source code + uses: actions/checkout@v4 - # - name: rust-toolchain - # uses: actions-rs/toolchain@v1.0.6 - # with: - # toolchain: stable + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: stable - # - name: cache rust dependencies - # uses: Swatinem/rust-cache@v2 + - name: cache rust dependencies + uses: Swatinem/rust-cache@v2 - # - name: cargo build & release - # run: cargo build --release + - name: cargo build & release + run: cargo build --release - # - name: run this rustfs server - # run: | - # sudo mkdir -p /data/rustfs - # sudo nohup ./target/release/rustfs /data/rustfs & + - name: run this rustfs server + run: | + sudo mkdir -p /data/rustfs + sudo nohup ./target/release/rustfs /data/rustfs & - # - name: run mint test task - # run: | - # ps aux | grep rustfs - # docker run -e SERVER_ENDPOINT=localhost:9000 \ - # -e ACCESS_KEY=rustfsadmin \ - # -e SECRET_KEY=rustfsadmin \ - # -e ENABLE_HTTPS=0 \ - # minio/mint + - name: run mint test task + run: | + ps aux | grep rustfs + SERVER_ADDRESS=$(ifconfig eth0 | awk 'NR==2 { print $2 }') + docker run -e SERVER_ENDPOINT=${SERVER_ADDRESS}:9000 \ + -e ACCESS_KEY=rustfsadmin \ + -e SECRET_KEY=rustfsadmin \ + -e ENABLE_HTTPS=0 \ + minio/mint From 637d6146180ca14f9b5e1be1110d7f025f88a4d6 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 9 Dec 2024 17:43:18 +0800 Subject: [PATCH 26/77] fix find_local_disk --- ecstore/src/store.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 86dda946e..102cf8f48 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -930,20 +930,13 @@ async fn update_scan( } pub async fn find_local_disk(disk_path: &String) -> Option { - let disk_path = match fs::canonicalize(disk_path).await { - Ok(disk_path) => disk_path, - Err(_) => return None, - }; - let disk_map = GLOBAL_LOCAL_DISK_MAP.read().await; - let path = disk_path.to_string_lossy().to_string(); - if disk_map.contains_key(&path) { - let a = disk_map[&path].as_ref().cloned(); - - return a; + if let Some(disk) = disk_map.get(disk_path) { + disk.as_ref().cloned() + } else { + None } - None } pub async fn get_disk_via_endpoint(endpoint: &Endpoint) -> Option { From 8172c4f06a14e30a601de51e43049c4e1114e35c Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 10 Dec 2024 16:59:27 +0800 Subject: [PATCH 27/77] AssumeRoleHandle done --- Cargo.lock | 3 ++ ecstore/src/disk/error.rs | 2 + ecstore/src/error.rs | 1 + ecstore/src/store.rs | 2 +- ecstore/src/store_api.rs | 1 - ecstore/src/utils/path.rs | 4 +- iam/Cargo.toml | 2 + iam/src/auth/credentials.rs | 54 ++++++++++++++++++++-- iam/src/cache.rs | 2 +- iam/src/error.rs | 9 ++++ iam/src/lib.rs | 36 ++++++++++++++- iam/src/manager.rs | 58 ++++++++++++++++++++---- iam/src/policy.rs | 10 ++++- iam/src/store.rs | 3 +- iam/src/store/object.rs | 62 +++++++++++++++---------- iam/src/utils.rs | 10 ++++- rustfs/Cargo.toml | 1 + rustfs/src/admin/handlers.rs | 87 ++++++++++++++++++++++++++++++++---- rustfs/src/auth.rs | 39 ++++++++++++++++ rustfs/src/main.rs | 10 +++-- scripts/run.sh | 2 +- 21 files changed, 339 insertions(+), 59 deletions(-) create mode 100644 rustfs/src/auth.rs diff --git a/Cargo.lock b/Cargo.lock index 755756bfd..9d8a9643e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1287,6 +1287,7 @@ dependencies = [ "futures", "ipnetwork", "itertools", + "jsonwebtoken", "log", "rand", "serde", @@ -1296,6 +1297,7 @@ dependencies = [ "thiserror 2.0.3", "time", "tokio", + "tracing", ] [[package]] @@ -2521,6 +2523,7 @@ dependencies = [ "hyper", "hyper-util", "iam", + "jsonwebtoken", "lazy_static", "lock", "log", diff --git a/ecstore/src/disk/error.rs b/ecstore/src/disk/error.rs index 1b8a2b92b..dae1081eb 100644 --- a/ecstore/src/disk/error.rs +++ b/ecstore/src/disk/error.rs @@ -1,5 +1,7 @@ use std::io::{self, ErrorKind}; +use tracing::error; + use crate::{ error::{Error, Result}, quorum::CheckErrorFn, diff --git a/ecstore/src/error.rs b/ecstore/src/error.rs index 786594330..e7912cd8e 100644 --- a/ecstore/src/error.rs +++ b/ecstore/src/error.rs @@ -1,5 +1,6 @@ use std::io; +use tracing::warn; use tracing_error::{SpanTrace, SpanTraceStatus}; use crate::disk::error::{clone_disk_err, DiskError}; diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 102cf8f48..1e9ad8f77 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -54,10 +54,10 @@ use std::slice::Iter; use std::time::SystemTime; use std::{collections::HashMap, sync::Arc, time::Duration}; use time::OffsetDateTime; +use tokio::select; use tokio::sync::mpsc::Sender; use tokio::sync::{broadcast, mpsc, RwLock}; use tokio::time::{interval, sleep}; -use tokio::{fs, select}; use tracing::{debug, info}; use uuid::Uuid; diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index 48a860fee..fc37c3ccc 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -9,7 +9,6 @@ use crate::{ use futures::StreamExt; use http::HeaderMap; use madmin::heal_commands::HealResultItem; -use madmin::info_commands::DiskMetrics; use rmp_serde::Serializer; use s3s::{dto::StreamingBlob, Body}; use serde::{Deserialize, Serialize}; diff --git a/ecstore/src/utils/path.rs b/ecstore/src/utils/path.rs index 654333ec2..cd538bc07 100644 --- a/ecstore/src/utils/path.rs +++ b/ecstore/src/utils/path.rs @@ -222,9 +222,9 @@ pub fn split(path: &str) -> (&str, &str) { (path, "") } -pub fn dir(path: &str) -> &str { +pub fn dir(path: &str) -> String { let (a, _) = split(path); - a + clean(a) } #[cfg(test)] mod tests { diff --git a/iam/Cargo.toml b/iam/Cargo.toml index 8b67c3536..8387981d3 100644 --- a/iam/Cargo.toml +++ b/iam/Cargo.toml @@ -26,6 +26,8 @@ itertools = "0.13.0" futures.workspace = true rand.workspace = true base64-simd = "0.8.0" +jsonwebtoken = "9.3.0" +tracing.workspace = true [dev-dependencies] test-case.workspace = true diff --git a/iam/src/auth/credentials.rs b/iam/src/auth/credentials.rs index ac4590c2a..822f237b1 100644 --- a/iam/src/auth/credentials.rs +++ b/iam/src/auth/credentials.rs @@ -1,13 +1,21 @@ +use crate::policy::{Policy, Validator}; +use crate::service_type::ServiceType; +use crate::{utils, Error}; +use jsonwebtoken::{encode, Algorithm, Header}; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use std::cell::LazyCell; use std::collections::HashMap; use time::format_description::BorrowedFormatItem; -use time::{Date, OffsetDateTime}; +use time::{Date, Duration, OffsetDateTime}; -use crate::policy::{Policy, Validator}; -use crate::service_type::ServiceType; -use crate::{utils, Error}; +const ACCESS_KEY_MIN_LEN: usize = 3; +const ACCESS_KEY_MAX_LEN: usize = 20; +const SECRET_KEY_MIN_LEN: usize = 8; +const SECRET_KEY_MAX_LEN: usize = 40; + +const ACCOUNT_ON: &str = "on"; +const ACCOUNT_OFF: &str = "off"; #[cfg_attr(test, derive(PartialEq, Eq, Debug))] struct CredentialHeader { @@ -102,6 +110,44 @@ impl Credentials { Self::check_key_value(header) } + pub fn get_new_credentials_with_metadata( + claims: &T, + token_secret: &str, + exp: Option, + ) -> crate::Result { + let ak = utils::gen_access_key(20).unwrap_or_default(); + let sk = utils::gen_secret_key(32).unwrap_or_default(); + + Self::create_new_credentials_with_metadata(&ak, &sk, claims, token_secret, exp) + } + + pub fn create_new_credentials_with_metadata( + ak: &str, + sk: &str, + claims: &T, + token_secret: &str, + exp: Option, + ) -> crate::Result { + if ak.len() < ACCESS_KEY_MIN_LEN || ak.len() > ACCESS_KEY_MAX_LEN { + return Err(Error::InvalidAccessKeyLength); + } + + if sk.len() < SECRET_KEY_MIN_LEN || sk.len() > SECRET_KEY_MAX_LEN { + return Err(Error::InvalidAccessKeyLength); + } + + let token = utils::generate_jwt(claims, token_secret).map_err(Error::JWTError)?; + + Ok(Self { + access_key: ak.to_owned(), + secret_key: sk.to_owned(), + session_token: token, + status: ACCOUNT_ON.to_owned(), + expiration: exp.map(|v| OffsetDateTime::now_utc().saturating_add(Duration::seconds(v as i64))), + ..Default::default() + }) + } + pub fn check_key_value(_header: CredentialHeader) -> crate::Result { todo!() } diff --git a/iam/src/cache.rs b/iam/src/cache.rs index c3dbef97c..41a3c711f 100644 --- a/iam/src/cache.rs +++ b/iam/src/cache.rs @@ -89,7 +89,7 @@ impl Cache { impl CacheInner { #[inline] - fn get_user<'a>(&self, user_name: &'a str) -> Option<&UserIdentity> { + pub fn get_user<'a>(&self, user_name: &'a str) -> Option<&UserIdentity> { self.users.get(user_name).or_else(|| self.sts_accounts.get(user_name)) } diff --git a/iam/src/error.rs b/iam/src/error.rs index cc92131d1..70117183e 100644 --- a/iam/src/error.rs +++ b/iam/src/error.rs @@ -28,6 +28,15 @@ pub enum Error { #[error("malformed credential")] ErrCredMalformed, + + #[error("CredNotInitialized")] + CredNotInitialized, + + #[error("invalid key length")] + InvalidAccessKeyLength, + + #[error("jwt err {0}")] + JWTError(jsonwebtoken::errors::Error), } pub type Result = std::result::Result; diff --git a/iam/src/lib.rs b/iam/src/lib.rs index 5d41c7900..419e45105 100644 --- a/iam/src/lib.rs +++ b/iam/src/lib.rs @@ -7,7 +7,7 @@ use std::sync::{Arc, OnceLock}; use store::object::ObjectStore; use time::OffsetDateTime; -mod cache; +pub mod cache; mod format; mod handler; @@ -24,6 +24,38 @@ pub use error::{Error, Result}; static IAM_SYS: OnceLock>> = OnceLock::new(); +static GLOBAL_ACTIVE_CRED: OnceLock = OnceLock::new(); + +pub fn init_global_action_cred(ak: Option, sk: Option) -> Result<()> { + let ak = { + if let Some(k) = ak { + k + } else { + utils::gen_access_key(20).unwrap_or_default() + } + }; + + let sk = { + if let Some(k) = sk { + k + } else { + utils::gen_secret_key(32).unwrap_or_default() + } + }; + + GLOBAL_ACTIVE_CRED + .set(Credentials { + access_key: ak, + secret_key: sk, + ..Default::default() + }) + .map_err(|_e| Error::CredNotInitialized) +} + +pub fn get_global_action_cred() -> Option { + GLOBAL_ACTIVE_CRED.get().cloned() +} + pub async fn init_iam_sys(ecstore: Arc) -> crate::Result<()> { debug!("init iam system"); let s = IamCache::new(ObjectStore::new(ecstore)).await; @@ -33,7 +65,7 @@ pub async fn init_iam_sys(ecstore: Arc) -> crate::Result<()> { #[inline] pub fn get() -> crate::Result>> { - IAM_SYS.get().map(|x| Arc::clone(x)).ok_or(Error::IamSysNotInitialized) + IAM_SYS.get().map(Arc::clone).ok_or(Error::IamSysNotInitialized) } pub async fn is_allowed<'a>(args: Args<'a>) -> crate::Result { diff --git a/iam/src/manager.rs b/iam/src/manager.rs index 84daf8757..a58aa8b15 100644 --- a/iam/src/manager.rs +++ b/iam/src/manager.rs @@ -109,11 +109,12 @@ where } // todo, 判断是否存在,是否可以重试 + #[tracing::instrument(level = "debug", skip(self))] async fn save_iam_formatter(self: Arc) -> crate::Result<()> { match self.api.load_iam_config::(Format::PATH).await { Ok((format, _)) if format.version >= 1 => return Ok(()), Err(Error::EcstoreError(e)) if !ecstore::disk::error::is_err_file_not_found(&e) => { - return Err(Error::EcstoreError(e)) + return Err(Error::EcstoreError(e)); } _ => {} } @@ -127,13 +128,14 @@ where Ok(users .values() .filter_map(|x| { - if !access_key.is_empty() && x.credentials.parent_user.as_str() == access_key { - if x.credentials.is_service_account() { - let mut c = x.credentials.clone(); - c.secret_key = String::new(); - c.session_token = String::new(); - return Some(c); - } + if !access_key.is_empty() + && x.credentials.parent_user.as_str() == access_key + && x.credentials.is_service_account() + { + let mut c = x.credentials.clone(); + c.secret_key = String::new(); + c.session_token = String::new(); + return Some(c); } None @@ -220,4 +222,44 @@ where _ => Ok(None), } } + pub async fn policy_db_get(&self, name: &str, _groups: Option>) -> crate::Result> { + // let user = self.cache.users.load(); + // let Some(u) = user.get(name) else { + // return Err(Error::StringError("no service account".into())); + // }; + + let policies = self.cache.user_policies.load(); + + let user_policies = { + if let Some(p) = policies.get(name) { + p.to_slice() + } else { + Vec::new() + } + }; + + // TODO: groups + + Ok(user_policies) + } + + pub async fn set_temp_user(&self, _access_key: &str, cred: &Credentials, _policy_name: &str) -> crate::Result<()> { + let user_entiry = UserIdentity::from(cred.clone()); + let path = format!( + "config/iam/{}{}/identity.json", + UserType::Sts.prefix(), + user_entiry.credentials.access_key + ); + debug!("save object: {path:?}"); + self.api.save_iam_config(&user_entiry, path).await?; + + Cache::add_or_update( + &self.cache.users, + &user_entiry.credentials.access_key, + &user_entiry, + OffsetDateTime::now_utc(), + ); + + Ok(()) + } } diff --git a/iam/src/policy.rs b/iam/src/policy.rs index 114c56621..b60b017bf 100644 --- a/iam/src/policy.rs +++ b/iam/src/policy.rs @@ -17,7 +17,7 @@ pub use id::ID; pub use policy::{default::DEFAULT_POLICIES, Policy}; pub use resource::ResourceSet; use serde::{Deserialize, Serialize}; -use serde_json::Value; +use serde_json::{to_string, Value}; pub use statement::Statement; use std::collections::HashMap; use time::OffsetDateTime; @@ -37,6 +37,14 @@ impl MappedPolicy { update_at: OffsetDateTime::now_utc(), } } + + pub fn to_slice(&self) -> Vec { + self.policies + .split(",") + .filter(|v| !v.trim().is_empty()) + .map(|v| v.to_string()) + .collect() + } } pub struct GroupInfo { diff --git a/iam/src/store.rs b/iam/src/store.rs index 7944eeaf8..73053bf2d 100644 --- a/iam/src/store.rs +++ b/iam/src/store.rs @@ -8,7 +8,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::{ auth::UserIdentity, cache::Cache, - policy::{PolicyDoc, UserType, DEFAULT_POLICIES}, + policy::{MappedPolicy, PolicyDoc, UserType, DEFAULT_POLICIES}, }; #[async_trait::async_trait] @@ -40,4 +40,5 @@ pub trait Store: Clone + Send + Sync + 'static { async fn load_users(&self, user_type: UserType) -> crate::Result>; async fn load_policy_docs(&self) -> crate::Result>; + async fn load_mapped_policy(&self, user_type: UserType, name: &str, is_group: bool) -> crate::Result; } diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index 020e99c12..230259668 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -8,8 +8,9 @@ use ecstore::{ utils::path::dir, }; use futures::future::try_join_all; -use log::debug; +use log::{debug, warn}; use serde::{de::DeserializeOwned, Serialize}; +use tracing::error; use super::Store; use crate::{ @@ -99,14 +100,6 @@ impl ObjectStore { Ok(Some(user)) } - - async fn load_mapped_policy(&self, user_type: UserType, name: &str, _is_group: bool) -> crate::Result { - let (p, _) = self - .load_iam_config::(&format!("{base}{name}.json", base = user_type.prefix(), name = name)) - .await?; - - Ok(p) - } } #[async_trait::async_trait] @@ -137,6 +130,7 @@ impl Store for ObjectStore { )) } + #[tracing::instrument(level = "debug", skip(self, item, path))] async fn save_iam_config(&self, item: Item, path: impl AsRef + Send) -> crate::Result<()> { let data = serde_json::to_vec(&item).map_err(|e| crate::Error::StringError(e.to_string()))?; // let data = crypto::encrypt_data(&[], &data)?; @@ -169,8 +163,8 @@ impl Store for ObjectStore { .await?; if policy_doc.version == 0 { - policy_doc.create_date = object_info.mod_time.clone(); - policy_doc.update_date = object_info.mod_time.clone(); + policy_doc.create_date = object_info.mod_time; + policy_doc.update_date = object_info.mod_time; } result.insert(name.to_str().unwrap().to_owned(), policy_doc); @@ -219,7 +213,7 @@ impl Store for ObjectStore { "policydb/groups/", "service-accounts/", "policydb/sts-users/", - "sts", + "sts/", ], ) .await?; @@ -234,12 +228,13 @@ impl Store for ObjectStore { ); // 一次读取32个元素 - let mut iter = items + let iter = items .iter() .map(|item| item.trim_start_matches("config/iam/")) .map(|item| split_path(item, item.starts_with("policydb/"))) .filter_map(|(list_key, trimmed_item)| { debug!("list_key: {list_key}, trimmed_item: {trimmed_item}"); + if list_key == "format.json" { return None; } @@ -255,13 +250,14 @@ impl Store for ObjectStore { Some(async move { match list_key { "policies/" => { - let name = dir(trimmed_item).trim_end_matches('/'); + let trimmed_item = dir(trimmed_item); + let name = trimmed_item.trim_end_matches('/'); let policy_doc = self.load_policy(name).await?; policy_docs.lock().await.insert(name.to_owned(), policy_doc); } "users/" => { let name = dir(trimmed_item); - if let Some(user) = self.load_user_identity(UserType::Reg, name).await? { + if let Some(user) = self.load_user_identity(UserType::Reg, &name).await? { users.lock().await.insert(name.to_owned(), user); }; } @@ -276,7 +272,8 @@ impl Store for ObjectStore { } } "service-accounts/" => { - let name = dir(trimmed_item).trim_end_matches('/'); + let trimmed_item = dir(trimmed_item); + let name = trimmed_item.trim_end_matches('/'); let Some(user) = self.load_user_identity(UserType::Svc, name).await? else { return Ok(()); }; @@ -299,7 +296,8 @@ impl Store for ObjectStore { } "sts/" => { let name = dir(trimmed_item); - if let Some(user) = self.load_user_identity(UserType::Sts, name).await? { + if let Some(user) = self.load_user_identity(UserType::Sts, &name).await? { + warn!("sts_accounts insert {}, user {:?}", name, &user.credentials.access_key); sts_accounts.lock().await.insert(name.to_owned(), user); }; } @@ -319,7 +317,7 @@ impl Store for ObjectStore { let mut all_futures = Vec::with_capacity(32); - while let Some(f) = iter.next() { + for f in iter { all_futures.push(f); if all_futures.len() == 32 { @@ -332,12 +330,30 @@ impl Store for ObjectStore { try_join_all(all_futures).await?; } - Arc::into_inner(users).map(|x| cache.users.store(Arc::new(x.into_inner().update_load_time()))); - Arc::into_inner(policy_docs).map(|x| cache.policy_docs.store(Arc::new(x.into_inner().update_load_time()))); - Arc::into_inner(user_policies).map(|x| cache.user_policies.store(Arc::new(x.into_inner().update_load_time()))); - Arc::into_inner(sts_policies).map(|x| cache.sts_policies.store(Arc::new(x.into_inner().update_load_time()))); - Arc::into_inner(sts_accounts).map(|x| cache.sts_accounts.store(Arc::new(x.into_inner().update_load_time()))); + if let Some(x) = Arc::into_inner(users) { + cache.users.store(Arc::new(x.into_inner().update_load_time())) + } + + if let Some(x) = Arc::into_inner(policy_docs) { + cache.policy_docs.store(Arc::new(x.into_inner().update_load_time())) + } + if let Some(x) = Arc::into_inner(user_policies) { + cache.user_policies.store(Arc::new(x.into_inner().update_load_time())) + } + if let Some(x) = Arc::into_inner(sts_policies) { + cache.sts_policies.store(Arc::new(x.into_inner().update_load_time())) + } + if let Some(x) = Arc::into_inner(sts_accounts) { + cache.sts_accounts.store(Arc::new(x.into_inner().update_load_time())) + } Ok(()) } + async fn load_mapped_policy(&self, user_type: UserType, name: &str, _is_group: bool) -> crate::Result { + let (p, _) = self + .load_iam_config::(&format!("{base}{name}.json", base = user_type.prefix(), name = name)) + .await?; + + Ok(p) + } } diff --git a/iam/src/utils.rs b/iam/src/utils.rs index 30285d52d..f3cd2260b 100644 --- a/iam/src/utils.rs +++ b/iam/src/utils.rs @@ -1,6 +1,7 @@ -use rand::{Rng, RngCore}; - use crate::Error; +use jsonwebtoken::{encode, Algorithm, EncodingKey, Header}; +use rand::{Rng, RngCore}; +use serde::Serialize; pub fn gen_access_key(length: usize) -> crate::Result { const ALPHA_NUMERIC_TABLE: [char; 36] = [ @@ -39,6 +40,11 @@ pub fn gen_secret_key(length: usize) -> crate::Result { Ok(key_str) } +pub fn generate_jwt(claims: &T, secret: &str) -> Result { + let header = Header::new(Algorithm::HS512); + encode(&header, &claims, &EncodingKey::from_secret(secret.as_bytes())) +} + #[cfg(test)] mod tests { use super::{gen_access_key, gen_secret_key}; diff --git a/rustfs/Cargo.toml b/rustfs/Cargo.toml index 82b13aaca..8b2431193 100644 --- a/rustfs/Cargo.toml +++ b/rustfs/Cargo.toml @@ -67,6 +67,7 @@ atoi = "2.0.0" serde_urlencoded = "0.7.1" crypto = { path = "../crypto" } iam = { path = "../iam" } +jsonwebtoken = "9.3.0" [build-dependencies] prost-build.workspace = true diff --git a/rustfs/src/admin/handlers.rs b/rustfs/src/admin/handlers.rs index 297fff8f7..48039e064 100644 --- a/rustfs/src/admin/handlers.rs +++ b/rustfs/src/admin/handlers.rs @@ -20,6 +20,7 @@ use ecstore::GLOBAL_Endpoints; use futures::{Stream, StreamExt}; use http::Uri; use hyper::StatusCode; +use iam::get_global_action_cred; use madmin::metrics::RealtimeMetrics; use madmin::utils::parse_duration; use matchit::Params; @@ -47,6 +48,9 @@ use tracing::{error, info, warn}; pub mod service_account; pub mod trace; +const ASSUME_ROLE_ACTION: &str = "AssumeRole"; +const ASSUME_ROLE_VERSION: &str = "2011-06-15"; + #[derive(Deserialize, Debug, Default)] #[serde(rename_all = "PascalCase", default)] pub struct AssumeRoleRequest { @@ -85,13 +89,30 @@ pub struct AssumeRoleRequest { // pub parent_user: String, // } +#[derive(Debug, Serialize, Default)] +pub struct STSClaims { + parent: String, + exp: usize, + access_key: String, +} + +fn get_token_signing_key() -> Option { + if let Some(s) = get_global_action_cred() { + Some(s.secret_key.clone()) + } else { + None + } +} + pub struct AssumeRoleHandle {} #[async_trait::async_trait] impl Operation for AssumeRoleHandle { async fn call(&self, req: S3Request, _params: Params<'_, '_>) -> S3Result> { warn!("handle AssumeRoleHandle"); - let Some(cred) = req.credentials else { return Err(s3_error!(InvalidRequest, "get cred failed")) }; + let Some(user) = req.credentials else { return Err(s3_error!(InvalidRequest, "get cred failed")) }; + + // TODO: 判断权限, 不允许sts访问 let mut input = req.input; @@ -100,17 +121,67 @@ impl Operation for AssumeRoleHandle { }; let body: AssumeRoleRequest = from_bytes(&bytes).map_err(|_e| s3_error!(InvalidRequest, "get body failed"))?; - warn!("AssumeRole get body {:?}", body); + if body.action.as_str() != ASSUME_ROLE_ACTION { + return Err(s3_error!(InvalidArgument, "not suport action")); + } - let exp = OffsetDateTime::now_utc().saturating_add(Duration::days(1)); + if body.version.as_str() != ASSUME_ROLE_VERSION { + return Err(s3_error!(InvalidArgument, "not suport version")); + } + + warn!("AssumeRole get cred {:?}", &user); + warn!("AssumeRole get body {:?}", &body); + + let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) }; + + if let Err(_err) = iam_store.policy_db_get(&user.access_key, None).await { + return Err(s3_error!(InvalidArgument, "invalid policy arg")); + } + + let Some(secret) = get_token_signing_key() else { + return Err(s3_error!(InvalidArgument, "sk not init")); + }; + + let exp = { + if body.duration_seconds > 0 { + body.duration_seconds + } else { + 3600 + } + }; + + let mut claims = STSClaims { + parent: user.access_key.clone(), + exp, + ..Default::default() + }; + + let ak = iam::utils::gen_access_key(20).unwrap_or_default(); + let sk = iam::utils::gen_secret_key(32).unwrap_or_default(); + + claims.access_key = ak.clone(); + + let mut cred = match iam::auth::Credentials::create_new_credentials_with_metadata(&ak, &sk, &claims, &secret, Some(exp)) { + Ok(res) => res, + Err(_er) => return Err(s3_error!(InvalidRequest, "")), + }; + + cred.parent_user = user.access_key.clone(); + + if let Err(err) = iam_store.set_temp_user(&cred.access_key, &cred, "").await { + error!("set_temp_user err {:?}", err); + return Err(s3_error!(InternalError, "set_temp_user failed")); + } - // TODO: create tmp access_key let resp = AssumeRoleOutput { credentials: Some(Credentials { access_key_id: cred.access_key, - expiration: Timestamp::from(exp), - secret_access_key: cred.secret_key.expose().to_string(), - session_token: "sdfsdf".to_owned(), + expiration: Timestamp::from( + cred.expiration + .unwrap_or(OffsetDateTime::now_utc().saturating_add(Duration::seconds(3600))), + ), + secret_access_key: cred.secret_key, + session_token: cred.session_token, }), ..Default::default() }; @@ -119,8 +190,6 @@ impl Operation for AssumeRoleHandle { let output = xml::serialize::(&resp).unwrap(); Ok(S3Response::new((StatusCode::OK, Body::from(output)))) - - // return Err(s3_error!(NotImplemented)); } } diff --git a/rustfs/src/auth.rs b/rustfs/src/auth.rs new file mode 100644 index 000000000..f76fdfcbb --- /dev/null +++ b/rustfs/src/auth.rs @@ -0,0 +1,39 @@ +use iam::cache::CacheInner; +use s3s::auth::S3Auth; +use s3s::auth::SecretKey; +use s3s::auth::SimpleAuth; +use s3s::s3_error; +use s3s::S3Result; + +pub struct IAMAuth { + simple_auth: SimpleAuth, +} + +impl IAMAuth { + pub fn new(ak: impl Into, sk: impl Into) -> Self { + let simple_auth = SimpleAuth::from_single(ak, sk); + Self { simple_auth } + } +} + +#[async_trait::async_trait] +impl S3Auth for IAMAuth { + async fn get_secret_key(&self, access_key: &str) -> S3Result { + if access_key.is_empty() { + return Err(s3_error!(NotSignedUp, "Your account is not signed up")); + } + + if let Ok(key) = self.simple_auth.get_secret_key(access_key).await { + return Ok(key); + } + + if let Ok(iam_store) = iam::get() { + let c = CacheInner::from(&iam_store.cache); + if let Some(id) = c.get_user(access_key) { + return Ok(SecretKey::from(id.credentials.secret_key.clone())); + } + } + + Err(s3_error!(NotSignedUp, "Your account is not signed up2")) + } +} diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index e02254249..35c0dfc53 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -1,8 +1,10 @@ mod admin; +mod auth; mod config; mod grpc; mod service; mod storage; +use crate::auth::IAMAuth; use clap::Parser; use common::{ error::{Error, Result}, @@ -26,7 +28,7 @@ use hyper_util::{ }; use iam::init_iam_sys; use protos::proto_gen::node_service::node_service_server::NodeServiceServer; -use s3s::{auth::SimpleAuth, service::S3ServiceBuilder}; +use s3s::service::S3ServiceBuilder; use service::hybrid; use std::{io::IsTerminal, net::SocketAddr, str::FromStr}; use tokio::net::TcpListener; @@ -87,6 +89,7 @@ async fn run(opt: config::Opt) -> Result<()> { debug!("server_address {}", &server_address); + iam::init_global_action_cred(None, None).unwrap(); set_global_rustfs_port(server_port); //监听地址,端口从参数中获取 @@ -133,7 +136,7 @@ async fn run(opt: config::Opt) -> Result<()> { } //显示info信息 info!("authentication is enabled {}, {}", &access_key, &secret_key); - b.set_auth(SimpleAuth::from_single(access_key, secret_key)); + b.set_auth(IAMAuth::new(access_key, secret_key)); b.set_access(store.clone()); @@ -212,6 +215,8 @@ async fn run(opt: config::Opt) -> Result<()> { })?; warn!(" init store success!"); + init_iam_sys(store.clone()).await.unwrap(); + new_global_notification_sys(endpoint_pools.clone()).await.map_err(|err| { error!("new_global_notification_sys faild {:?}", &err); Error::from_string(err.to_string()) @@ -221,7 +226,6 @@ async fn run(opt: config::Opt) -> Result<()> { init_data_scanner().await; // init auto heal init_auto_heal().await; - init_iam_sys(store.clone()).await.unwrap(); info!("server was started"); diff --git a/scripts/run.sh b/scripts/run.sh index dbc40a437..4f1942d12 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -11,7 +11,7 @@ mkdir -p ./target/volume/test{0..4} if [ -z "$RUST_LOG" ]; then - export RUST_LOG="rustfs=debug,ecstore=debug,s3s=debug,reader=debug,router=debug" + export RUST_LOG="rustfs=debug,ecstore=debug,s3s=debug,iam=debug" fi # export RUSTFS_ERASURE_SET_DRIVE_COUNT=5 From 87b985ad36bb95b72c3eea6e70f6a87ad7f60180 Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 10 Dec 2024 20:47:48 +0800 Subject: [PATCH 28/77] fix init_global_action_cred --- rustfs/src/main.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index 35c0dfc53..fe7f2eb62 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -89,7 +89,18 @@ async fn run(opt: config::Opt) -> Result<()> { debug!("server_address {}", &server_address); - iam::init_global_action_cred(None, None).unwrap(); + //设置AK和SK + //其中部份内容从config配置文件中读取 + let mut access_key = String::from_str(config::DEFAULT_ACCESS_KEY).unwrap(); + let mut secret_key = String::from_str(config::DEFAULT_SECRET_KEY).unwrap(); + + // Enable authentication + if let (Some(ak), Some(sk)) = (opt.access_key, opt.secret_key) { + access_key = ak; + secret_key = sk; + } + + iam::init_global_action_cred(Some(access_key.clone()), Some(secret_key.clone())).unwrap(); set_global_rustfs_port(server_port); //监听地址,端口从参数中获取 @@ -124,16 +135,7 @@ async fn run(opt: config::Opt) -> Result<()> { let store = storage::ecfs::FS::new(); // let mut b = S3ServiceBuilder::new(storage::ecfs::FS::new(server_address.clone(), endpoint_pools).await?); let mut b = S3ServiceBuilder::new(store.clone()); - //设置AK和SK - //其中部份内容从config配置文件中读取 - let mut access_key = String::from_str(config::DEFAULT_ACCESS_KEY).unwrap(); - let mut secret_key = String::from_str(config::DEFAULT_SECRET_KEY).unwrap(); - // Enable authentication - if let (Some(ak), Some(sk)) = (opt.access_key, opt.secret_key) { - access_key = ak; - secret_key = sk; - } //显示info信息 info!("authentication is enabled {}, {}", &access_key, &secret_key); b.set_auth(IAMAuth::new(access_key, secret_key)); From f6e3575a50b08c21f800765faa1878bbfb086501 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 11 Dec 2024 16:05:29 +0800 Subject: [PATCH 29/77] fix:#159, fix:#160 --- ecstore/src/erasure.rs | 21 ++- ecstore/src/set_disk.rs | 288 +++++++++++++++++++------------------- ecstore/src/store_init.rs | 14 +- scripts/run.sh | 4 +- 4 files changed, 166 insertions(+), 161 deletions(-) diff --git a/ecstore/src/erasure.rs b/ecstore/src/erasure.rs index bd559e499..02ca900bb 100644 --- a/ecstore/src/erasure.rs +++ b/ecstore/src/erasure.rs @@ -533,14 +533,21 @@ impl ShardReader { let mut ress = Vec::with_capacity(reader_length); for disk in self.readers.iter_mut() { - if disk.is_none() { - ress.push(None); - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } + // if disk.is_none() { + // ress.push(None); + // errors.push(Some(Error::new(DiskError::DiskNotFound))); + // continue; + // } - let disk: &mut BitrotReader = disk.as_mut().unwrap(); - futures.push(disk.read_at(self.offset, read_length)); + // let disk: &mut BitrotReader = disk.as_mut().unwrap(); + let offset = self.offset; + futures.push(async move { + if let Some(disk) = disk { + disk.read_at(offset, read_length).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index d938671db..621ab8e6e 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -197,25 +197,24 @@ impl SetDisks { let mut errs = Vec::with_capacity(disks.len()); for (i, disk) in disks.iter().enumerate() { - if disk.is_none() { - // ress.push(None); - errs.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - let disk = disk.as_ref().unwrap(); let mut file_info = file_infos[i].clone(); - if file_info.erasure.index == 0 { - file_info.erasure.index = i + 1; - } + futures.push(async move { + if file_info.erasure.index == 0 { + file_info.erasure.index = i + 1; + } - if !file_info.is_valid() { - // ress.push(None); - errs.push(Some(Error::new(DiskError::FileCorrupt))); - continue; - } + if !file_info.is_valid() { + return Err(Error::new(DiskError::FileCorrupt)); + } - futures.push(disk.rename_data(src_bucket, src_object, file_info, dst_bucket, dst_object)) + if let Some(disk) = disk { + disk.rename_data(src_bucket, src_object, file_info, dst_bucket, dst_object) + .await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }) } let mut disk_versions = vec![None; disks.len()]; @@ -329,20 +328,22 @@ impl SetDisks { let mut errs = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errs.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); - futures.push(disk.delete( - bucket, - &file_path, - DeleteOptions { - recursive: true, - ..Default::default() - }, - )); + let file_path = file_path.clone(); + futures.push(async move { + if let Some(disk) = disk { + disk.delete( + bucket, + &file_path, + DeleteOptions { + recursive: true, + ..Default::default() + }, + ) + .await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -370,12 +371,13 @@ impl SetDisks { let mut errs = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errs.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - let disk = disk.as_ref().unwrap(); - futures.push(disk.delete_paths(RUSTFS_META_MULTIPART_BUCKET, paths)) + futures.push(async move { + if let Some(disk) = disk { + disk.delete_paths(RUSTFS_META_MULTIPART_BUCKET, paths).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }) } let results = join_all(futures).await; @@ -404,12 +406,14 @@ impl SetDisks { let mut errs = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errs.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - let disk = disk.as_ref().unwrap(); - futures.push(disk.rename_part(src_bucket, src_object, dst_bucket, dst_object, meta.clone())) + let meta = meta.clone(); + futures.push(async move { + if let Some(disk) = disk { + disk.rename_part(src_bucket, src_object, dst_bucket, dst_object, meta).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }) } let results = join_all(futures).await; @@ -490,15 +494,15 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for (i, disk) in disks.iter().enumerate() { - if disk.is_none() { - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); let mut file_info = files[i].clone(); file_info.erasure.index = i + 1; - futures.push(disk.write_metadata(org_bucket, bucket, prefix, file_info)); + futures.push(async move { + if let Some(disk) = disk { + disk.write_metadata(org_bucket, bucket, prefix, file_info).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -964,25 +968,22 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - ress.push(FileInfo::default()); - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); let opts = ReadOptions { read_data, healing }; futures.push(async move { - if version_id.is_empty() { - match disk.read_xl(bucket, object, read_data).await { - Ok(info) => { - let fi = file_info_from_raw(info, bucket, object, read_data).await?; - Ok(fi) + if let Some(disk) = disk { + if version_id.is_empty() { + match disk.read_xl(bucket, object, read_data).await { + Ok(info) => { + let fi = file_info_from_raw(info, bucket, object, read_data).await?; + Ok(fi) + } + Err(err) => Err(err), } - Err(err) => Err(err), + } else { + disk.read_version(org_bucket, bucket, object, version_id, &opts).await } } else { - disk.read_version(org_bucket, bucket, object, version_id, &opts).await + Err(Error::new(DiskError::DiskNotFound)) } }) } @@ -1026,14 +1027,13 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - ress.push(None); - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); - futures.push(disk.read_xl(bucket, object, read_data)); + futures.push(async move { + if let Some(disk) = disk { + disk.read_xl(bucket, object, read_data).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -1152,15 +1152,14 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - ress.push(None); - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); let req = req.clone(); - futures.push(disk.read_multiple(req)); + futures.push(async move { + if let Some(disk) = disk { + disk.read_multiple(req).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -1328,17 +1327,14 @@ impl SetDisks { let mut ress = Vec::new(); for disk in disks.iter() { - if disk.is_none() { - ress.push(None); - errs.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); let opts = opts.clone(); - // let mut wr = &mut wr; - futures.push(disk.walk_dir(opts, Writer::NotUse)); - // tokio::spawn(async move { disk.walk_dir(opts, wr).await }); + futures.push(async move { + if let Some(disk) = disk { + disk.walk_dir(opts, Writer::NotUse).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -1378,20 +1374,18 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); let file_path = file_path.clone(); let meta_file_path = format!("{}.meta", file_path); futures.push(async move { - disk.delete(RUSTFS_META_MULTIPART_BUCKET, &file_path, DeleteOptions::default()) - .await?; - disk.delete(RUSTFS_META_MULTIPART_BUCKET, &meta_file_path, DeleteOptions::default()) - .await + if let Some(disk) = disk { + disk.delete(RUSTFS_META_MULTIPART_BUCKET, &file_path, DeleteOptions::default()) + .await?; + disk.delete(RUSTFS_META_MULTIPART_BUCKET, &meta_file_path, DeleteOptions::default()) + .await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } }); } @@ -1422,13 +1416,15 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); - futures.push(disk.delete(RUSTFS_META_MULTIPART_BUCKET, &file_path, DeleteOptions::default())); + let file_path = file_path.clone(); + futures.push(async move { + if let Some(disk) = disk { + disk.delete(RUSTFS_META_MULTIPART_BUCKET, &file_path, DeleteOptions::default()) + .await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -1456,20 +1452,21 @@ impl SetDisks { let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errors.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - - let disk = disk.as_ref().unwrap(); - futures.push(disk.delete( - bucket, - prefix, - DeleteOptions { - recursive: true, - ..Default::default() - }, - )); + futures.push(async move { + if let Some(disk) = disk { + disk.delete( + bucket, + prefix, + DeleteOptions { + recursive: true, + ..Default::default() + }, + ) + .await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -1608,7 +1605,7 @@ impl SetDisks { // TODO: 优化并发 可用数量中断 let (parts_metadata, errs) = Self::read_all_fileinfo(&disks, "", bucket, object, vid.as_str(), read_data, false).await; // warn!("get_object_fileinfo parts_metadata {:?}", &parts_metadata); - // warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); + warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); let _min_disks = self.set_drive_count - self.default_parity_count; @@ -1629,9 +1626,9 @@ impl SetDisks { let fi = Self::pick_valid_fileinfo(&parts_metadata, mot_time, etag, read_quorum as usize)?; // debug!("get_object_fileinfo pick fi {:?}", &fi); - let online_disks: Vec> = op_online_disks.iter().filter(|v| v.is_some()).cloned().collect(); + // let online_disks: Vec> = op_online_disks.iter().filter(|v| v.is_some()).cloned().collect(); - Ok((fi, parts_metadata, online_disks)) + Ok((fi, parts_metadata, op_online_disks)) } #[allow(clippy::too_many_arguments)] @@ -1766,12 +1763,14 @@ impl SetDisks { let mut errs = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - errs.push(Some(Error::new(DiskError::DiskNotFound))); - continue; - } - let disk = disk.as_ref().unwrap(); - futures.push(disk.update_metadata(bucket, object, fi.clone(), opts)) + let fi = fi.clone(); + futures.push(async move { + if let Some(disk) = disk { + disk.update_metadata(bucket, object, fi, opts).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }) } let results = join_all(futures).await; @@ -3725,12 +3724,14 @@ impl StorageAPI for SetDisks { // let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - continue; - } - - let disk = disk.as_ref().unwrap(); - futures.push(disk.delete_versions(bucket, vers.clone(), DeleteOptions::default())); + let vers = vers.clone(); + futures.push(async move { + if let Some(disk) = disk { + disk.delete_versions(bucket, vers, DeleteOptions::default()).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; @@ -3963,19 +3964,16 @@ impl StorageAPI for SetDisks { let erasure = Erasure::new(fi.erasure.data_blocks, fi.erasure.parity_blocks, fi.erasure.block_size); for disk in disks.iter() { - if disk.is_none() { + if let Some(disk) = disk { + // let writer = disk.append_file(RUSTFS_META_TMP_BUCKET, &tmp_part_path).await?; + let filewriter = disk + .create_file("", RUSTFS_META_TMP_BUCKET, &tmp_part_path, data.content_length) + .await?; + let writer = new_bitrot_filewriter(filewriter, DEFAULT_BITROT_ALGO, erasure.shard_size(erasure.block_size)); + writers.push(Some(writer)); + } else { writers.push(None); - continue; } - let disk = disk.as_ref().unwrap().clone(); - - // let writer = disk.append_file(RUSTFS_META_TMP_BUCKET, &tmp_part_path).await?; - let filewriter = disk - .create_file("", RUSTFS_META_TMP_BUCKET, &tmp_part_path, data.content_length) - .await?; - let writer = new_bitrot_filewriter(filewriter, DEFAULT_BITROT_ALGO, erasure.shard_size(erasure.block_size)); - - writers.push(Some(writer)); } let mut erasure = Erasure::new(fi.erasure.data_blocks, fi.erasure.parity_blocks, fi.erasure.block_size); diff --git a/ecstore/src/store_init.rs b/ecstore/src/store_init.rs index b08182bc0..1b154c165 100644 --- a/ecstore/src/store_init.rs +++ b/ecstore/src/store_init.rs @@ -191,13 +191,13 @@ pub async fn load_format_erasure_all(disks: &[Option], heal: bool) -> let mut errors = Vec::with_capacity(disks.len()); for disk in disks.iter() { - if disk.is_none() { - datas.push(None); - errors.push(Some(Error::new(DiskError::DiskNotFound))); - } - - let disk = disk.as_ref().unwrap(); - futures.push(load_format_erasure(disk, heal)); + futures.push(async move { + if let Some(disk) = disk { + load_format_erasure(disk, heal).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); } let results = join_all(futures).await; diff --git a/scripts/run.sh b/scripts/run.sh index 4f1942d12..5b1326e6a 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -18,8 +18,8 @@ fi export RUSTFS_STORAGE_CLASS_INLINE_BLOCK="512 KB" -# DATA_DIR_ARG="./target/volume/test{0...4}" -DATA_DIR_ARG="./target/volume/test" +DATA_DIR_ARG="./target/volume/test{0...4}" +# DATA_DIR_ARG="./target/volume/test" if [ -n "$1" ]; then DATA_DIR_ARG="$1" From da4daee64593a598e1b1d7cc45aa769eb512405e Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 12 Dec 2024 09:54:06 +0800 Subject: [PATCH 30/77] fix: bug crash when disk drop --- ecstore/src/disk/error.rs | 4 ++++ ecstore/src/disk/local.rs | 2 ++ ecstore/src/set_disk.rs | 2 +- ecstore/src/sets.rs | 20 +++++++++++++++++--- ecstore/src/store.rs | 1 + rustfs/src/main.rs | 8 ++++++-- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ecstore/src/disk/error.rs b/ecstore/src/disk/error.rs index dae1081eb..d20c00a3f 100644 --- a/ecstore/src/disk/error.rs +++ b/ecstore/src/disk/error.rs @@ -265,6 +265,10 @@ pub fn os_err_to_file_err(e: io::Error) -> Error { } } +pub fn is_unformatted_disk(err: &Error) -> bool { + matches!(err.downcast_ref::(), Some(DiskError::UnformattedDisk)) +} + pub fn is_err_file_not_found(err: &Error) -> bool { matches!(err.downcast_ref::(), Some(DiskError::FileNotFound)) } diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 51ba61c41..8ab0f6ee0 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -252,6 +252,7 @@ impl LocalDisk { true } + #[tracing::instrument(level = "debug", skip(self))] async fn check_format_json(&self) -> Result { let md = fs::metadata(&self.format_path).await.map_err(|e| match e.kind() { ErrorKind::NotFound => DiskError::DiskNotFound, @@ -1051,6 +1052,7 @@ impl DiskAPI for LocalDisk { } } + #[tracing::instrument(level = "debug", skip(self))] async fn get_disk_id(&self) -> Result> { let mut format_info = self.format_info.write().await; diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 621ab8e6e..cde79dfc6 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1605,7 +1605,7 @@ impl SetDisks { // TODO: 优化并发 可用数量中断 let (parts_metadata, errs) = Self::read_all_fileinfo(&disks, "", bucket, object, vid.as_str(), read_data, false).await; // warn!("get_object_fileinfo parts_metadata {:?}", &parts_metadata); - warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); + // warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); let _min_disks = self.set_drive_count - self.default_parity_count; diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index 505610579..594e88f58 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -11,7 +11,7 @@ use uuid::Uuid; use crate::{ disk::{ - error::DiskError, + error::{is_unformatted_disk, DiskError}, format::{DistributionAlgoVersion, FormatV3}, new_disk, DiskAPI, DiskInfo, DiskOption, DiskStore, }, @@ -34,8 +34,8 @@ use crate::{ use crate::heal::heal_ops::HealSequence; use tokio::time::Duration; use tokio_util::sync::CancellationToken; -use tracing::info; use tracing::warn; +use tracing::{error, info}; #[derive(Debug, Clone)] pub struct Sets { @@ -56,6 +56,7 @@ pub struct Sets { } impl Sets { + #[tracing::instrument(level = "debug", skip(disks, endpoints, fm, pool_idx, partiy_count))] pub async fn new( disks: Vec>, endpoints: &PoolEndpoints, @@ -120,7 +121,20 @@ impl Sets { disk = local_disk; } - if let Some(_disk_id) = disk.as_ref().unwrap().get_disk_id().await? { + let has_disk_id = match disk.as_ref().unwrap().get_disk_id().await { + Ok(res) => res, + Err(err) => { + if is_unformatted_disk(&err) { + error!("get_disk_id err {:?}", err); + } else { + warn!("get_disk_id err {:?}", err); + } + + None + } + }; + + if let Some(_disk_id) = has_disk_id { set_drive.push(disk); } else { warn!("sets new set_drive {}-{} get_disk_id is none", i, j); diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 1e9ad8f77..cfaedd03e 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -94,6 +94,7 @@ pub struct ECStore { impl ECStore { #[allow(clippy::new_ret_no_self)] + #[tracing::instrument(level = "debug", skip(endpoint_pools))] pub async fn new(_address: String, endpoint_pools: EndpointServerPools) -> Result> { // let layouts = DisksLayout::from_volumes(endpoints.as_slice())?; diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index fe7f2eb62..4dea0f4fa 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -209,10 +209,14 @@ async fn run(opt: config::Opt) -> Result<()> { // init store let store = ECStore::new(server_address.clone(), endpoint_pools.clone()) .await - .map_err(|err| Error::from_string(err.to_string()))?; + .map_err(|err| { + error!("ECStore::new {:?}", &err); + panic!("{}", err); + Error::from_string(err.to_string()) + })?; ECStore::init(store.clone()).await.map_err(|err| { - error!("init faild {:?}", &err); + error!("ECStore init faild {:?}", &err); Error::from_string(err.to_string()) })?; warn!(" init store success!"); From 5341da3021af21e0a7be86dbd244f5d7df925c52 Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 12 Dec 2024 10:13:02 +0800 Subject: [PATCH 31/77] cargo fmt --- .../generated/flatbuffers_generated/models.rs | 207 +- .../src/generated/proto_gen/node_service.rs | 3832 ++++------------- 2 files changed, 886 insertions(+), 3153 deletions(-) diff --git a/common/protos/src/generated/flatbuffers_generated/models.rs b/common/protos/src/generated/flatbuffers_generated/models.rs index aa1f6ae2f..e4949fdcf 100644 --- a/common/protos/src/generated/flatbuffers_generated/models.rs +++ b/common/protos/src/generated/flatbuffers_generated/models.rs @@ -1,10 +1,9 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use core::mem; use core::cmp::Ordering; +use core::mem; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -12,112 +11,114 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod models { - use core::mem; - use core::cmp::Ordering; + use core::cmp::Ordering; + use core::mem; - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; -pub enum PingBodyOffset {} -#[derive(Copy, Clone, PartialEq)] + pub enum PingBodyOffset {} + #[derive(Copy, Clone, PartialEq)] -pub struct PingBody<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { - type Inner = PingBody<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PingBody<'a> { - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; - - pub const fn get_fully_qualified_name() -> &'static str { - "models.PingBody" - } - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PingBody { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PingBodyArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PingBodyBuilder::new(_fbb); - if let Some(x) = args.payload { builder.add_payload(x); } - builder.finish() - } - - - #[inline] - pub fn payload(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(PingBody::VT_PAYLOAD, None)} - } -} - -impl flatbuffers::Verifiable for PingBody<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("payload", Self::VT_PAYLOAD, false)? - .finish(); - Ok(()) - } -} -pub struct PingBodyArgs<'a> { - pub payload: Option>>, -} -impl<'a> Default for PingBodyArgs<'a> { - #[inline] - fn default() -> Self { - PingBodyArgs { - payload: None, + pub struct PingBody<'a> { + pub _tab: flatbuffers::Table<'a>, } - } -} -pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PingBody::VT_PAYLOAD, payload); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PingBodyBuilder { - fbb_: _fbb, - start_: start, + impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { + type Inner = PingBody<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} -impl core::fmt::Debug for PingBody<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PingBody"); - ds.field("payload", &self.payload()); - ds.finish() - } -} -} // pub mod models + impl<'a> PingBody<'a> { + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; + pub const fn get_fully_qualified_name() -> &'static str { + "models.PingBody" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PingBody { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PingBodyArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = PingBodyBuilder::new(_fbb); + if let Some(x) = args.payload { + builder.add_payload(x); + } + builder.finish() + } + + #[inline] + pub fn payload(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>(PingBody::VT_PAYLOAD, None) + } + } + } + + impl flatbuffers::Verifiable for PingBody<'_> { + #[inline] + fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>("payload", Self::VT_PAYLOAD, false)? + .finish(); + Ok(()) + } + } + pub struct PingBodyArgs<'a> { + pub payload: Option>>, + } + impl<'a> Default for PingBodyArgs<'a> { + #[inline] + fn default() -> Self { + PingBodyArgs { payload: None } + } + } + + pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { + #[inline] + pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(PingBody::VT_PAYLOAD, payload); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PingBodyBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for PingBody<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PingBody"); + ds.field("payload", &self.payload()); + ds.finish() + } + } +} // pub mod models diff --git a/common/protos/src/generated/proto_gen/node_service.rs b/common/protos/src/generated/proto_gen/node_service.rs index 74e524da1..6c4aef0e1 100644 --- a/common/protos/src/generated/proto_gen/node_service.rs +++ b/common/protos/src/generated/proto_gen/node_service.rs @@ -615,10 +615,7 @@ pub struct GenerallyLockResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mss { #[prost(map = "string, string", tag = "1")] - pub value: ::std::collections::HashMap< - ::prost::alloc::string::String, - ::prost::alloc::string::String, - >, + pub value: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct LocalStorageInfoRequest { @@ -782,10 +779,7 @@ pub struct DownloadProfileDataResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(map = "string, bytes", tag = "2")] - pub data: ::std::collections::HashMap< - ::prost::alloc::string::String, - ::prost::alloc::vec::Vec, - >, + pub data: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::vec::Vec>, #[prost(string, optional, tag = "3")] pub error_info: ::core::option::Option<::prost::alloc::string::String>, } @@ -1052,15 +1046,9 @@ pub struct LoadTransitionTierConfigResponse { } /// Generated client implementations. pub mod node_service_client { - #![allow( - unused_variables, - dead_code, - missing_docs, - clippy::wildcard_imports, - clippy::let_unit_value, - )] - use tonic::codegen::*; + #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] use tonic::codegen::http::Uri; + use tonic::codegen::*; #[derive(Debug, Clone)] pub struct NodeServiceClient { inner: tonic::client::Grpc, @@ -1091,22 +1079,16 @@ pub mod node_service_client { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> NodeServiceClient> + pub fn with_interceptor(inner: T, interceptor: F) -> NodeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, - Response = http::Response< - >::ResponseBody, - >, + Response = http::Response<>::ResponseBody>, >, - , - >>::Error: Into + std::marker::Send + std::marker::Sync, + >>::Error: + Into + std::marker::Send + std::marker::Sync, { NodeServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -1149,15 +1131,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Ping", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Ping"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Ping")); @@ -1166,22 +1142,13 @@ pub mod node_service_client { pub async fn heal_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/HealBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/HealBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "HealBucket")); @@ -1190,22 +1157,13 @@ pub mod node_service_client { pub async fn list_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ListBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListBucket")); @@ -1214,22 +1172,13 @@ pub mod node_service_client { pub async fn make_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/MakeBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeBucket")); @@ -1238,22 +1187,13 @@ pub mod node_service_client { pub async fn get_bucket_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetBucketInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketInfo")); @@ -1262,22 +1202,13 @@ pub mod node_service_client { pub async fn delete_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucket")); @@ -1286,22 +1217,13 @@ pub mod node_service_client { pub async fn read_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadAll", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAll"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAll")); @@ -1310,22 +1232,13 @@ pub mod node_service_client { pub async fn write_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WriteAll", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteAll"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteAll")); @@ -1338,15 +1251,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Delete", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Delete"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Delete")); @@ -1355,22 +1262,13 @@ pub mod node_service_client { pub async fn verify_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/VerifyFile", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/VerifyFile"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "VerifyFile")); @@ -1379,22 +1277,13 @@ pub mod node_service_client { pub async fn check_parts( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/CheckParts", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/CheckParts"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "CheckParts")); @@ -1403,22 +1292,13 @@ pub mod node_service_client { pub async fn rename_part( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RenamePart", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenamePart"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenamePart")); @@ -1427,22 +1307,13 @@ pub mod node_service_client { pub async fn rename_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RenameFile", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameFile"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameFile")); @@ -1455,15 +1326,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Write", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Write"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Write")); @@ -1472,22 +1337,13 @@ pub mod node_service_client { pub async fn write_stream( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WriteStream", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteStream"); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteStream")); @@ -1497,22 +1353,13 @@ pub mod node_service_client { pub async fn read_at( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadAt", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAt"); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAt")); @@ -1521,22 +1368,13 @@ pub mod node_service_client { pub async fn list_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ListDir", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListDir"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListDir")); @@ -1545,22 +1383,13 @@ pub mod node_service_client { pub async fn walk_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WalkDir", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WalkDir"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WalkDir")); @@ -1569,22 +1398,13 @@ pub mod node_service_client { pub async fn rename_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RenameData", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameData"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameData")); @@ -1593,22 +1413,13 @@ pub mod node_service_client { pub async fn make_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/MakeVolumes", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolumes"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolumes")); @@ -1617,22 +1428,13 @@ pub mod node_service_client { pub async fn make_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/MakeVolume", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolume"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolume")); @@ -1641,22 +1443,13 @@ pub mod node_service_client { pub async fn list_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ListVolumes", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListVolumes"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListVolumes")); @@ -1665,22 +1458,13 @@ pub mod node_service_client { pub async fn stat_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/StatVolume", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StatVolume"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StatVolume")); @@ -1689,22 +1473,13 @@ pub mod node_service_client { pub async fn delete_paths( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeletePaths", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePaths"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePaths")); @@ -1713,22 +1488,13 @@ pub mod node_service_client { pub async fn update_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/UpdateMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetadata"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetadata")); @@ -1737,22 +1503,13 @@ pub mod node_service_client { pub async fn write_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WriteMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteMetadata"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteMetadata")); @@ -1761,22 +1518,13 @@ pub mod node_service_client { pub async fn read_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadVersion", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadVersion"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadVersion")); @@ -1789,15 +1537,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadXL", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadXL"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadXL")); @@ -1806,22 +1548,13 @@ pub mod node_service_client { pub async fn delete_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteVersion", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersion"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersion")); @@ -1830,22 +1563,13 @@ pub mod node_service_client { pub async fn delete_versions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteVersions", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersions"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersions")); @@ -1854,22 +1578,13 @@ pub mod node_service_client { pub async fn read_multiple( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadMultiple", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadMultiple"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadMultiple")); @@ -1878,22 +1593,13 @@ pub mod node_service_client { pub async fn delete_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteVolume", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVolume"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVolume")); @@ -1902,22 +1608,13 @@ pub mod node_service_client { pub async fn disk_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DiskInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DiskInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DiskInfo")); @@ -1926,22 +1623,13 @@ pub mod node_service_client { pub async fn ns_scanner( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/NsScanner", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/NsScanner"); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "NsScanner")); @@ -1950,22 +1638,13 @@ pub mod node_service_client { pub async fn lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Lock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Lock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Lock")); @@ -1974,22 +1653,13 @@ pub mod node_service_client { pub async fn un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/UnLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UnLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UnLock")); @@ -1998,22 +1668,13 @@ pub mod node_service_client { pub async fn r_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RLock")); @@ -2022,22 +1683,13 @@ pub mod node_service_client { pub async fn r_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RUnLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RUnLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RUnLock")); @@ -2046,22 +1698,13 @@ pub mod node_service_client { pub async fn force_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ForceUnLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ForceUnLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ForceUnLock")); @@ -2070,22 +1713,13 @@ pub mod node_service_client { pub async fn refresh( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Refresh", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Refresh"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Refresh")); @@ -2094,22 +1728,13 @@ pub mod node_service_client { pub async fn local_storage_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LocalStorageInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LocalStorageInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LocalStorageInfo")); @@ -2118,22 +1743,13 @@ pub mod node_service_client { pub async fn server_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ServerInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ServerInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ServerInfo")); @@ -2142,22 +1758,13 @@ pub mod node_service_client { pub async fn get_cpus( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetCpus", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetCpus"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetCpus")); @@ -2166,22 +1773,13 @@ pub mod node_service_client { pub async fn get_net_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetNetInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetNetInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetNetInfo")); @@ -2190,22 +1788,13 @@ pub mod node_service_client { pub async fn get_partitions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetPartitions", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetPartitions"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetPartitions")); @@ -2214,22 +1803,13 @@ pub mod node_service_client { pub async fn get_os_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetOsInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetOsInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetOsInfo")); @@ -2238,22 +1818,13 @@ pub mod node_service_client { pub async fn get_se_linux_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSELinuxInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSELinuxInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSELinuxInfo")); @@ -2262,22 +1833,13 @@ pub mod node_service_client { pub async fn get_sys_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSysConfig", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysConfig"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysConfig")); @@ -2286,22 +1848,13 @@ pub mod node_service_client { pub async fn get_sys_errors( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSysErrors", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysErrors"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysErrors")); @@ -2310,22 +1863,13 @@ pub mod node_service_client { pub async fn get_mem_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetMemInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMemInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMemInfo")); @@ -2334,22 +1878,13 @@ pub mod node_service_client { pub async fn get_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetMetrics", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetrics"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMetrics")); @@ -2358,22 +1893,13 @@ pub mod node_service_client { pub async fn get_proc_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetProcInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetProcInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetProcInfo")); @@ -2382,22 +1908,13 @@ pub mod node_service_client { pub async fn start_profiling( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/StartProfiling", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StartProfiling"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StartProfiling")); @@ -2406,48 +1923,28 @@ pub mod node_service_client { pub async fn download_profile_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DownloadProfileData", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DownloadProfileData"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "DownloadProfileData"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "DownloadProfileData")); self.inner.unary(req, path, codec).await } pub async fn get_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetBucketStats", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketStats"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketStats")); @@ -2456,22 +1953,13 @@ pub mod node_service_client { pub async fn get_sr_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSRMetrics", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSRMetrics"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSRMetrics")); @@ -2480,100 +1968,58 @@ pub mod node_service_client { pub async fn get_all_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetAllBucketStats", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetAllBucketStats"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "GetAllBucketStats"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "GetAllBucketStats")); self.inner.unary(req, path, codec).await } pub async fn load_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadBucketMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadBucketMetadata"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata")); self.inner.unary(req, path, codec).await } pub async fn delete_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteBucketMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucketMetadata"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata")); self.inner.unary(req, path, codec).await } pub async fn delete_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeletePolicy", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePolicy"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePolicy")); @@ -2582,22 +2028,13 @@ pub mod node_service_client { pub async fn load_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadPolicy", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicy"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicy")); @@ -2606,48 +2043,28 @@ pub mod node_service_client { pub async fn load_policy_mapping( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadPolicyMapping", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicyMapping"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping")); self.inner.unary(req, path, codec).await } pub async fn delete_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteUser", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteUser"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteUser")); @@ -2656,48 +2073,28 @@ pub mod node_service_client { pub async fn delete_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteServiceAccount", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteServiceAccount"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount")); self.inner.unary(req, path, codec).await } pub async fn load_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadUser", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadUser"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadUser")); @@ -2706,48 +2103,28 @@ pub mod node_service_client { pub async fn load_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadServiceAccount", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadServiceAccount"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadServiceAccount"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadServiceAccount")); self.inner.unary(req, path, codec).await } pub async fn load_group( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadGroup", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadGroup"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadGroup")); @@ -2756,30 +2133,16 @@ pub mod node_service_client { pub async fn reload_site_replication_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReloadSiteReplicationConfig", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadSiteReplicationConfig"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new( - "node_service.NodeService", - "ReloadSiteReplicationConfig", - ), - ); + .insert(GrpcMethod::new("node_service.NodeService", "ReloadSiteReplicationConfig")); self.inner.unary(req, path, codec).await } /// rpc VerifyBinary() returns () {}; @@ -2787,22 +2150,13 @@ pub mod node_service_client { pub async fn signal_service( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/SignalService", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/SignalService"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "SignalService")); @@ -2811,100 +2165,58 @@ pub mod node_service_client { pub async fn background_heal_status( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/BackgroundHealStatus", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/BackgroundHealStatus"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus")); self.inner.unary(req, path, codec).await } pub async fn get_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetMetacacheListing", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetacacheListing"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "GetMetacacheListing"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "GetMetacacheListing")); self.inner.unary(req, path, codec).await } pub async fn update_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/UpdateMetacacheListing", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetacacheListing"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing")); self.inner.unary(req, path, codec).await } pub async fn reload_pool_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReloadPoolMeta", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadPoolMeta"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReloadPoolMeta")); @@ -2913,22 +2225,13 @@ pub mod node_service_client { pub async fn stop_rebalance( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/StopRebalance", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StopRebalance"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StopRebalance")); @@ -2937,69 +2240,38 @@ pub mod node_service_client { pub async fn load_rebalance_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadRebalanceMeta", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadRebalanceMeta"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta")); self.inner.unary(req, path, codec).await } pub async fn load_transition_tier_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadTransitionTierConfig", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadTransitionTierConfig"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new( - "node_service.NodeService", - "LoadTransitionTierConfig", - ), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadTransitionTierConfig")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod node_service_server { - #![allow( - unused_variables, - dead_code, - missing_docs, - clippy::wildcard_imports, - clippy::let_unit_value, - )] + #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with NodeServiceServer. #[async_trait] @@ -3012,38 +2284,23 @@ pub mod node_service_server { async fn heal_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn list_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn make_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_bucket_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_all( &self, request: tonic::Request, @@ -3051,10 +2308,7 @@ pub mod node_service_server { async fn write_all( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete( &self, request: tonic::Request, @@ -3062,52 +2316,33 @@ pub mod node_service_server { async fn verify_file( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn check_parts( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn rename_part( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn rename_file( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn write( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WriteStream method. - type WriteStreamStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + type WriteStreamStream: tonic::codegen::tokio_stream::Stream> + std::marker::Send + 'static; async fn write_stream( &self, request: tonic::Request>, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the ReadAt method. - type ReadAtStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + type ReadAtStream: tonic::codegen::tokio_stream::Stream> + std::marker::Send + 'static; /// rpc Append(AppendRequest) returns (AppendResponse) {}; @@ -3126,66 +2361,39 @@ pub mod node_service_server { async fn rename_data( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn make_volumes( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn make_volume( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn list_volumes( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn stat_volume( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_paths( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn update_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn write_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_version( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_xl( &self, request: tonic::Request, @@ -3193,42 +2401,25 @@ pub mod node_service_server { async fn delete_version( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_versions( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_multiple( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_volume( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn disk_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the NsScanner method. - type NsScannerStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + type NsScannerStream: tonic::codegen::tokio_stream::Stream> + std::marker::Send + 'static; async fn ns_scanner( @@ -3238,59 +2429,35 @@ pub mod node_service_server { async fn lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn un_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn r_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn r_un_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn force_un_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn refresh( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn local_storage_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn server_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_cpus( &self, request: tonic::Request, @@ -3298,236 +2465,137 @@ pub mod node_service_server { async fn get_net_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_partitions( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_os_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_se_linux_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_sys_config( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_sys_errors( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_mem_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_metrics( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_proc_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn start_profiling( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn download_profile_data( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_sr_metrics( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_all_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_policy( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_policy( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_policy_mapping( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_user( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_service_account( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_user( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_service_account( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_group( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn reload_site_replication_config( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// rpc VerifyBinary() returns () {}; /// rpc CommitBinary() returns () {}; async fn signal_service( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn background_heal_status( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn update_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn reload_pool_meta( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn stop_rebalance( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_rebalance_meta( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_transition_tier_config( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct NodeServiceServer { @@ -3550,10 +2618,7 @@ pub mod node_service_server { max_encoding_message_size: None, } } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService where F: tonic::service::Interceptor, { @@ -3597,10 +2662,7 @@ pub mod node_service_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { + fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -3608,21 +2670,12 @@ pub mod node_service_server { "/node_service.NodeService/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl tonic::server::UnaryService - for PingSvc { + impl tonic::server::UnaryService for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::ping(&inner, request).await - }; + let fut = async move { ::ping(&inner, request).await }; Box::pin(fut) } } @@ -3635,14 +2688,8 @@ pub mod node_service_server { let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3651,23 +2698,12 @@ pub mod node_service_server { "/node_service.NodeService/HealBucket" => { #[allow(non_camel_case_types)] struct HealBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for HealBucketSvc { + impl tonic::server::UnaryService for HealBucketSvc { type Response = super::HealBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::heal_bucket(&inner, request).await - }; + let fut = async move { ::heal_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3680,14 +2716,8 @@ pub mod node_service_server { let method = HealBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3696,23 +2726,12 @@ pub mod node_service_server { "/node_service.NodeService/ListBucket" => { #[allow(non_camel_case_types)] struct ListBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ListBucketSvc { + impl tonic::server::UnaryService for ListBucketSvc { type Response = super::ListBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::list_bucket(&inner, request).await - }; + let fut = async move { ::list_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3725,14 +2744,8 @@ pub mod node_service_server { let method = ListBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3741,23 +2754,12 @@ pub mod node_service_server { "/node_service.NodeService/MakeBucket" => { #[allow(non_camel_case_types)] struct MakeBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for MakeBucketSvc { + impl tonic::server::UnaryService for MakeBucketSvc { type Response = super::MakeBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::make_bucket(&inner, request).await - }; + let fut = async move { ::make_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3770,14 +2772,8 @@ pub mod node_service_server { let method = MakeBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3786,23 +2782,12 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketInfo" => { #[allow(non_camel_case_types)] struct GetBucketInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetBucketInfoSvc { + impl tonic::server::UnaryService for GetBucketInfoSvc { type Response = super::GetBucketInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_bucket_info(&inner, request).await - }; + let fut = async move { ::get_bucket_info(&inner, request).await }; Box::pin(fut) } } @@ -3815,14 +2800,8 @@ pub mod node_service_server { let method = GetBucketInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3831,23 +2810,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucket" => { #[allow(non_camel_case_types)] struct DeleteBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteBucketSvc { + impl tonic::server::UnaryService for DeleteBucketSvc { type Response = super::DeleteBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_bucket(&inner, request).await - }; + let fut = async move { ::delete_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3860,14 +2828,8 @@ pub mod node_service_server { let method = DeleteBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3876,23 +2838,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadAll" => { #[allow(non_camel_case_types)] struct ReadAllSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadAllSvc { + impl tonic::server::UnaryService for ReadAllSvc { type Response = super::ReadAllResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_all(&inner, request).await - }; + let fut = async move { ::read_all(&inner, request).await }; Box::pin(fut) } } @@ -3905,14 +2856,8 @@ pub mod node_service_server { let method = ReadAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3921,23 +2866,12 @@ pub mod node_service_server { "/node_service.NodeService/WriteAll" => { #[allow(non_camel_case_types)] struct WriteAllSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for WriteAllSvc { + impl tonic::server::UnaryService for WriteAllSvc { type Response = super::WriteAllResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write_all(&inner, request).await - }; + let fut = async move { ::write_all(&inner, request).await }; Box::pin(fut) } } @@ -3950,14 +2884,8 @@ pub mod node_service_server { let method = WriteAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3966,23 +2894,12 @@ pub mod node_service_server { "/node_service.NodeService/Delete" => { #[allow(non_camel_case_types)] struct DeleteSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteSvc { + impl tonic::server::UnaryService for DeleteSvc { type Response = super::DeleteResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete(&inner, request).await - }; + let fut = async move { ::delete(&inner, request).await }; Box::pin(fut) } } @@ -3995,14 +2912,8 @@ pub mod node_service_server { let method = DeleteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4011,23 +2922,12 @@ pub mod node_service_server { "/node_service.NodeService/VerifyFile" => { #[allow(non_camel_case_types)] struct VerifyFileSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for VerifyFileSvc { + impl tonic::server::UnaryService for VerifyFileSvc { type Response = super::VerifyFileResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::verify_file(&inner, request).await - }; + let fut = async move { ::verify_file(&inner, request).await }; Box::pin(fut) } } @@ -4040,14 +2940,8 @@ pub mod node_service_server { let method = VerifyFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4056,23 +2950,12 @@ pub mod node_service_server { "/node_service.NodeService/CheckParts" => { #[allow(non_camel_case_types)] struct CheckPartsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for CheckPartsSvc { + impl tonic::server::UnaryService for CheckPartsSvc { type Response = super::CheckPartsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::check_parts(&inner, request).await - }; + let fut = async move { ::check_parts(&inner, request).await }; Box::pin(fut) } } @@ -4085,14 +2968,8 @@ pub mod node_service_server { let method = CheckPartsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4101,23 +2978,12 @@ pub mod node_service_server { "/node_service.NodeService/RenamePart" => { #[allow(non_camel_case_types)] struct RenamePartSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RenamePartSvc { + impl tonic::server::UnaryService for RenamePartSvc { type Response = super::RenamePartResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::rename_part(&inner, request).await - }; + let fut = async move { ::rename_part(&inner, request).await }; Box::pin(fut) } } @@ -4130,14 +2996,8 @@ pub mod node_service_server { let method = RenamePartSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4146,23 +3006,12 @@ pub mod node_service_server { "/node_service.NodeService/RenameFile" => { #[allow(non_camel_case_types)] struct RenameFileSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RenameFileSvc { + impl tonic::server::UnaryService for RenameFileSvc { type Response = super::RenameFileResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::rename_file(&inner, request).await - }; + let fut = async move { ::rename_file(&inner, request).await }; Box::pin(fut) } } @@ -4175,14 +3024,8 @@ pub mod node_service_server { let method = RenameFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4191,21 +3034,12 @@ pub mod node_service_server { "/node_service.NodeService/Write" => { #[allow(non_camel_case_types)] struct WriteSvc(pub Arc); - impl tonic::server::UnaryService - for WriteSvc { + impl tonic::server::UnaryService for WriteSvc { type Response = super::WriteResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write(&inner, request).await - }; + let fut = async move { ::write(&inner, request).await }; Box::pin(fut) } } @@ -4218,14 +3052,8 @@ pub mod node_service_server { let method = WriteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4234,26 +3062,13 @@ pub mod node_service_server { "/node_service.NodeService/WriteStream" => { #[allow(non_camel_case_types)] struct WriteStreamSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::StreamingService - for WriteStreamSvc { + impl tonic::server::StreamingService for WriteStreamSvc { type Response = super::WriteResponse; type ResponseStream = T::WriteStreamStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request>) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write_stream(&inner, request).await - }; + let fut = async move { ::write_stream(&inner, request).await }; Box::pin(fut) } } @@ -4266,14 +3081,8 @@ pub mod node_service_server { let method = WriteStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -4282,26 +3091,13 @@ pub mod node_service_server { "/node_service.NodeService/ReadAt" => { #[allow(non_camel_case_types)] struct ReadAtSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::StreamingService - for ReadAtSvc { + impl tonic::server::StreamingService for ReadAtSvc { type Response = super::ReadAtResponse; type ResponseStream = T::ReadAtStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request>) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_at(&inner, request).await - }; + let fut = async move { ::read_at(&inner, request).await }; Box::pin(fut) } } @@ -4314,14 +3110,8 @@ pub mod node_service_server { let method = ReadAtSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -4330,23 +3120,12 @@ pub mod node_service_server { "/node_service.NodeService/ListDir" => { #[allow(non_camel_case_types)] struct ListDirSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ListDirSvc { + impl tonic::server::UnaryService for ListDirSvc { type Response = super::ListDirResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::list_dir(&inner, request).await - }; + let fut = async move { ::list_dir(&inner, request).await }; Box::pin(fut) } } @@ -4359,14 +3138,8 @@ pub mod node_service_server { let method = ListDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4375,23 +3148,12 @@ pub mod node_service_server { "/node_service.NodeService/WalkDir" => { #[allow(non_camel_case_types)] struct WalkDirSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for WalkDirSvc { + impl tonic::server::UnaryService for WalkDirSvc { type Response = super::WalkDirResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::walk_dir(&inner, request).await - }; + let fut = async move { ::walk_dir(&inner, request).await }; Box::pin(fut) } } @@ -4404,14 +3166,8 @@ pub mod node_service_server { let method = WalkDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4420,23 +3176,12 @@ pub mod node_service_server { "/node_service.NodeService/RenameData" => { #[allow(non_camel_case_types)] struct RenameDataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RenameDataSvc { + impl tonic::server::UnaryService for RenameDataSvc { type Response = super::RenameDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::rename_data(&inner, request).await - }; + let fut = async move { ::rename_data(&inner, request).await }; Box::pin(fut) } } @@ -4449,14 +3194,8 @@ pub mod node_service_server { let method = RenameDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4465,23 +3204,12 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolumes" => { #[allow(non_camel_case_types)] struct MakeVolumesSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for MakeVolumesSvc { + impl tonic::server::UnaryService for MakeVolumesSvc { type Response = super::MakeVolumesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::make_volumes(&inner, request).await - }; + let fut = async move { ::make_volumes(&inner, request).await }; Box::pin(fut) } } @@ -4494,14 +3222,8 @@ pub mod node_service_server { let method = MakeVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4510,23 +3232,12 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolume" => { #[allow(non_camel_case_types)] struct MakeVolumeSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for MakeVolumeSvc { + impl tonic::server::UnaryService for MakeVolumeSvc { type Response = super::MakeVolumeResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::make_volume(&inner, request).await - }; + let fut = async move { ::make_volume(&inner, request).await }; Box::pin(fut) } } @@ -4539,14 +3250,8 @@ pub mod node_service_server { let method = MakeVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4555,23 +3260,12 @@ pub mod node_service_server { "/node_service.NodeService/ListVolumes" => { #[allow(non_camel_case_types)] struct ListVolumesSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ListVolumesSvc { + impl tonic::server::UnaryService for ListVolumesSvc { type Response = super::ListVolumesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::list_volumes(&inner, request).await - }; + let fut = async move { ::list_volumes(&inner, request).await }; Box::pin(fut) } } @@ -4584,14 +3278,8 @@ pub mod node_service_server { let method = ListVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4600,23 +3288,12 @@ pub mod node_service_server { "/node_service.NodeService/StatVolume" => { #[allow(non_camel_case_types)] struct StatVolumeSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for StatVolumeSvc { + impl tonic::server::UnaryService for StatVolumeSvc { type Response = super::StatVolumeResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::stat_volume(&inner, request).await - }; + let fut = async move { ::stat_volume(&inner, request).await }; Box::pin(fut) } } @@ -4629,14 +3306,8 @@ pub mod node_service_server { let method = StatVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4645,23 +3316,12 @@ pub mod node_service_server { "/node_service.NodeService/DeletePaths" => { #[allow(non_camel_case_types)] struct DeletePathsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeletePathsSvc { + impl tonic::server::UnaryService for DeletePathsSvc { type Response = super::DeletePathsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_paths(&inner, request).await - }; + let fut = async move { ::delete_paths(&inner, request).await }; Box::pin(fut) } } @@ -4674,14 +3334,8 @@ pub mod node_service_server { let method = DeletePathsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4690,23 +3344,12 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetadata" => { #[allow(non_camel_case_types)] struct UpdateMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for UpdateMetadataSvc { + impl tonic::server::UnaryService for UpdateMetadataSvc { type Response = super::UpdateMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::update_metadata(&inner, request).await - }; + let fut = async move { ::update_metadata(&inner, request).await }; Box::pin(fut) } } @@ -4719,14 +3362,8 @@ pub mod node_service_server { let method = UpdateMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4735,23 +3372,12 @@ pub mod node_service_server { "/node_service.NodeService/WriteMetadata" => { #[allow(non_camel_case_types)] struct WriteMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for WriteMetadataSvc { + impl tonic::server::UnaryService for WriteMetadataSvc { type Response = super::WriteMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write_metadata(&inner, request).await - }; + let fut = async move { ::write_metadata(&inner, request).await }; Box::pin(fut) } } @@ -4764,14 +3390,8 @@ pub mod node_service_server { let method = WriteMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4780,23 +3400,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadVersion" => { #[allow(non_camel_case_types)] struct ReadVersionSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadVersionSvc { + impl tonic::server::UnaryService for ReadVersionSvc { type Response = super::ReadVersionResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_version(&inner, request).await - }; + let fut = async move { ::read_version(&inner, request).await }; Box::pin(fut) } } @@ -4809,14 +3418,8 @@ pub mod node_service_server { let method = ReadVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4825,23 +3428,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadXL" => { #[allow(non_camel_case_types)] struct ReadXLSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadXLSvc { + impl tonic::server::UnaryService for ReadXLSvc { type Response = super::ReadXlResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_xl(&inner, request).await - }; + let fut = async move { ::read_xl(&inner, request).await }; Box::pin(fut) } } @@ -4854,14 +3446,8 @@ pub mod node_service_server { let method = ReadXLSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4870,23 +3456,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersion" => { #[allow(non_camel_case_types)] struct DeleteVersionSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteVersionSvc { + impl tonic::server::UnaryService for DeleteVersionSvc { type Response = super::DeleteVersionResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_version(&inner, request).await - }; + let fut = async move { ::delete_version(&inner, request).await }; Box::pin(fut) } } @@ -4899,14 +3474,8 @@ pub mod node_service_server { let method = DeleteVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4915,23 +3484,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersions" => { #[allow(non_camel_case_types)] struct DeleteVersionsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteVersionsSvc { + impl tonic::server::UnaryService for DeleteVersionsSvc { type Response = super::DeleteVersionsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_versions(&inner, request).await - }; + let fut = async move { ::delete_versions(&inner, request).await }; Box::pin(fut) } } @@ -4944,14 +3502,8 @@ pub mod node_service_server { let method = DeleteVersionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4960,23 +3512,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadMultiple" => { #[allow(non_camel_case_types)] struct ReadMultipleSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadMultipleSvc { + impl tonic::server::UnaryService for ReadMultipleSvc { type Response = super::ReadMultipleResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_multiple(&inner, request).await - }; + let fut = async move { ::read_multiple(&inner, request).await }; Box::pin(fut) } } @@ -4989,14 +3530,8 @@ pub mod node_service_server { let method = ReadMultipleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5005,23 +3540,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVolume" => { #[allow(non_camel_case_types)] struct DeleteVolumeSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteVolumeSvc { + impl tonic::server::UnaryService for DeleteVolumeSvc { type Response = super::DeleteVolumeResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_volume(&inner, request).await - }; + let fut = async move { ::delete_volume(&inner, request).await }; Box::pin(fut) } } @@ -5034,14 +3558,8 @@ pub mod node_service_server { let method = DeleteVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5050,23 +3568,12 @@ pub mod node_service_server { "/node_service.NodeService/DiskInfo" => { #[allow(non_camel_case_types)] struct DiskInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DiskInfoSvc { + impl tonic::server::UnaryService for DiskInfoSvc { type Response = super::DiskInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::disk_info(&inner, request).await - }; + let fut = async move { ::disk_info(&inner, request).await }; Box::pin(fut) } } @@ -5079,14 +3586,8 @@ pub mod node_service_server { let method = DiskInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5095,26 +3596,13 @@ pub mod node_service_server { "/node_service.NodeService/NsScanner" => { #[allow(non_camel_case_types)] struct NsScannerSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::StreamingService - for NsScannerSvc { + impl tonic::server::StreamingService for NsScannerSvc { type Response = super::NsScannerResponse; type ResponseStream = T::NsScannerStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request>) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::ns_scanner(&inner, request).await - }; + let fut = async move { ::ns_scanner(&inner, request).await }; Box::pin(fut) } } @@ -5127,14 +3615,8 @@ pub mod node_service_server { let method = NsScannerSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -5143,23 +3625,12 @@ pub mod node_service_server { "/node_service.NodeService/Lock" => { #[allow(non_camel_case_types)] struct LockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LockSvc { + impl tonic::server::UnaryService for LockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::lock(&inner, request).await - }; + let fut = async move { ::lock(&inner, request).await }; Box::pin(fut) } } @@ -5172,14 +3643,8 @@ pub mod node_service_server { let method = LockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5188,23 +3653,12 @@ pub mod node_service_server { "/node_service.NodeService/UnLock" => { #[allow(non_camel_case_types)] struct UnLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for UnLockSvc { + impl tonic::server::UnaryService for UnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::un_lock(&inner, request).await - }; + let fut = async move { ::un_lock(&inner, request).await }; Box::pin(fut) } } @@ -5217,14 +3671,8 @@ pub mod node_service_server { let method = UnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5233,23 +3681,12 @@ pub mod node_service_server { "/node_service.NodeService/RLock" => { #[allow(non_camel_case_types)] struct RLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RLockSvc { + impl tonic::server::UnaryService for RLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::r_lock(&inner, request).await - }; + let fut = async move { ::r_lock(&inner, request).await }; Box::pin(fut) } } @@ -5262,14 +3699,8 @@ pub mod node_service_server { let method = RLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5278,23 +3709,12 @@ pub mod node_service_server { "/node_service.NodeService/RUnLock" => { #[allow(non_camel_case_types)] struct RUnLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RUnLockSvc { + impl tonic::server::UnaryService for RUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::r_un_lock(&inner, request).await - }; + let fut = async move { ::r_un_lock(&inner, request).await }; Box::pin(fut) } } @@ -5307,14 +3727,8 @@ pub mod node_service_server { let method = RUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5323,23 +3737,12 @@ pub mod node_service_server { "/node_service.NodeService/ForceUnLock" => { #[allow(non_camel_case_types)] struct ForceUnLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ForceUnLockSvc { + impl tonic::server::UnaryService for ForceUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::force_un_lock(&inner, request).await - }; + let fut = async move { ::force_un_lock(&inner, request).await }; Box::pin(fut) } } @@ -5352,14 +3755,8 @@ pub mod node_service_server { let method = ForceUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5368,23 +3765,12 @@ pub mod node_service_server { "/node_service.NodeService/Refresh" => { #[allow(non_camel_case_types)] struct RefreshSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RefreshSvc { + impl tonic::server::UnaryService for RefreshSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::refresh(&inner, request).await - }; + let fut = async move { ::refresh(&inner, request).await }; Box::pin(fut) } } @@ -5397,14 +3783,8 @@ pub mod node_service_server { let method = RefreshSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5413,24 +3793,12 @@ pub mod node_service_server { "/node_service.NodeService/LocalStorageInfo" => { #[allow(non_camel_case_types)] struct LocalStorageInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LocalStorageInfoSvc { + impl tonic::server::UnaryService for LocalStorageInfoSvc { type Response = super::LocalStorageInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::local_storage_info(&inner, request) - .await - }; + let fut = async move { ::local_storage_info(&inner, request).await }; Box::pin(fut) } } @@ -5443,14 +3811,8 @@ pub mod node_service_server { let method = LocalStorageInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5459,23 +3821,12 @@ pub mod node_service_server { "/node_service.NodeService/ServerInfo" => { #[allow(non_camel_case_types)] struct ServerInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ServerInfoSvc { + impl tonic::server::UnaryService for ServerInfoSvc { type Response = super::ServerInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::server_info(&inner, request).await - }; + let fut = async move { ::server_info(&inner, request).await }; Box::pin(fut) } } @@ -5488,14 +3839,8 @@ pub mod node_service_server { let method = ServerInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5504,23 +3849,12 @@ pub mod node_service_server { "/node_service.NodeService/GetCpus" => { #[allow(non_camel_case_types)] struct GetCpusSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetCpusSvc { + impl tonic::server::UnaryService for GetCpusSvc { type Response = super::GetCpusResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_cpus(&inner, request).await - }; + let fut = async move { ::get_cpus(&inner, request).await }; Box::pin(fut) } } @@ -5533,14 +3867,8 @@ pub mod node_service_server { let method = GetCpusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5549,23 +3877,12 @@ pub mod node_service_server { "/node_service.NodeService/GetNetInfo" => { #[allow(non_camel_case_types)] struct GetNetInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetNetInfoSvc { + impl tonic::server::UnaryService for GetNetInfoSvc { type Response = super::GetNetInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_net_info(&inner, request).await - }; + let fut = async move { ::get_net_info(&inner, request).await }; Box::pin(fut) } } @@ -5578,14 +3895,8 @@ pub mod node_service_server { let method = GetNetInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5594,23 +3905,12 @@ pub mod node_service_server { "/node_service.NodeService/GetPartitions" => { #[allow(non_camel_case_types)] struct GetPartitionsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetPartitionsSvc { + impl tonic::server::UnaryService for GetPartitionsSvc { type Response = super::GetPartitionsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_partitions(&inner, request).await - }; + let fut = async move { ::get_partitions(&inner, request).await }; Box::pin(fut) } } @@ -5623,14 +3923,8 @@ pub mod node_service_server { let method = GetPartitionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5639,23 +3933,12 @@ pub mod node_service_server { "/node_service.NodeService/GetOsInfo" => { #[allow(non_camel_case_types)] struct GetOsInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetOsInfoSvc { + impl tonic::server::UnaryService for GetOsInfoSvc { type Response = super::GetOsInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_os_info(&inner, request).await - }; + let fut = async move { ::get_os_info(&inner, request).await }; Box::pin(fut) } } @@ -5668,14 +3951,8 @@ pub mod node_service_server { let method = GetOsInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5684,23 +3961,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSELinuxInfo" => { #[allow(non_camel_case_types)] struct GetSELinuxInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSELinuxInfoSvc { + impl tonic::server::UnaryService for GetSELinuxInfoSvc { type Response = super::GetSeLinuxInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_se_linux_info(&inner, request).await - }; + let fut = async move { ::get_se_linux_info(&inner, request).await }; Box::pin(fut) } } @@ -5713,14 +3979,8 @@ pub mod node_service_server { let method = GetSELinuxInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5729,23 +3989,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSysConfig" => { #[allow(non_camel_case_types)] struct GetSysConfigSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSysConfigSvc { + impl tonic::server::UnaryService for GetSysConfigSvc { type Response = super::GetSysConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_sys_config(&inner, request).await - }; + let fut = async move { ::get_sys_config(&inner, request).await }; Box::pin(fut) } } @@ -5758,14 +4007,8 @@ pub mod node_service_server { let method = GetSysConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5774,23 +4017,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSysErrors" => { #[allow(non_camel_case_types)] struct GetSysErrorsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSysErrorsSvc { + impl tonic::server::UnaryService for GetSysErrorsSvc { type Response = super::GetSysErrorsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_sys_errors(&inner, request).await - }; + let fut = async move { ::get_sys_errors(&inner, request).await }; Box::pin(fut) } } @@ -5803,14 +4035,8 @@ pub mod node_service_server { let method = GetSysErrorsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5819,23 +4045,12 @@ pub mod node_service_server { "/node_service.NodeService/GetMemInfo" => { #[allow(non_camel_case_types)] struct GetMemInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetMemInfoSvc { + impl tonic::server::UnaryService for GetMemInfoSvc { type Response = super::GetMemInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_mem_info(&inner, request).await - }; + let fut = async move { ::get_mem_info(&inner, request).await }; Box::pin(fut) } } @@ -5848,14 +4063,8 @@ pub mod node_service_server { let method = GetMemInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5864,23 +4073,12 @@ pub mod node_service_server { "/node_service.NodeService/GetMetrics" => { #[allow(non_camel_case_types)] struct GetMetricsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetMetricsSvc { + impl tonic::server::UnaryService for GetMetricsSvc { type Response = super::GetMetricsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_metrics(&inner, request).await - }; + let fut = async move { ::get_metrics(&inner, request).await }; Box::pin(fut) } } @@ -5893,14 +4091,8 @@ pub mod node_service_server { let method = GetMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5909,23 +4101,12 @@ pub mod node_service_server { "/node_service.NodeService/GetProcInfo" => { #[allow(non_camel_case_types)] struct GetProcInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetProcInfoSvc { + impl tonic::server::UnaryService for GetProcInfoSvc { type Response = super::GetProcInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_proc_info(&inner, request).await - }; + let fut = async move { ::get_proc_info(&inner, request).await }; Box::pin(fut) } } @@ -5938,14 +4119,8 @@ pub mod node_service_server { let method = GetProcInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5954,23 +4129,12 @@ pub mod node_service_server { "/node_service.NodeService/StartProfiling" => { #[allow(non_camel_case_types)] struct StartProfilingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for StartProfilingSvc { + impl tonic::server::UnaryService for StartProfilingSvc { type Response = super::StartProfilingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::start_profiling(&inner, request).await - }; + let fut = async move { ::start_profiling(&inner, request).await }; Box::pin(fut) } } @@ -5983,14 +4147,8 @@ pub mod node_service_server { let method = StartProfilingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5999,24 +4157,12 @@ pub mod node_service_server { "/node_service.NodeService/DownloadProfileData" => { #[allow(non_camel_case_types)] struct DownloadProfileDataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DownloadProfileDataSvc { + impl tonic::server::UnaryService for DownloadProfileDataSvc { type Response = super::DownloadProfileDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::download_profile_data(&inner, request) - .await - }; + let fut = async move { ::download_profile_data(&inner, request).await }; Box::pin(fut) } } @@ -6029,14 +4175,8 @@ pub mod node_service_server { let method = DownloadProfileDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6045,23 +4185,12 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketStats" => { #[allow(non_camel_case_types)] struct GetBucketStatsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetBucketStatsSvc { + impl tonic::server::UnaryService for GetBucketStatsSvc { type Response = super::GetBucketStatsDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_bucket_stats(&inner, request).await - }; + let fut = async move { ::get_bucket_stats(&inner, request).await }; Box::pin(fut) } } @@ -6074,14 +4203,8 @@ pub mod node_service_server { let method = GetBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6090,23 +4213,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSRMetrics" => { #[allow(non_camel_case_types)] struct GetSRMetricsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSRMetricsSvc { + impl tonic::server::UnaryService for GetSRMetricsSvc { type Response = super::GetSrMetricsDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_sr_metrics(&inner, request).await - }; + let fut = async move { ::get_sr_metrics(&inner, request).await }; Box::pin(fut) } } @@ -6119,14 +4231,8 @@ pub mod node_service_server { let method = GetSRMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6135,24 +4241,12 @@ pub mod node_service_server { "/node_service.NodeService/GetAllBucketStats" => { #[allow(non_camel_case_types)] struct GetAllBucketStatsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetAllBucketStatsSvc { + impl tonic::server::UnaryService for GetAllBucketStatsSvc { type Response = super::GetAllBucketStatsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_all_bucket_stats(&inner, request) - .await - }; + let fut = async move { ::get_all_bucket_stats(&inner, request).await }; Box::pin(fut) } } @@ -6165,14 +4259,8 @@ pub mod node_service_server { let method = GetAllBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6181,24 +4269,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadBucketMetadata" => { #[allow(non_camel_case_types)] struct LoadBucketMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadBucketMetadataSvc { + impl tonic::server::UnaryService for LoadBucketMetadataSvc { type Response = super::LoadBucketMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_bucket_metadata(&inner, request) - .await - }; + let fut = async move { ::load_bucket_metadata(&inner, request).await }; Box::pin(fut) } } @@ -6211,14 +4287,8 @@ pub mod node_service_server { let method = LoadBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6227,24 +4297,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucketMetadata" => { #[allow(non_camel_case_types)] struct DeleteBucketMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteBucketMetadataSvc { + impl tonic::server::UnaryService for DeleteBucketMetadataSvc { type Response = super::DeleteBucketMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_bucket_metadata(&inner, request) - .await - }; + let fut = async move { ::delete_bucket_metadata(&inner, request).await }; Box::pin(fut) } } @@ -6257,14 +4315,8 @@ pub mod node_service_server { let method = DeleteBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6273,23 +4325,12 @@ pub mod node_service_server { "/node_service.NodeService/DeletePolicy" => { #[allow(non_camel_case_types)] struct DeletePolicySvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeletePolicySvc { + impl tonic::server::UnaryService for DeletePolicySvc { type Response = super::DeletePolicyResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_policy(&inner, request).await - }; + let fut = async move { ::delete_policy(&inner, request).await }; Box::pin(fut) } } @@ -6302,14 +4343,8 @@ pub mod node_service_server { let method = DeletePolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6318,23 +4353,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicy" => { #[allow(non_camel_case_types)] struct LoadPolicySvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadPolicySvc { + impl tonic::server::UnaryService for LoadPolicySvc { type Response = super::LoadPolicyResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_policy(&inner, request).await - }; + let fut = async move { ::load_policy(&inner, request).await }; Box::pin(fut) } } @@ -6347,14 +4371,8 @@ pub mod node_service_server { let method = LoadPolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6363,24 +4381,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicyMapping" => { #[allow(non_camel_case_types)] struct LoadPolicyMappingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadPolicyMappingSvc { + impl tonic::server::UnaryService for LoadPolicyMappingSvc { type Response = super::LoadPolicyMappingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_policy_mapping(&inner, request) - .await - }; + let fut = async move { ::load_policy_mapping(&inner, request).await }; Box::pin(fut) } } @@ -6393,14 +4399,8 @@ pub mod node_service_server { let method = LoadPolicyMappingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6409,23 +4409,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteUser" => { #[allow(non_camel_case_types)] struct DeleteUserSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteUserSvc { + impl tonic::server::UnaryService for DeleteUserSvc { type Response = super::DeleteUserResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_user(&inner, request).await - }; + let fut = async move { ::delete_user(&inner, request).await }; Box::pin(fut) } } @@ -6438,14 +4427,8 @@ pub mod node_service_server { let method = DeleteUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6454,24 +4437,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteServiceAccount" => { #[allow(non_camel_case_types)] struct DeleteServiceAccountSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteServiceAccountSvc { + impl tonic::server::UnaryService for DeleteServiceAccountSvc { type Response = super::DeleteServiceAccountResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_service_account(&inner, request) - .await - }; + let fut = async move { ::delete_service_account(&inner, request).await }; Box::pin(fut) } } @@ -6484,14 +4455,8 @@ pub mod node_service_server { let method = DeleteServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6500,23 +4465,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadUser" => { #[allow(non_camel_case_types)] struct LoadUserSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadUserSvc { + impl tonic::server::UnaryService for LoadUserSvc { type Response = super::LoadUserResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_user(&inner, request).await - }; + let fut = async move { ::load_user(&inner, request).await }; Box::pin(fut) } } @@ -6529,14 +4483,8 @@ pub mod node_service_server { let method = LoadUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6545,24 +4493,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadServiceAccount" => { #[allow(non_camel_case_types)] struct LoadServiceAccountSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadServiceAccountSvc { + impl tonic::server::UnaryService for LoadServiceAccountSvc { type Response = super::LoadServiceAccountResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_service_account(&inner, request) - .await - }; + let fut = async move { ::load_service_account(&inner, request).await }; Box::pin(fut) } } @@ -6575,14 +4511,8 @@ pub mod node_service_server { let method = LoadServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6591,23 +4521,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadGroup" => { #[allow(non_camel_case_types)] struct LoadGroupSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadGroupSvc { + impl tonic::server::UnaryService for LoadGroupSvc { type Response = super::LoadGroupResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_group(&inner, request).await - }; + let fut = async move { ::load_group(&inner, request).await }; Box::pin(fut) } } @@ -6620,14 +4539,8 @@ pub mod node_service_server { let method = LoadGroupSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6636,30 +4549,14 @@ pub mod node_service_server { "/node_service.NodeService/ReloadSiteReplicationConfig" => { #[allow(non_camel_case_types)] struct ReloadSiteReplicationConfigSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService< - super::ReloadSiteReplicationConfigRequest, - > for ReloadSiteReplicationConfigSvc { + impl tonic::server::UnaryService + for ReloadSiteReplicationConfigSvc + { type Response = super::ReloadSiteReplicationConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::ReloadSiteReplicationConfigRequest, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::reload_site_replication_config( - &inner, - request, - ) - .await - }; + let fut = async move { ::reload_site_replication_config(&inner, request).await }; Box::pin(fut) } } @@ -6672,14 +4569,8 @@ pub mod node_service_server { let method = ReloadSiteReplicationConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6688,23 +4579,12 @@ pub mod node_service_server { "/node_service.NodeService/SignalService" => { #[allow(non_camel_case_types)] struct SignalServiceSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for SignalServiceSvc { + impl tonic::server::UnaryService for SignalServiceSvc { type Response = super::SignalServiceResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::signal_service(&inner, request).await - }; + let fut = async move { ::signal_service(&inner, request).await }; Box::pin(fut) } } @@ -6717,14 +4597,8 @@ pub mod node_service_server { let method = SignalServiceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6733,24 +4607,12 @@ pub mod node_service_server { "/node_service.NodeService/BackgroundHealStatus" => { #[allow(non_camel_case_types)] struct BackgroundHealStatusSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for BackgroundHealStatusSvc { + impl tonic::server::UnaryService for BackgroundHealStatusSvc { type Response = super::BackgroundHealStatusResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::background_heal_status(&inner, request) - .await - }; + let fut = async move { ::background_heal_status(&inner, request).await }; Box::pin(fut) } } @@ -6763,14 +4625,8 @@ pub mod node_service_server { let method = BackgroundHealStatusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6779,24 +4635,12 @@ pub mod node_service_server { "/node_service.NodeService/GetMetacacheListing" => { #[allow(non_camel_case_types)] struct GetMetacacheListingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetMetacacheListingSvc { + impl tonic::server::UnaryService for GetMetacacheListingSvc { type Response = super::GetMetacacheListingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_metacache_listing(&inner, request) - .await - }; + let fut = async move { ::get_metacache_listing(&inner, request).await }; Box::pin(fut) } } @@ -6809,14 +4653,8 @@ pub mod node_service_server { let method = GetMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6825,27 +4663,12 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetacacheListing" => { #[allow(non_camel_case_types)] struct UpdateMetacacheListingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for UpdateMetacacheListingSvc { + impl tonic::server::UnaryService for UpdateMetacacheListingSvc { type Response = super::UpdateMetacacheListingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::update_metacache_listing( - &inner, - request, - ) - .await - }; + let fut = async move { ::update_metacache_listing(&inner, request).await }; Box::pin(fut) } } @@ -6858,14 +4681,8 @@ pub mod node_service_server { let method = UpdateMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6874,23 +4691,12 @@ pub mod node_service_server { "/node_service.NodeService/ReloadPoolMeta" => { #[allow(non_camel_case_types)] struct ReloadPoolMetaSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReloadPoolMetaSvc { + impl tonic::server::UnaryService for ReloadPoolMetaSvc { type Response = super::ReloadPoolMetaResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::reload_pool_meta(&inner, request).await - }; + let fut = async move { ::reload_pool_meta(&inner, request).await }; Box::pin(fut) } } @@ -6903,14 +4709,8 @@ pub mod node_service_server { let method = ReloadPoolMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6919,23 +4719,12 @@ pub mod node_service_server { "/node_service.NodeService/StopRebalance" => { #[allow(non_camel_case_types)] struct StopRebalanceSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for StopRebalanceSvc { + impl tonic::server::UnaryService for StopRebalanceSvc { type Response = super::StopRebalanceResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::stop_rebalance(&inner, request).await - }; + let fut = async move { ::stop_rebalance(&inner, request).await }; Box::pin(fut) } } @@ -6948,14 +4737,8 @@ pub mod node_service_server { let method = StopRebalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6964,24 +4747,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadRebalanceMeta" => { #[allow(non_camel_case_types)] struct LoadRebalanceMetaSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadRebalanceMetaSvc { + impl tonic::server::UnaryService for LoadRebalanceMetaSvc { type Response = super::LoadRebalanceMetaResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_rebalance_meta(&inner, request) - .await - }; + let fut = async move { ::load_rebalance_meta(&inner, request).await }; Box::pin(fut) } } @@ -6994,14 +4765,8 @@ pub mod node_service_server { let method = LoadRebalanceMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -7010,29 +4775,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadTransitionTierConfig" => { #[allow(non_camel_case_types)] struct LoadTransitionTierConfigSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadTransitionTierConfigSvc { + impl tonic::server::UnaryService for LoadTransitionTierConfigSvc { type Response = super::LoadTransitionTierConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::LoadTransitionTierConfigRequest, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_transition_tier_config( - &inner, - request, - ) - .await - }; + let fut = async move { ::load_transition_tier_config(&inner, request).await }; Box::pin(fut) } } @@ -7045,36 +4793,20 @@ pub mod node_service_server { let method = LoadTransitionTierConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } - _ => { - Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers - .insert( - tonic::Status::GRPC_STATUS, - (tonic::Code::Unimplemented as i32).into(), - ); - headers - .insert( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ); - Ok(response) - }) - } + _ => Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers.insert(tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into()); + headers.insert(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE); + Ok(response) + }), } } } From dd089200aba58cf01471a6e815fa752b936169a9 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 11:15:49 +0800 Subject: [PATCH 32/77] clippy --- ecstore/src/disk/local.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 8ab0f6ee0..2c44ca105 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -62,7 +62,7 @@ use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{error, info, warn}; +use tracing::{info, warn}; use uuid::Uuid; #[derive(Debug)] From 1c4e41598ca8abc946c31c889a46368d2008b67e Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 13 Dec 2024 16:14:57 +0800 Subject: [PATCH 33/77] test --- ecstore/src/disk/local.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 2c44ca105..06477765c 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -2418,7 +2418,11 @@ mod test { #[tokio::test] async fn test_walk_dir() { - let ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + ep.pool_idx = 0; + ep.set_idx = 0; + ep.disk_idx = 0; + let disk = match LocalDisk::new(&ep, false).await { Ok(res) => res, Err(err) => { From caae9a92a12b93ff1d0fc85b8bd185a8ff45d940 Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 13 Dec 2024 17:13:32 +0800 Subject: [PATCH 34/77] test work_dir done --- ecstore/src/disk/local.rs | 29 ++++++++++------------------- ecstore/src/metacache/writer.rs | 2 -- ecstore/src/utils/path.rs | 27 +++++++++++++++++++++++++++ scripts/run.sh | 4 ++-- 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 06477765c..7a11bb5b8 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -37,7 +37,7 @@ use crate::set_disk::{ use crate::store_api::{BitrotAlgorithm, StorageAPI}; use crate::utils::fs::{access, lstat, O_APPEND, O_CREATE, O_RDONLY, O_WRONLY}; use crate::utils::os::get_info; -use crate::utils::path::{clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; +use crate::utils::path::{self, clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; use crate::{ file_meta::FileMeta, store_api::{FileInfo, RawFileInfo}, @@ -740,26 +740,19 @@ impl LocalDisk { return Ok(()); } - println!("list_dir opts {} {}", &opts.bucket, &opts.base_dir); - - let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { + let mut entries = match self.list_dir("", &opts.bucket, current, -1).await { Ok(res) => res, Err(e) => { - println!("list_dir err {:?}", &e); - if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { - info!("list_dir err {:?}", &e); - } + if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) {} - if opts.report_notfound && is_err_file_not_found(&e) { - return Err(e); + if opts.report_notfound && is_err_file_not_found(&e) && current == &opts.base_dir { + return Err(Error::new(DiskError::FileNotFound)); } return Ok(()); } }; - println!("list_dir entries {:?}", &entries); - if entries.is_empty() { return Ok(()); } @@ -848,7 +841,7 @@ impl LocalDisk { continue; } - let name = format!("{}{}", current, entry); + let name = path::path_join_buf(&[current, &entry]); if !dir_stack.is_empty() { if let Some(pop) = dir_stack.pop() { @@ -882,10 +875,9 @@ impl LocalDisk { meta.name.push_str(GLOBAL_DIR_SUFFIX_WITH_SLASH); } - match self - .read_metadata(self.get_object_path(&opts.bucket, format!("{}/{}", &meta.name, FORMAT_CONFIG_FILE).as_str())?) - .await - { + let fname = format!("{}/{}", &meta.name, STORAGE_FORMAT_FILE); + + match self.read_metadata(self.get_object_path(&opts.bucket, fname.as_str())?).await { Ok(res) => { if is_dir_obj { meta.name = meta.name.trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH).to_owned(); @@ -898,7 +890,6 @@ impl LocalDisk { *objs_returned += 1; } Err(err) => { - warn!("scan dir read_metadata err {:?}", err); if let Some(e) = err.downcast_ref::() { if os_is_not_exist(e) || is_sys_err_is_dir(e) { // NOT an object, append to stack (with slash) @@ -928,6 +919,7 @@ impl LocalDisk { if opts.recursive { let mut dir = dir; + if let Err(er) = Box::pin(self.scan_dir(&mut dir, opts, out, objs_returned)).await { warn!("scan_dir err {:?}", &er); } @@ -2441,7 +2433,6 @@ mod test { let opts = WalkDirOptions { bucket: "dada".to_owned(), - // base_dir: "dada".to_owned(), recursive: true, ..Default::default() }; diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 0ce58d9a5..cc23cf6ec 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -54,8 +54,6 @@ impl MetacacheWriter { } pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { - println!("write_obj {:?}", &obj); - self.init()?; rmp::encode::write_bool(&mut self.wr, true)?; diff --git a/ecstore/src/utils/path.rs b/ecstore/src/utils/path.rs index cd538bc07..9f2c22a08 100644 --- a/ecstore/src/utils/path.rs +++ b/ecstore/src/utils/path.rs @@ -1,3 +1,4 @@ +use std::path::Path; use std::path::PathBuf; const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; @@ -69,6 +70,32 @@ pub fn path_join(elem: &[PathBuf]) -> PathBuf { joined_path } +pub fn path_join_buf(elements: &[&str]) -> String { + let trailing_slash = !elements.is_empty() && elements.last().unwrap().ends_with('/'); + + let mut dst = String::new(); + let mut added = 0; + + for e in elements { + if added > 0 || !e.is_empty() { + if added > 0 { + dst.push('/'); + } + dst.push_str(e); + added += e.len(); + } + } + + let result = dst.to_string(); + let cpath = Path::new(&result).components().collect::(); + let clean_path = cpath.to_string_lossy(); + + if trailing_slash { + return format!("{}/", clean_path); + } + clean_path.to_string() +} + pub fn path_to_bucket_object_with_base_path(bash_path: &str, path: &str) -> (String, String) { let path = path.trim_start_matches(bash_path).trim_start_matches(SLASH_SEPARATOR); if let Some(m) = path.find(SLASH_SEPARATOR) { diff --git a/scripts/run.sh b/scripts/run.sh index 5b1326e6a..4f1942d12 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -18,8 +18,8 @@ fi export RUSTFS_STORAGE_CLASS_INLINE_BLOCK="512 KB" -DATA_DIR_ARG="./target/volume/test{0...4}" -# DATA_DIR_ARG="./target/volume/test" +# DATA_DIR_ARG="./target/volume/test{0...4}" +DATA_DIR_ARG="./target/volume/test" if [ -n "$1" ]; then DATA_DIR_ARG="$1" From e7b6a17e421870b1b772e9adcc5524cbd8bd0b04 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 09:29:44 +0800 Subject: [PATCH 35/77] test metacache --- ecstore/src/disk/local.rs | 8 +++++++- ecstore/src/io.rs | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 7a11bb5b8..aac07a218 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -2325,8 +2325,10 @@ async fn get_disk_info(drive_path: PathBuf) -> Result<(Info, bool)> { #[cfg(test)] mod test { + use tokio::io::BufWriter; use utils::fs::open_file; use utils::fs::O_RDWR; + use utils::fs::O_TRUNC; use super::*; @@ -2423,7 +2425,7 @@ mod test { } }; - let mut f = match open_file("./testfile.txt", O_CREATE | O_RDWR).await { + let f = match open_file("./testfile.txt", O_CREATE | O_RDWR | O_TRUNC).await { Ok(res) => res, Err(err) => { println!("openfile err {:?}", err); @@ -2431,6 +2433,8 @@ mod test { } }; + let buf = BufWriter::new(Vec::new()); + let opts = WalkDirOptions { bucket: "dada".to_owned(), recursive: true, @@ -2439,5 +2443,7 @@ mod test { if let Err(err) = disk.walk_dir(opts, crate::io::Writer::File(f)).await { println!("walk_dir err {:?}", err); } + + MetacacheReader::new() } } diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index cdaabaebc..a4d9c3cc1 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -3,6 +3,8 @@ use std::io::Write; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::fs::File; +use tokio::io::BufReader; +use tokio::io::BufWriter; use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; #[derive(Default)] @@ -10,6 +12,7 @@ pub enum Reader { #[default] NotUse, File(File), + Buffer(BufReader>), } impl AsyncRead for Reader { @@ -19,6 +22,9 @@ impl AsyncRead for Reader { let file = Pin::new(file); file.poll_read(cx, buf) } + Reader::Buffer(buffer) => { + todo!() + } Reader::NotUse => Poll::Ready(Ok(())), } } @@ -29,36 +35,30 @@ pub enum Writer { #[default] NotUse, File(File), + Buffer(BufWriter>), } impl AsyncWrite for Writer { fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { match self.get_mut() { - Writer::File(file) => { - // Create a pinned reference from the file - let file = Pin::new(file); - file.poll_write(cx, buf) - } + Writer::File(file) => Pin::new(file).poll_write(cx, buf), + Writer::Buffer(buff) => Pin::new(buff).poll_write(cx, buf), Writer::NotUse => Poll::Ready(Ok(0)), } } fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match self.get_mut() { - Writer::File(file) => { - let file = Pin::new(file); - file.poll_flush(cx) - } + Writer::File(file) => Pin::new(file).poll_flush(cx), + Writer::Buffer(buff) => Pin::new(buff).poll_flush(cx), Writer::NotUse => Poll::Ready(Ok(())), } } fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match self.get_mut() { - Writer::File(file) => { - let file = Pin::new(file); - file.poll_shutdown(cx) - } + Writer::File(file) => Pin::new(file).poll_shutdown(cx), + Writer::Buffer(buff) => Pin::new(buff).poll_shutdown(cx), Writer::NotUse => Poll::Ready(Ok(())), } } From 245e57de630904479f9481cc73e7c6bd6dd1dccc Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 17:45:28 +0800 Subject: [PATCH 36/77] test metawrite --- ecstore/src/cache_value/metacache_set.rs | 4 +- ecstore/src/disk/local.rs | 66 ++++--- ecstore/src/disk/mod.rs | 6 +- ecstore/src/disk/remote.rs | 7 +- ecstore/src/io.rs | 15 +- ecstore/src/metacache/writer.rs | 229 +++++++++++++++-------- ecstore/src/set_disk.rs | 2 +- rustfs/src/grpc.rs | 2 +- 8 files changed, 210 insertions(+), 121 deletions(-) diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index 4e2bbe579..a7ed75af0 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -89,7 +89,7 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - limit: opts_clone.per_disk_limit, ..Default::default() }, - Writer::NotUse, + &mut Writer::NotUse, ) .await { @@ -130,7 +130,7 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - limit: opts_clone.per_disk_limit, ..Default::default() }, - Writer::NotUse, + &mut Writer::NotUse, ) .await { diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index aac07a218..5a8979bb4 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -59,10 +59,10 @@ use std::{ }; use time::OffsetDateTime; use tokio::fs::{self, File}; -use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; +use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{info, warn}; +use tracing::{error, info, warn}; use uuid::Uuid; #[derive(Debug)] @@ -716,7 +716,7 @@ impl LocalDisk { bitrot_verify(&mut Cursor::new(data), n, part_size, algo, sum.to_vec(), shard_size) } - async fn scan_dir( + async fn scan_dir( &self, current: &mut String, opts: &WalkDirOptions, @@ -810,7 +810,8 @@ impl LocalDisk { name, metadata, ..Default::default() - })?; + }) + .await?; *objs_returned += 1; return Ok(()); } @@ -850,7 +851,8 @@ impl LocalDisk { out.write_obj(&MetaCacheEntry { name: pop, ..Default::default() - })?; + }) + .await?; if opts.recursive { if let Err(er) = Box::pin(self.scan_dir(current, opts, out, objs_returned)).await { @@ -886,7 +888,7 @@ impl LocalDisk { meta.metadata = res; - out.write_obj(&meta)?; + out.write_obj(&meta).await?; *objs_returned += 1; } Err(err) => { @@ -914,7 +916,8 @@ impl LocalDisk { out.write_obj(&MetaCacheEntry { name: dir.clone(), ..Default::default() - })?; + }) + .await?; *objs_returned += 1; if opts.recursive { @@ -1511,7 +1514,7 @@ impl DiskAPI for LocalDisk { // FIXME: TODO: io.writer TODO cancel #[tracing::instrument(level = "debug", skip(self, wr))] - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result> { // warn!("walk_dir opts {:?}", &opts); let volume_dir = self.get_bucket_path(&opts.bucket)?; @@ -1524,7 +1527,7 @@ impl DiskAPI for LocalDisk { let mut wr = wr; - let mut out = MetacacheWriter::new(AsyncToSync::new_writer(&mut wr)); + let mut out = MetacacheWriter::new(&mut wr); let mut objs_returned = 0; @@ -1539,7 +1542,7 @@ impl DiskAPI for LocalDisk { metadata: data, ..Default::default() }; - out.write_obj(&meta)?; + out.write_obj(&meta).await?; objs_returned += 1; } } @@ -2330,6 +2333,10 @@ mod test { use utils::fs::O_RDWR; use utils::fs::O_TRUNC; + use crate::io::VecAsyncReader; + use crate::io::VecAsyncWriter; + use crate::metacache::writer::MetacacheReader; + use super::*; #[tokio::test] @@ -2425,25 +2432,32 @@ mod test { } }; - let f = match open_file("./testfile.txt", O_CREATE | O_RDWR | O_TRUNC).await { - Ok(res) => res, - Err(err) => { - println!("openfile err {:?}", err); - return; + let (rd, mut wr) = tokio::io::duplex(64); + + // let mut wr = VecAsyncWriter::new(Vec::new()); + + let job = tokio::spawn(async move { + let opts = WalkDirOptions { + bucket: "dada".to_owned(), + recursive: true, + ..Default::default() + }; + if let Err(err) = disk.walk_dir(opts, &mut wr).await { + println!("walk_dir err {:?}", err); } - }; + }); - let buf = BufWriter::new(Vec::new()); + // let rd = VecAsyncReader::new(wr.get_buffer().to_vec()); - let opts = WalkDirOptions { - bucket: "dada".to_owned(), - recursive: true, - ..Default::default() - }; - if let Err(err) = disk.walk_dir(opts, crate::io::Writer::File(f)).await { - println!("walk_dir err {:?}", err); - } + let rd_job = tokio::spawn(async move { + let mut mrd = MetacacheReader::new(rd); - MetacacheReader::new() + while let Some(info) = mrd.peek().await.unwrap_or_default() { + println!("{:?}", info) + } + }); + + job.await.unwrap(); + rd_job.await.unwrap(); } } diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 5fec3bc29..c47dd9afe 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -46,7 +46,7 @@ use std::{ use time::OffsetDateTime; use tokio::{ fs::File, - io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt}, + io::{AsyncReadExt, AsyncSeekExt, AsyncWrite, AsyncWriteExt}, sync::mpsc::{self, Sender}, }; use tokio_stream::wrappers::ReceiverStream; @@ -210,7 +210,7 @@ impl DiskAPI for Disk { } } - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { + async fn walk_dir(&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,7 +406,7 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { async fn delete_volume(&self, volume: &str) -> Result<()>; // 并发边读边写 TODO: wr io.Writer - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result>; + async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result>; // Metadata operations async fn delete_version( diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 6f5534c79..a68d6d827 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -10,7 +10,10 @@ use protos::{ StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WalkDirRequest, WriteAllRequest, WriteMetadataRequest, }, }; -use tokio::sync::mpsc::{self, Sender}; +use tokio::{ + io::AsyncWrite, + sync::mpsc::{self, Sender}, +}; use tokio_stream::{wrappers::ReceiverStream, StreamExt}; use tonic::Request; use tracing::info; @@ -347,7 +350,7 @@ impl DiskAPI for RemoteDisk { Ok(response.volumes) } - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { + async fn walk_dir(&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) diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index a4d9c3cc1..a6b182ce8 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -3,8 +3,6 @@ use std::io::Write; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::fs::File; -use tokio::io::BufReader; -use tokio::io::BufWriter; use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; #[derive(Default)] @@ -12,19 +10,14 @@ pub enum Reader { #[default] NotUse, File(File), - Buffer(BufReader>), + Buffer(VecAsyncReader), } impl AsyncRead for Reader { fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll> { match self.get_mut() { - Reader::File(file) => { - let file = Pin::new(file); - file.poll_read(cx, buf) - } - Reader::Buffer(buffer) => { - todo!() - } + Reader::File(file) => Pin::new(file).poll_read(cx, buf), + Reader::Buffer(buffer) => Pin::new(buffer).poll_read(cx, buf), Reader::NotUse => Poll::Ready(Ok(())), } } @@ -35,7 +28,7 @@ pub enum Writer { #[default] NotUse, File(File), - Buffer(BufWriter>), + Buffer(VecAsyncWriter), } impl AsyncWrite for Writer { diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index cc23cf6ec..ddc55f913 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -1,9 +1,16 @@ use crate::disk::MetaCacheEntry; use crate::error::Error; use crate::error::Result; +use rmp::decode::RmpRead; +use rmp::encode::RmpWrite; +use rmp::Marker; use std::io::Read; use std::io::Write; use std::str::from_utf8; +use tokio::io::AsyncRead; +use tokio::io::AsyncReadExt; +use tokio::io::AsyncWrite; +use tokio::io::AsyncWriteExt; // use std::sync::Arc; // use tokio::sync::mpsc; // use tokio::sync::mpsc::Sender; @@ -16,50 +23,64 @@ pub struct MetacacheWriter { wr: W, created: bool, // err: Option, + buf: Vec, } -impl MetacacheWriter { +impl MetacacheWriter { pub fn new(wr: W) -> Self { Self { wr, created: false, // err: None, + buf: Vec::new(), } } - pub fn init(&mut self) -> Result<()> { + pub async fn flush(&mut self) -> Result<()> { + self.wr.write_all(&self.buf).await?; + self.buf.clear(); + + Ok(()) + } + + pub async fn init(&mut self) -> Result<()> { if !self.created { - rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; + rmp::encode::write_u8(&mut self.buf, METACACHE_STREAM_VERSION).map_err(|e| Error::msg(format!("{:?}", e)))?; + self.flush().await?; self.created = true; } Ok(()) } - pub fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { + pub async fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { if objs.is_empty() { return Ok(()); } - self.init()?; + self.init().await?; for obj in objs.iter() { if obj.name.is_empty() { return Err(Error::msg("metacacheWriter: no name")); } - self.write_obj(obj)?; + self.write_obj(obj).await?; } Ok(()) } - pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { - self.init()?; - rmp::encode::write_bool(&mut self.wr, true)?; + pub async fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + self.init().await?; - rmp::encode::write_str(&mut self.wr, &obj.name)?; + rmp::encode::write_bool(&mut self.buf, true).map_err(|e| Error::msg(format!("{:?}", e)))?; + + rmp::encode::write_str(&mut self.buf, &obj.name).map_err(|e| Error::msg(format!("{:?}", e)))?; + + rmp::encode::write_bin(&mut self.buf, &obj.metadata).map_err(|e| Error::msg(format!("{:?}", e)))?; + + self.flush().await?; - rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; Ok(()) } @@ -96,9 +117,9 @@ impl MetacacheWriter { // Ok(sender) // } - pub fn close(&mut self) -> Result<()> { - rmp::encode::write_bool(&mut self.wr, false)?; - self.wr.flush()?; + pub async fn close(&mut self) -> Result<()> { + rmp::encode::write_bool(&mut self.buf, false).map_err(|e| Error::msg(format!("{:?}", e)))?; + self.flush().await?; Ok(()) } } @@ -108,34 +129,60 @@ pub struct MetacacheReader { init: bool, err: Option, buf: Vec, + offset: usize, } -impl MetacacheReader { +impl MetacacheReader { pub fn new(rd: R) -> Self { Self { rd, init: false, err: None, buf: Vec::new(), + offset: 0, } } - fn check_init(&mut self) { + pub async fn read_more(&mut self, read_size: usize) -> Result<&[u8]> { + let ext_size = read_size + self.offset; + + let extra = ext_size - self.offset; + if self.buf.capacity() >= ext_size { + // Extend the buffer if we have enough space. + self.buf.resize(ext_size, 0); + } else { + self.buf.extend(vec![0u8; extra]); + } + + let pref = self.offset; + + self.rd.read_exact(&mut self.buf[pref..ext_size]).await?; + + self.offset += read_size; + + let data = &self.buf[pref..ext_size]; + + println!("pref {} offset {},ext_size {}, data {:?}", pref, self.offset, ext_size, &data); + + Ok(data) + } + + fn reset(&mut self) { + self.buf.clear(); + self.offset = 0; + } + + async fn check_init(&mut self) -> Result<()> { if !self.init { - // let mut buf = match self.read_buf(1).await { - // Ok(res) => res, - // Err(err) => { - // self.err = Some(Error::msg(err.to_string())); - // return; - // } - // }; - let ver = match rmp::decode::read_u8(&mut self.rd) { + let ver = match rmp::decode::read_u8(&mut self.read_more(2).await?) { Ok(res) => res, Err(err) => { - self.err = Some(Error::msg(err.to_string())); + self.err = Some(Error::msg(format!("{:?}", err))); 0 } }; + + println!("ver {}", ver); match ver { 1 | 2 => (), _ => { @@ -145,70 +192,99 @@ impl MetacacheReader { self.init = true; } + Ok(()) } - pub fn peek(&mut self) -> Result> { - self.check_init(); + async fn read_str_len(&mut self) -> Result { + let mark = match rmp::decode::read_marker(&mut self.read_more(1).await?) { + Ok(res) => res, + Err(err) => { + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); + } + }; + + match mark { + Marker::FixStr(size) => Ok(u32::from(size)), + Marker::Str8 => Ok(u32::from(self.read_u8().await?)), + Marker::Str16 => Ok(u32::from(self.read_u16().await?)), + Marker::Str32 => Ok(self.read_u32().await?), + _ => Err(Error::msg("str marker err")), + } + } + + async fn read_bin_len(&mut self) -> Result { + let mark = match rmp::decode::read_marker(&mut self.read_more(1).await?) { + Ok(res) => res, + Err(err) => { + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); + } + }; + + match mark { + Marker::Bin8 => Ok(u32::from(self.read_u8().await?)), + Marker::Bin16 => Ok(u32::from(self.read_u16().await?)), + Marker::Bin32 => Ok(self.read_u32().await?), + _ => Err(Error::msg("bin marker err")), + } + } + + async fn read_u8(&mut self) -> Result { + let a = self.read_more(1).await?; + + Ok(a[0]) + } + + async fn read_u16(&mut self) -> Result { + rmp::decode::read_u16(&mut self.read_more(2).await?).map_err(|e| Error::msg(format!("{:?}", e))) + } + + async fn read_u32(&mut self) -> Result { + rmp::decode::read_u32(&mut self.read_more(4).await?).map_err(|e| Error::msg(format!("{:?}", e))) + } + + pub async fn peek(&mut self) -> Result> { + self.check_init().await; if let Some(err) = &self.err { return Err(err.clone()); } - match rmp::decode::read_bool(&mut self.rd) { + match rmp::decode::read_bool(&mut self.read_more(1).await?) { Ok(res) => { if !res { return Ok(None); } } Err(err) => { - self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); } }; - let l = match rmp::decode::read_str_len(&mut self.rd) { - Ok(res) => res, + let l = self.read_str_len().await?; + + let buf = self.read_more(l as usize).await?; + let name_buf = buf.to_vec(); + let name = match from_utf8(&name_buf) { + Ok(decoded) => decoded.to_owned(), Err(err) => { self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); + return Err(Error::msg(err.to_string())); } }; - self.buf.resize(l as usize, 0); - let name = match self.rd.read_exact(&mut self.buf) { - Ok(()) => { - let name_buf = self.buf.to_vec(); - match from_utf8(&name_buf) { - Ok(decoded) => Ok(decoded.to_owned()), - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - Err(Error::msg(err.to_string())) - } - } - } - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - Err(Error::msg(err.to_string())) - } - }?; + let l = self.read_bin_len().await?; - let l = match rmp::decode::read_bin_len(&mut self.rd) { - Ok(res) => res, - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); - } - }; - self.buf.resize(l as usize, 0); - match self.rd.read_exact(&mut self.buf) { - Ok(res) => res, - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); - } - }; + let buf = self.read_more(l as usize).await?; - let metadata = self.buf.clone(); + let metadata = buf.to_vec(); + + self.reset(); Ok(Some(MetaCacheEntry { name, @@ -218,11 +294,11 @@ impl MetacacheReader { })) } - pub fn read_all(&mut self) -> Result> { + pub async fn read_all(&mut self) -> Result> { let mut ret = Vec::new(); loop { - if let Some(entry) = self.peek()? { + if let Some(entry) = self.peek().await? { ret.push(entry); continue; } @@ -236,13 +312,12 @@ impl MetacacheReader { #[tokio::test] async fn test_writer() { - use crate::io::AsyncToSync; use crate::io::VecAsyncReader; use crate::io::VecAsyncWriter; let mut f = VecAsyncWriter::new(Vec::new()); - let mut w = MetacacheWriter::new(AsyncToSync::new_writer(&mut f)); + let mut w = MetacacheWriter::new(&mut f); let mut objs = Vec::new(); for i in 0..10 { @@ -256,14 +331,18 @@ async fn test_writer() { objs.push(info); } - w.write(&objs).unwrap(); + w.write(&objs).await.unwrap(); - w.close().unwrap(); + w.close().await.unwrap(); - let nf = VecAsyncReader::new(f.get_buffer().to_vec()); + let data = f.get_buffer().to_vec(); - let mut r = MetacacheReader::new(AsyncToSync::new_reader(nf)); - let nobjs = r.read_all().unwrap(); + println!("data len {}", data.len()); + + let nf = VecAsyncReader::new(data); + + let mut r = MetacacheReader::new(nf); + let nobjs = r.read_all().await.unwrap(); for info in nobjs.iter() { println!("new {:?}", &info); diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index cde79dfc6..2e90a483f 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1330,7 +1330,7 @@ impl SetDisks { let opts = opts.clone(); futures.push(async move { if let Some(disk) = disk { - disk.walk_dir(opts, Writer::NotUse).await + disk.walk_dir(opts, &mut Writer::NotUse).await } else { Err(Error::new(DiskError::DiskNotFound)) } diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index c529ac8ca..a2be08bac 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -743,7 +743,7 @@ impl Node for NodeService { })); } }; - match disk.walk_dir(opts, ecstore::io::Writer::NotUse).await { + match disk.walk_dir(opts, &mut ecstore::io::Writer::NotUse).await { Ok(entries) => { let entries = entries .into_iter() From f5e63f42a4c1011985351da3fa7280783355ac0a Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 20:02:49 +0800 Subject: [PATCH 37/77] test walk_dir done --- ecstore/src/disk/local.rs | 31 +++++++++++++++++++++---------- ecstore/src/io.rs | 4 ++-- ecstore/src/metacache/writer.rs | 22 +++++++++++----------- ecstore/src/utils/path.rs | 2 +- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 5a8979bb4..2fe011da9 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -37,7 +37,10 @@ use crate::set_disk::{ use crate::store_api::{BitrotAlgorithm, StorageAPI}; use crate::utils::fs::{access, lstat, O_APPEND, O_CREATE, O_RDONLY, O_WRONLY}; use crate::utils::os::get_info; -use crate::utils::path::{self, clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; +use crate::utils::path::{ + self, clean, decode_dir_object, has_suffix, path_join, path_join_buf, GLOBAL_DIR_SUFFIX, GLOBAL_DIR_SUFFIX_WITH_SLASH, + SLASH_SEPARATOR, +}; use crate::{ file_meta::FileMeta, store_api::{FileInfo, RawFileInfo}, @@ -743,7 +746,9 @@ impl LocalDisk { let mut entries = match self.list_dir("", &opts.bucket, current, -1).await { Ok(res) => res, Err(e) => { - if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) {} + if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { + error!("scan list_dir {}, err {:?}", ¤t, &e); + } if opts.report_notfound && is_err_file_not_found(&e) && current == &opts.base_dir { return Err(Error::new(DiskError::FileNotFound)); @@ -849,13 +854,13 @@ impl LocalDisk { if pop < name { // out.write_obj(&MetaCacheEntry { - name: pop, + name: pop.clone(), ..Default::default() }) .await?; if opts.recursive { - if let Err(er) = Box::pin(self.scan_dir(current, opts, out, objs_returned)).await { + if let Err(er) = Box::pin(self.scan_dir(&mut pop.clone(), opts, out, objs_returned)).await { error!("scan_dir err {:?}", er); } } @@ -1495,7 +1500,11 @@ impl DiskAPI for LocalDisk { } let volume_dir = self.get_bucket_path(volume)?; - let dir_path_abs = volume_dir.join(Path::new(&dir_path)); + let dir_path_abs = volume_dir.join(Path::new(&dir_path.trim_start_matches(SLASH_SEPARATOR))); + println!( + "list dir volume_dir: {:?} join dir_path {} = abs {:?}", + &volume_dir, &dir_path, dir_path_abs + ); let entries = match os::read_dir(&dir_path_abs, count).await { Ok(res) => res, @@ -1534,8 +1543,14 @@ impl DiskAPI for LocalDisk { if opts.base_dir.ends_with(SLASH_SEPARATOR) { let fpath = self.get_object_path( &opts.bucket, - format!("{}/{}", opts.base_dir.trim_end_matches(SLASH_SEPARATOR), STORAGE_FORMAT_FILE).as_str(), + path_join_buf(&[ + format!("{}{}", opts.base_dir.trim_end_matches(SLASH_SEPARATOR), GLOBAL_DIR_SUFFIX).as_str(), + STORAGE_FORMAT_FILE, + ]) + .as_str(), )?; + + println!("fpath {:?}", &fpath); if let Ok(data) = self.read_metadata(fpath).await { let meta = MetaCacheEntry { name: opts.base_dir.clone(), @@ -2434,8 +2449,6 @@ mod test { let (rd, mut wr) = tokio::io::duplex(64); - // let mut wr = VecAsyncWriter::new(Vec::new()); - let job = tokio::spawn(async move { let opts = WalkDirOptions { bucket: "dada".to_owned(), @@ -2447,8 +2460,6 @@ mod test { } }); - // let rd = VecAsyncReader::new(wr.get_buffer().to_vec()); - let rd_job = tokio::spawn(async move { let mut mrd = MetacacheReader::new(rd); diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index a6b182ce8..e1ed0b48d 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -163,7 +163,7 @@ impl VecAsyncWriter { // Implementing AsyncWrite trait for VecAsyncWriter impl AsyncWrite for VecAsyncWriter { - fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + fn poll_write(self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &[u8]) -> Poll> { let len = buf.len(); // Assume synchronous writing for simplicity @@ -178,7 +178,7 @@ impl AsyncWrite for VecAsyncWriter { Poll::Ready(Ok(())) } - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { // Similar to flush, shutdown has no effect here Poll::Ready(Ok(())) } diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index ddc55f913..a405722e5 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -71,6 +71,8 @@ impl MetacacheWriter { } pub async fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + println!("write_obj {:?}", &obj); + self.init().await?; rmp::encode::write_bool(&mut self.buf, true).map_err(|e| Error::msg(format!("{:?}", e)))?; @@ -162,8 +164,6 @@ impl MetacacheReader { let data = &self.buf[pref..ext_size]; - println!("pref {} offset {},ext_size {}, data {:?}", pref, self.offset, ext_size, &data); - Ok(data) } @@ -181,8 +181,6 @@ impl MetacacheReader { 0 } }; - - println!("ver {}", ver); match ver { 1 | 2 => (), _ => { @@ -233,21 +231,25 @@ impl MetacacheReader { } async fn read_u8(&mut self) -> Result { - let a = self.read_more(1).await?; + let buf = self.read_more(1).await?; - Ok(a[0]) + Ok(u8::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } async fn read_u16(&mut self) -> Result { - rmp::decode::read_u16(&mut self.read_more(2).await?).map_err(|e| Error::msg(format!("{:?}", e))) + let buf = self.read_more(2).await?; + + Ok(u16::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } async fn read_u32(&mut self) -> Result { - rmp::decode::read_u32(&mut self.read_more(4).await?).map_err(|e| Error::msg(format!("{:?}", e))) + let buf = self.read_more(4).await?; + + Ok(u32::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } pub async fn peek(&mut self) -> Result> { - self.check_init().await; + self.check_init().await?; if let Some(err) = &self.err { return Err(err.clone()); @@ -337,8 +339,6 @@ async fn test_writer() { let data = f.get_buffer().to_vec(); - println!("data len {}", data.len()); - let nf = VecAsyncReader::new(data); let mut r = MetacacheReader::new(nf); diff --git a/ecstore/src/utils/path.rs b/ecstore/src/utils/path.rs index 9f2c22a08..745aef679 100644 --- a/ecstore/src/utils/path.rs +++ b/ecstore/src/utils/path.rs @@ -1,7 +1,7 @@ use std::path::Path; use std::path::PathBuf; -const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; +pub const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; pub const SLASH_SEPARATOR: &str = "/"; From 4ccd69c7829bb257b0c6fcd452b9b519b576f646 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 11:15:49 +0800 Subject: [PATCH 38/77] clippy clippy clippy --- ecstore/src/disk/error.rs | 8 +++++ ecstore/src/disk/local.rs | 53 +++++++++++++++++++++++++-------- ecstore/src/file_meta.rs | 10 +++---- ecstore/src/notification_sys.rs | 1 + ecstore/src/set_disk.rs | 14 ++++----- ecstore/src/sets.rs | 4 +-- 6 files changed, 64 insertions(+), 26 deletions(-) diff --git a/ecstore/src/disk/error.rs b/ecstore/src/disk/error.rs index 4ecbd632d..d20c00a3f 100644 --- a/ecstore/src/disk/error.rs +++ b/ecstore/src/disk/error.rs @@ -456,3 +456,11 @@ pub fn is_all_buckets_not_found(errs: &[Option]) -> bool { } errs.len() == not_found_count } + +pub fn is_err_os_not_exist(err: &Error) -> bool { + if let Some(os_err) = err.downcast_ref::() { + os_is_not_exist(os_err) + } else { + false + } +} diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 762962466..3f51c1b66 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -12,8 +12,8 @@ use crate::bitrot::bitrot_verify; use crate::bucket::metadata_sys::{self}; use crate::cache_value::cache::{Cache, Opts, UpdateFn}; use crate::disk::error::{ - convert_access_error, is_sys_err_handle_invalid, is_sys_err_invalid_arg, is_sys_err_is_dir, is_sys_err_not_dir, - map_err_not_exists, os_err_to_file_err, + convert_access_error, is_err_os_not_exist, is_sys_err_handle_invalid, is_sys_err_invalid_arg, is_sys_err_is_dir, + is_sys_err_not_dir, map_err_not_exists, os_err_to_file_err, }; use crate::disk::os::{check_path_length, is_empty_dir}; use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE}; @@ -40,6 +40,7 @@ use crate::{ utils, }; use common::defer; +use nix::NixPath; use path_absolutize::Absolutize; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; @@ -57,7 +58,7 @@ use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{error, info, warn}; +use tracing::{info, warn}; use uuid::Uuid; #[derive(Debug)] @@ -400,22 +401,49 @@ impl LocalDisk { } /// read xl.meta raw data - #[tracing::instrument(level = "debug", skip(self, volume_dir, path))] + #[tracing::instrument(level = "debug", skip(self, volume_dir, file_path))] async fn read_raw( &self, bucket: &str, volume_dir: impl AsRef, - path: impl AsRef, + file_path: impl AsRef, read_data: bool, ) -> Result<(Vec, Option)> { - let meta_path = path.as_ref().join(Path::new(super::STORAGE_FORMAT_FILE)); - if read_data { - self.read_all_data_with_dmtime(bucket, volume_dir, meta_path).await - } else { - self.read_all_data_with_dmtime(bucket, volume_dir, meta_path).await - // FIXME: read_metadata only suport - // self.read_metadata_with_dmtime(meta_path).await + if file_path.as_ref().is_empty() { + return Err(Error::new(DiskError::FileNotFound)); } + + let meta_path = file_path.as_ref().join(Path::new(super::STORAGE_FORMAT_FILE)); + + let res = { + if read_data { + self.read_all_data_with_dmtime(bucket, volume_dir, meta_path).await + } else { + match self.read_metadata_with_dmtime(meta_path).await { + Ok(res) => Ok(res), + Err(err) => { + if is_err_os_not_exist(&err) + && !skip_access_checks(volume_dir.as_ref().to_string_lossy().to_string().as_str()) + { + if let Err(aerr) = access(volume_dir.as_ref()).await { + if os_is_not_exist(&aerr) { + return Err(Error::new(DiskError::VolumeNotFound)); + } + } + } + + Err(err) + } + } + } + }; + + let (buf, mtime) = res?; + if buf.is_empty() { + return Err(Error::new(DiskError::FileNotFound)); + } + + Ok((buf, mtime)) } async fn read_metadata(&self, file_path: impl AsRef) -> Result> { @@ -446,6 +474,7 @@ impl LocalDisk { let mut bytes = Vec::new(); bytes.try_reserve_exact(size)?; + // FIXME: real xl no data f.read_to_end(&mut bytes).await.map_err(os_err_to_file_err)?; let modtime = match meta.modified() { diff --git a/ecstore/src/file_meta.rs b/ecstore/src/file_meta.rs index 3afae0557..2a4fa0baf 100644 --- a/ecstore/src/file_meta.rs +++ b/ecstore/src/file_meta.rs @@ -484,7 +484,7 @@ impl FileMeta { } } - let mut fi = ver.into_fileinfo(volume, path, has_vid, all_parts)?; + let mut fi = ver.to_fileinfo(volume, path, has_vid, all_parts)?; fi.is_latest = is_latest; if let Some(_d) = succ_mod_time { fi.successor_mod_time = succ_mod_time; @@ -511,7 +511,7 @@ impl FileMeta { for version in self.versions.iter() { let mut file_version = FileMetaVersion::default(); file_version.unmarshal_msg(&version.meta)?; - let fi = file_version.into_fileinfo(volume, path, None, all_parts); + let fi = file_version.to_fileinfo(volume, path, None, all_parts); versions.push(fi); } @@ -553,10 +553,10 @@ pub struct FileMetaShallowVersion { } impl FileMetaShallowVersion { - pub fn into_fileinfo(&self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> Result { + pub fn to_fileinfo(&self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> Result { let file_version = FileMetaVersion::try_from(self.meta.as_slice())?; - Ok(file_version.into_fileinfo(volume, path, version_id, all_parts)) + Ok(file_version.to_fileinfo(volume, path, version_id, all_parts)) } } @@ -760,7 +760,7 @@ impl FileMetaVersion { FileMetaVersionHeader::from(self.clone()) } - pub fn into_fileinfo(self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> FileInfo { + pub fn to_fileinfo(&self, volume: &str, path: &str, version_id: Option, all_parts: bool) -> FileInfo { match self.version_type { VersionType::Invalid => FileInfo { name: path.to_string(), diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index 004bf2495..76df1e637 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -26,6 +26,7 @@ pub fn get_global_notification_sys() -> Option<&'static NotificationSys> { pub struct NotificationSys { pub peer_clients: Vec>, + #[allow(dead_code)] pub all_peer_clients: Vec>, } diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 4bbc64c08..58c209d22 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1109,9 +1109,9 @@ impl SetDisks { let finfo = match meta.into_fileinfo(bucket, object, "", true, true) { Ok(res) => res, Err(err) => { - for i in 0..errs.len() { - if errs[i].is_none() { - errs[i] = Some(err.clone()) + for item in errs.iter_mut() { + if item.is_none() { + *item = Some(err.clone()) } } @@ -1120,9 +1120,9 @@ impl SetDisks { }; if !finfo.is_valid() { - for i in 0..errs.len() { - if errs[i].is_none() { - errs[i] = Some(Error::new(DiskError::FileCorrupt)); + for item in errs.iter_mut() { + if item.is_none() { + *item = Some(Error::new(DiskError::FileCorrupt)); } } @@ -5009,7 +5009,7 @@ async fn get_disks_info(disks: &[Option], eps: &[Endpoint]) -> Vec>, eps: &Vec) -> madmin::StorageInfo { +async fn get_storage_info(disks: &[Option], eps: &[Endpoint]) -> madmin::StorageInfo { let mut disks = get_disks_info(disks, eps).await; disks.sort_by(|a, b| a.total_space.cmp(&b.total_space)); diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index e39d09002..594e88f58 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -87,7 +87,7 @@ impl Sets { let mut disk_set = Vec::with_capacity(set_count); - for i in 0..set_count { + for (i, locker) in lockers.iter().enumerate().take(set_count) { let mut set_drive = Vec::with_capacity(set_drive_count); let mut set_endpoints = Vec::with_capacity(set_drive_count); for j in 0..set_drive_count { @@ -145,7 +145,7 @@ impl Sets { // warn!("sets new set_drive {:?}", &set_drive); let set_disks = SetDisks { - lockers: lockers[i].clone(), + lockers: locker.clone(), locker_owner: GLOBAL_Local_Node_Name.read().await.to_string(), ns_mutex: Arc::new(RwLock::new(NsLockMap::new(is_dist_erasure().await))), disks: RwLock::new(set_drive), From 2786174ffb9d5bd113a540d40b4ded4ffc39e5c6 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 17:36:16 +0800 Subject: [PATCH 39/77] rewrite real_meta --- ecstore/src/disk/local.rs | 13 +- ecstore/src/file_meta.rs | 162 +++++++++++++- ecstore/src/lib.rs | 13 +- ecstore/src/notification_sys.rs | 5 + ecstore/src/store.rs | 207 +++++++++--------- ...{list_objects.rs => store_list_objects.rs} | 12 +- 6 files changed, 278 insertions(+), 134 deletions(-) rename ecstore/src/{list_objects.rs => store_list_objects.rs} (96%) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 3f51c1b66..98f2e0848 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -18,6 +18,7 @@ use crate::disk::error::{ use crate::disk::os::{check_path_length, is_empty_dir}; use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE}; use crate::error::{Error, Result}; +use crate::file_meta::read_xl_meta_no_data; use crate::global::{GLOBAL_IsErasureSD, GLOBAL_RootDiskThreshold}; use crate::heal::data_scanner::{has_active_rules, scan_data_folder, ScannerItem, ShouldSleepFn, SizeSummary}; use crate::heal::data_scanner_metric::{ScannerMetric, ScannerMetrics}; @@ -452,7 +453,6 @@ impl LocalDisk { Ok(data) } - // FIXME: read_metadata only suport async fn read_metadata_with_dmtime(&self, file_path: impl AsRef) -> Result<(Vec, Option)> { check_path_length(file_path.as_ref().to_string_lossy().as_ref())?; @@ -471,18 +471,15 @@ impl LocalDisk { } let size = meta.len() as usize; - let mut bytes = Vec::new(); - bytes.try_reserve_exact(size)?; - // FIXME: real xl no data - f.read_to_end(&mut bytes).await.map_err(os_err_to_file_err)?; + let data = read_xl_meta_no_data(&mut f, size).await?; let modtime = match meta.modified() { Ok(md) => Some(OffsetDateTime::from(md)), Err(_) => None, }; - Ok((bytes, modtime)) + Ok((data, modtime)) } async fn read_all_data(&self, volume: &str, volume_dir: impl AsRef, file_path: impl AsRef) -> Result> { @@ -1475,7 +1472,7 @@ impl DiskAPI for LocalDisk { let mut xlmeta = FileMeta::new(); if let Some(dst_buf) = has_dst_buf.as_ref() { - if FileMeta::is_xl_format(dst_buf) { + if FileMeta::is_xl2_v1_format(dst_buf) { if let Ok(nmeta) = FileMeta::load(dst_buf) { xlmeta = nmeta } @@ -1723,7 +1720,7 @@ impl DiskAPI for LocalDisk { } })?; - if !FileMeta::is_xl_format(buf.as_slice()) { + if !FileMeta::is_xl2_v1_format(buf.as_slice()) { return Err(Error::new(DiskError::FileVersionNotFound)); } diff --git a/ecstore/src/file_meta.rs b/ecstore/src/file_meta.rs index 2a4fa0baf..3dae801d6 100644 --- a/ecstore/src/file_meta.rs +++ b/ecstore/src/file_meta.rs @@ -3,10 +3,11 @@ use rmp::Marker; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::fmt::Display; -use std::io::{Read, Write}; +use std::io::{self, Read, Write}; use std::{collections::HashMap, io::Cursor}; use time::OffsetDateTime; -use tracing::warn; +use tokio::io::AsyncRead; +use tracing::{error, warn}; use uuid::Uuid; use xxhash_rust::xxh64; @@ -35,6 +36,9 @@ const XL_FLAG_FREE_VERSION: u8 = 1 << 0; // const XL_FLAG_USES_DATA_DIR: u8 = 1 << 1; const _XL_FLAG_INLINE_DATA: u8 = 1 << 2; +const META_DATA_READ_DEFAULT: usize = 4 << 10; +const MSGP_UINT32_SIZE: usize = 5; + #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct FileMeta { pub versions: Vec, @@ -51,8 +55,9 @@ impl FileMeta { } } - pub fn is_xl_format(buf: &[u8]) -> bool { - !matches!(Self::read_xl_file_header(buf), Err(_e)) + // isXL2V1Format + pub fn is_xl2_v1_format(buf: &[u8]) -> bool { + !matches!(Self::check_xl2_v1(buf), Err(_e)) } pub fn load(buf: &[u8]) -> Result { @@ -62,9 +67,10 @@ impl FileMeta { Ok(xl) } - // read_xl_file_header 读xl文件头,返回后续内容,版本信息 + // check_xl2_v1 读xl文件头,返回后续内容,版本信息 + // checkXL2V1 #[tracing::instrument] - pub fn read_xl_file_header(buf: &[u8]) -> Result<(&[u8], u16, u16)> { + pub fn check_xl2_v1(buf: &[u8]) -> Result<(&[u8], u16, u16)> { if buf.len() < 8 { return Err(Error::msg("xl file header not exists")); } @@ -81,12 +87,22 @@ impl FileMeta { Ok((&buf[8..], major, minor)) } + + // 固定u32 + pub fn read_bytes_header(buf: &[u8]) -> Result<(u32, &[u8])> { + let (mut size_buf, _) = buf.split_at(5); + + // 取meta数据,buf = crc + data + let bin_len = rmp::decode::read_bin_len(&mut size_buf)?; + + Ok((bin_len, &buf[5..])) + } #[tracing::instrument] pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let i = buf.len() as u64; // check version, buf = buf[8..] - let (buf, _, _) = Self::read_xl_file_header(buf)?; + let (buf, _, _) = Self::check_xl2_v1(buf)?; let (mut size_buf, buf) = buf.split_at(5); @@ -1994,9 +2010,96 @@ async fn get_file_info(buf: &[u8], volume: &str, path: &str, version_id: &str, o Ok(fi) } + +async fn read_more( + reader: &mut R, + buf: &mut Vec, + total_size: usize, + read_size: usize, + has_full: bool, +) -> Result<()> { + use tokio::io::AsyncReadExt; + let has = buf.len(); + + if has >= read_size { + return Ok(()); + } + + if has_full || read_size > total_size { + return Err(Error::new(io::Error::new(io::ErrorKind::UnexpectedEof, "Unexpected EOF"))); + } + + let extra = read_size - has; + if buf.capacity() >= read_size { + // Extend the buffer if we have enough space. + buf.resize(read_size, 0); + } else { + buf.extend(vec![0u8; extra]); + } + + reader.read_exact(&mut buf[has..]).await?; + Ok(()) +} + +pub async fn read_xl_meta_no_data(reader: &mut R, size: usize) -> Result> { + use tokio::io::AsyncReadExt; + + let mut initial = size; + let mut has_full = true; + + if initial > META_DATA_READ_DEFAULT { + initial = META_DATA_READ_DEFAULT; + has_full = false; + } + + let mut buf = vec![0u8; initial]; + reader.read_exact(&mut buf).await?; + + let (tmp_buf, major, minor) = FileMeta::check_xl2_v1(&buf)?; + + match major { + 1 => match minor { + 0 => { + read_more(reader, &mut buf, size, size, has_full).await?; + Ok(buf) + } + 1..=3 => { + let (sz, tmp_buf) = FileMeta::read_bytes_header(tmp_buf)?; + let mut want = sz as usize + (buf.len() - tmp_buf.len()); + + if minor < 2 { + read_more(reader, &mut buf, size, want, has_full).await?; + return Ok(buf[..want].to_vec()); + } + + let want_max = usize::min(want + MSGP_UINT32_SIZE, size); + read_more(reader, &mut buf, size, want_max, has_full).await?; + + if buf.len() < want { + error!("read_xl_meta_no_data buffer too small (length: {}, needed: {})", &buf.len(), want); + return Err(Error::new(DiskError::FileCorrupt)); + } + + let tmp = &buf[want..]; + let crc_size = 5; + let other_size = tmp.len() - crc_size; + + want += tmp.len() - other_size; + + Ok(buf[..want].to_vec()) + } + _ => Err(Error::new(io::Error::new(io::ErrorKind::InvalidData, "Unknown minor metadata version"))), + }, + _ => Err(Error::new(io::Error::new(io::ErrorKind::InvalidData, "Unknown major metadata version"))), + } +} #[cfg(test)] mod test { + use std::fs; + use std::fs::File; + use std::os::unix::fs::MetadataExt; + use super::*; #[test] @@ -2012,15 +2115,11 @@ mod test { fm.add_version(fi).unwrap(); } - // println!("fm:{:?}", &fm); - let buff = fm.marshal_msg().unwrap(); let mut newfm = FileMeta::default(); newfm.unmarshal_msg(&buff).unwrap(); - // println!("newone:{:?}", newone); - assert_eq!(fm, newfm) } @@ -2107,3 +2206,44 @@ mod test { assert_eq!(obj.version_id, vid); } } + +#[tokio::test] +async fn test_read_xl_meta_no_data() { + use tokio::fs; + use tokio::fs::File; + use tokio::io::AsyncWriteExt; + + let mut fm = FileMeta::new(); + + let (m, n) = (3, 2); + + for i in 0..5 { + let mut fi = FileInfo::new(i.to_string().as_str(), m, n); + fi.mod_time = Some(OffsetDateTime::now_utc()); + + fm.add_version(fi).unwrap(); + } + + let mut buff = fm.marshal_msg().unwrap(); + + buff.resize(buff.len() + 100, 0); + + let filepath = "./test_xl.meta"; + + let mut file = File::create(filepath).await.unwrap(); + // 写入字符串 + file.write_all(&buff).await.unwrap(); + + let mut f = File::open(filepath).await.unwrap(); + + let stat = f.metadata().await.unwrap(); + + let data = read_xl_meta_no_data(&mut f, stat.len() as usize).await.unwrap(); + + let mut newfm = FileMeta::default(); + newfm.unmarshal_msg(&data).unwrap(); + + fs::remove_file(filepath).await.unwrap(); + + assert_eq!(fm, newfm) +} diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index 2dbdebad6..ddd417b6e 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -1,5 +1,6 @@ pub mod admin_server_info; pub mod bitrot; +pub mod bucket; pub mod cache_value; mod chunk_stream; pub mod config; @@ -9,25 +10,23 @@ pub mod endpoints; pub mod erasure; pub mod error; mod file_meta; +pub mod file_meta_inline; pub mod global; pub mod heal; pub mod metrics_realtime; pub mod notification_sys; pub mod peer; pub mod peer_rest_client; +pub mod pools; mod quorum; pub mod set_disk; mod sets; pub mod store; pub mod store_api; -mod store_init; -pub mod utils; - -pub mod bucket; -pub mod file_meta_inline; - -pub mod pools; pub mod store_err; +mod store_init; +mod store_list_objects; +pub mod utils; pub mod xhttp; pub use global::new_object_layer_fn; diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index 76df1e637..8a994d939 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -46,6 +46,11 @@ pub struct NotificationPeerErr { } impl NotificationSys { + pub fn rest_client_from_hash(&self, s:&str) ->Option{ + + + None + } pub async fn delete_policy(&self) -> Vec { unimplemented!() } diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index a09cc7f3c..e583545d2 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -24,19 +24,19 @@ use crate::store_err::{ }; use crate::store_init::ec_drives_no_config; use crate::utils::crypto::base64_decode; -use crate::utils::path::{base_dir_from_prefix, decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; +use crate::utils::path::{decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; use crate::utils::xml; use crate::{ bucket::metadata::BucketMetadata, - disk::{error::DiskError, new_disk, DiskOption, DiskStore, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET}, + disk::{error::DiskError, new_disk, DiskOption, DiskStore, BUCKET_META_PREFIX, RUSTFS_META_BUCKET}, endpoints::EndpointServerPools, error::{Error, Result}, peer::S3PeerSys, sets::Sets, store_api::{ BucketInfo, BucketOptions, CompletePart, DeleteBucketOptions, DeletedObject, GetObjectReader, HTTPRangeSpec, - ListObjectsInfo, ListObjectsV2Info, MakeBucketOptions, MultipartUploadResult, ObjectInfo, ObjectOptions, ObjectToDelete, - PartInfo, PutObjReader, StorageAPI, + ListObjectsV2Info, MakeBucketOptions, MultipartUploadResult, ObjectInfo, ObjectOptions, ObjectToDelete, PartInfo, + PutObjReader, StorageAPI, }, store_init, utils, }; @@ -52,11 +52,7 @@ use std::cmp::Ordering; use std::process::exit; use std::slice::Iter; use std::time::SystemTime; -use std::{ - collections::{HashMap, HashSet}, - sync::Arc, - time::Duration, -}; +use std::{collections::HashMap, sync::Arc, time::Duration}; use time::OffsetDateTime; use tokio::select; use tokio::sync::mpsc::Sender; @@ -265,102 +261,104 @@ impl ECStore { self.pools.len() == 1 } - pub async fn list_path(&self, opts: &ListPathOptions, delimiter: &str) -> Result { - // if opts.prefix.ends_with(SLASH_SEPARATOR) { - // return Err(Error::msg("eof")); - // } + // define in store_list_objects.rs + // pub async fn list_path(&self, opts: &ListPathOptions, delimiter: &str) -> Result { + // // if opts.prefix.ends_with(SLASH_SEPARATOR) { + // // return Err(Error::msg("eof")); + // // } - let mut opts = opts.clone(); + // let mut opts = opts.clone(); - if opts.base_dir.is_empty() { - opts.base_dir = base_dir_from_prefix(&opts.prefix); - } + // if opts.base_dir.is_empty() { + // opts.base_dir = base_dir_from_prefix(&opts.prefix); + // } - let objects = self.list_merged(&opts, delimiter).await?; + // let objects = self.list_merged(&opts, delimiter).await?; - let info = ListObjectsInfo { - objects, - ..Default::default() - }; - Ok(info) - } + // let info = ListObjectsInfo { + // objects, + // ..Default::default() + // }; + // Ok(info) + // } // 读所有 - async fn list_merged(&self, opts: &ListPathOptions, delimiter: &str) -> Result> { - let walk_opts = WalkDirOptions { - bucket: opts.bucket.clone(), - base_dir: opts.base_dir.clone(), - ..Default::default() - }; + // define in store_list_objects.rs + // async fn list_merged(&self, opts: &ListPathOptions, delimiter: &str) -> Result> { + // let walk_opts = WalkDirOptions { + // bucket: opts.bucket.clone(), + // base_dir: opts.base_dir.clone(), + // ..Default::default() + // }; - // let (mut wr, mut rd) = tokio::io::duplex(1024); + // // let (mut wr, mut rd) = tokio::io::duplex(1024); - let mut futures = Vec::new(); + // let mut futures = Vec::new(); - for sets in self.pools.iter() { - for set in sets.disk_set.iter() { - futures.push(set.walk_dir(&walk_opts)); - } - } + // for sets in self.pools.iter() { + // for set in sets.disk_set.iter() { + // futures.push(set.walk_dir(&walk_opts)); + // } + // } - let results = join_all(futures).await; + // let results = join_all(futures).await; - // let mut errs = Vec::new(); - let mut ress = Vec::new(); - let mut uniq = HashSet::new(); + // // let mut errs = Vec::new(); + // let mut ress = Vec::new(); + // let mut uniq = HashSet::new(); - for (disks_ress, _disks_errs) in results { - for disks_res in disks_ress.iter() { - if disks_res.is_none() { - // TODO handle errs - continue; - } - let entrys = disks_res.as_ref().unwrap(); + // for (disks_ress, _disks_errs) in results { + // for disks_res in disks_ress.iter() { + // if disks_res.is_none() { + // // TODO handle errs + // continue; + // } + // let entrys = disks_res.as_ref().unwrap(); - for entry in entrys { - // warn!("lst_merged entry---- {}", &entry.name); + // for entry in entrys { + // // warn!("lst_merged entry---- {}", &entry.name); - if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { - continue; - } + // if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { + // continue; + // } - if !uniq.contains(&entry.name) { - uniq.insert(entry.name.clone()); - // TODO: 过滤 + // if !uniq.contains(&entry.name) { + // uniq.insert(entry.name.clone()); + // // TODO: 过滤 - if opts.limit > 0 && ress.len() as i32 >= opts.limit { - return Ok(ress); - } + // if opts.limit > 0 && ress.len() as i32 >= opts.limit { + // return Ok(ress); + // } - if entry.is_object() { - if !delimiter.is_empty() { - // entry.name.trim_start_matches(pat) - } + // if entry.is_object() { + // if !delimiter.is_empty() { + // // entry.name.trim_start_matches(pat) + // } - let fi = entry.to_fileinfo(&opts.bucket)?; - if let Some(f) = fi { - ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); - } - continue; - } + // let fi = entry.to_fileinfo(&opts.bucket)?; + // if let Some(f) = fi { + // ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); + // } + // continue; + // } - if entry.is_dir() { - ress.push(ObjectInfo { - is_dir: true, - bucket: opts.bucket.clone(), - name: entry.name.clone(), - ..Default::default() - }); - } - } - } - } - } + // if entry.is_dir() { + // ress.push(ObjectInfo { + // is_dir: true, + // bucket: opts.bucket.clone(), + // name: entry.name.clone(), + // ..Default::default() + // }); + // } + // } + // } + // } + // } - // warn!("list_merged errs {:?}", errs); + // // warn!("list_merged errs {:?}", errs); - Ok(ress) - } + // Ok(ress) + // } async fn delete_all(&self, bucket: &str, prefix: &str) -> Result<()> { let mut futures = Vec::new(); @@ -1520,29 +1518,32 @@ impl StorageAPI for ECStore { continuation_token: &str, delimiter: &str, max_keys: i32, - _fetch_owner: bool, - _start_after: &str, + fetch_owner: bool, + start_after: &str, ) -> Result { - let opts = ListPathOptions { - bucket: bucket.to_string(), - limit: max_keys, - prefix: prefix.to_owned(), - ..Default::default() - }; + self.inner_list_objects_v2(&bucket, &prefix, &continuation_token, &delimiter, max_keys, fetch_owner, start_after) + .await - let info = self.list_path(&opts, delimiter).await?; + // let opts = ListPathOptions { + // bucket: bucket.to_string(), + // limit: max_keys, + // prefix: prefix.to_owned(), + // ..Default::default() + // }; - // warn!("list_objects_v2 info {:?}", info); + // let info = self.list_path(&opts, delimiter).await?; - let v2 = ListObjectsV2Info { - is_truncated: info.is_truncated, - continuation_token: continuation_token.to_owned(), - next_continuation_token: info.next_marker, - objects: info.objects, - prefixes: info.prefixes, - }; + // // warn!("list_objects_v2 info {:?}", info); - Ok(v2) + // let v2 = ListObjectsV2Info { + // is_truncated: info.is_truncated, + // continuation_token: continuation_token.to_owned(), + // next_continuation_token: info.next_marker, + // objects: info.objects, + // prefixes: info.prefixes, + // }; + + // Ok(v2) } async fn list_object_versions( &self, @@ -2238,7 +2239,7 @@ fn check_bucket_and_object_names(bucket: &str, object: &str) -> Result<()> { Ok(()) } -fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &str) -> Result<()> { +pub fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &str) -> Result<()> { if !is_meta_bucketname(bucket) && check_valid_bucket_name_strict(bucket).is_err() { return Err(Error::new(StorageError::BucketNameInvalid(bucket.to_string()))); } diff --git a/ecstore/src/list_objects.rs b/ecstore/src/store_list_objects.rs similarity index 96% rename from ecstore/src/list_objects.rs rename to ecstore/src/store_list_objects.rs index bb1f4cd2d..119cb738f 100644 --- a/ecstore/src/list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -101,6 +101,7 @@ impl ListPathOptions { } impl ECStore { + #[allow(clippy::too_many_arguments)] pub async fn inner_list_objects_v2( &self, bucket: &str, @@ -120,7 +121,7 @@ impl ECStore { }; self.list_objects_generic(bucket, prefix, marker, delimiter, max_keys).await?; - + // FIXME:TODO: unimplemented!() } @@ -145,6 +146,8 @@ impl ECStore { let merged = self.list_path(&opts).await?; + // FIXME:TODO: + todo!() } @@ -159,10 +162,8 @@ impl ECStore { o.marker = "".to_owned(); } - if !o.marker.is_empty() && !o.prefix.is_empty() { - if !o.marker.starts_with(&o.prefix) { - return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); - } + if !o.marker.is_empty() && !o.prefix.is_empty() && !o.marker.starts_with(&o.prefix) { + return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); } if o.limit == 0 { @@ -194,6 +195,7 @@ impl ECStore { o.create = false; } + // FIXME:TODO: todo!() // let mut opts = opts.clone(); From 0cf7c19b96a69424d2cd5b047ca50ec87445d572 Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 5 Dec 2024 17:42:17 +0800 Subject: [PATCH 40/77] init metacache io --- ecstore/src/lib.rs | 2 +- ecstore/src/store.rs | 42 +++++++++++++++---------------- ecstore/src/store_list_objects.rs | 2 +- iam/src/store/object.rs | 16 ++++++------ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index ddd417b6e..642ab1525 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -25,7 +25,7 @@ pub mod store; pub mod store_api; pub mod store_err; mod store_init; -mod store_list_objects; +pub mod store_list_objects; pub mod utils; pub mod xhttp; diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index e583545d2..cfaedd03e 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -1016,32 +1016,32 @@ pub struct PoolObjInfo { pub err: Option, } -#[derive(Debug, Default, Clone)] -pub struct ListPathOptions { - pub id: String, +// #[derive(Debug, Default, Clone)] +// pub struct ListPathOptions { +// pub id: String, - // Bucket of the listing. - pub bucket: String, +// // Bucket of the listing. +// pub bucket: String, - // Directory inside the bucket. - // When unset listPath will set this based on Prefix - pub base_dir: String, +// // Directory inside the bucket. +// // When unset listPath will set this based on Prefix +// pub base_dir: String, - // Scan/return only content with prefix. - pub prefix: String, +// // Scan/return only content with prefix. +// pub prefix: String, - // FilterPrefix will return only results with this prefix when scanning. - // Should never contain a slash. - // Prefix should still be set. - pub filter_prefix: String, +// // FilterPrefix will return only results with this prefix when scanning. +// // Should never contain a slash. +// // Prefix should still be set. +// pub filter_prefix: String, - // Marker to resume listing. - // The response will be the first entry >= this object name. - pub marker: String, +// // Marker to resume listing. +// // The response will be the first entry >= this object name. +// pub marker: String, - // Limit the number of results. - pub limit: i32, -} +// // Limit the number of results. +// pub limit: i32, +// } #[async_trait::async_trait] impl ObjectIO for ECStore { @@ -1521,7 +1521,7 @@ impl StorageAPI for ECStore { fetch_owner: bool, start_after: &str, ) -> Result { - self.inner_list_objects_v2(&bucket, &prefix, &continuation_token, &delimiter, max_keys, fetch_owner, start_after) + self.inner_list_objects_v2(bucket, prefix, continuation_token, delimiter, max_keys, fetch_owner, start_after) .await // let opts = ListPathOptions { diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 119cb738f..5ff4586f1 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -151,7 +151,7 @@ impl ECStore { todo!() } - async fn list_path(&self, o: &ListPathOptions) -> Result { + pub async fn list_path(&self, o: &ListPathOptions) -> Result { check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?; // if opts.prefix.ends_with(SLASH_SEPARATOR) { // return Err(Error::msg("eof")); diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index 57c00ec26..230259668 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -2,8 +2,9 @@ use std::{collections::HashMap, path::Path, sync::Arc}; use ecstore::{ config::error::is_not_found, - store::{ECStore, ListPathOptions}, + store::ECStore, store_api::{HTTPRangeSpec, ObjectIO, ObjectInfo, ObjectOptions, PutObjReader}, + store_list_objects::ListPathOptions, utils::path::dir, }; use futures::future::try_join_all; @@ -42,14 +43,11 @@ impl ObjectStore { futures.push(async move { let items = self .object_api - .list_path( - &ListPathOptions { - bucket: Self::BUCKET_NAME.into(), - prefix: prefix.clone(), - ..Default::default() - }, - "", - ) + .list_path(&ListPathOptions { + bucket: Self::BUCKET_NAME.into(), + prefix: prefix.clone(), + ..Default::default() + }) .await; match items { From 25e38074282e784711a9a068cfe7cc729fb3924b Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 5 Dec 2024 17:40:55 +0800 Subject: [PATCH 41/77] init metacache io --- ecstore/src/cache_value/metacache_set.rs | 47 +++--- ecstore/src/disk/local.rs | 12 +- ecstore/src/disk/mod.rs | 16 +- ecstore/src/disk/remote.rs | 2 +- ecstore/src/io.rs | 68 ++++++++ ecstore/src/lib.rs | 2 + ecstore/src/metacache/mod.rs | 1 + ecstore/src/metacache/writer.rs | 206 +++++++++++++++++++++++ ecstore/src/set_disk.rs | 7 +- rustfs/src/grpc.rs | 2 +- 10 files changed, 330 insertions(+), 33 deletions(-) create mode 100644 ecstore/src/io.rs create mode 100644 ecstore/src/metacache/mod.rs create mode 100644 ecstore/src/metacache/writer.rs diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index 79601ac87..4e2bbe579 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -12,6 +12,7 @@ use tokio::{ use crate::{ disk::{DiskAPI, DiskStore, MetaCacheEntries, MetaCacheEntry, WalkDirOptions}, error::{Error, Result}, + io::Writer, }; type AgreedFn = Box Pin + Send>> + Send + 'static>; @@ -77,16 +78,19 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - match disk .as_ref() .unwrap() - .walk_dir(WalkDirOptions { - bucket: opts_clone.bucket.clone(), - base_dir: opts_clone.path.clone(), - recursive: opts_clone.recursice, - report_notfound: opts_clone.report_not_found, - filter_prefix: opts_clone.filter_prefix.clone(), - forward_to: opts_clone.forward_to.clone(), - limit: opts_clone.per_disk_limit, - ..Default::default() - }) + .walk_dir( + WalkDirOptions { + bucket: opts_clone.bucket.clone(), + base_dir: opts_clone.path.clone(), + recursive: opts_clone.recursice, + report_notfound: opts_clone.report_not_found, + filter_prefix: opts_clone.filter_prefix.clone(), + forward_to: opts_clone.forward_to.clone(), + limit: opts_clone.per_disk_limit, + ..Default::default() + }, + Writer::NotUse, + ) .await { Ok(r) => { @@ -115,16 +119,19 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - match disk .as_ref() .unwrap() - .walk_dir(WalkDirOptions { - bucket: opts_clone.bucket.clone(), - base_dir: opts_clone.path.clone(), - recursive: opts_clone.recursice, - report_notfound: opts_clone.report_not_found, - filter_prefix: opts_clone.filter_prefix.clone(), - forward_to: opts_clone.forward_to.clone(), - limit: opts_clone.per_disk_limit, - ..Default::default() - }) + .walk_dir( + WalkDirOptions { + bucket: opts_clone.bucket.clone(), + base_dir: opts_clone.path.clone(), + recursive: opts_clone.recursice, + report_notfound: opts_clone.report_not_found, + filter_prefix: opts_clone.filter_prefix.clone(), + forward_to: opts_clone.forward_to.clone(), + limit: opts_clone.per_disk_limit, + ..Default::default() + }, + Writer::NotUse, + ) .await { Ok(r) => { diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 98f2e0848..5994cfa3c 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -1293,10 +1293,18 @@ impl DiskAPI for LocalDisk { Ok(entries) } - // TODO: io.writer - async fn walk_dir(&self, opts: WalkDirOptions) -> Result> { + // FIXME: TODO: io.writer + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { // warn!("walk_dir opts {:?}", &opts); + let volume_dir = self.get_bucket_path(&opts.bucket)?; + + if !skip_access_checks(&opts.bucket) { + if let Err(e) = access(&volume_dir).await { + return Err(convert_access_error(e, DiskError::VolumeAccessDenied)); + } + } + let mut metas = Vec::new(); if opts.base_dir.ends_with(SLASH_SEPARATOR) { diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 03b51ba3d..56d975414 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -23,6 +23,7 @@ use crate::{ data_usage_cache::{DataUsageCache, DataUsageEntry}, heal_commands::{HealScanMode, HealingTracker}, }, + io, store_api::{FileInfo, RawFileInfo}, }; use endpoint::Endpoint; @@ -209,10 +210,10 @@ impl DiskAPI for Disk { } } - async fn walk_dir(&self, opts: WalkDirOptions) -> Result> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { match self { - Disk::Local(local_disk) => local_disk.walk_dir(opts).await, - Disk::Remote(remote_disk) => remote_disk.walk_dir(opts).await, + Disk::Local(local_disk) => local_disk.walk_dir(opts, wr).await, + Disk::Remote(remote_disk) => remote_disk.walk_dir(opts, wr).await, } } @@ -405,7 +406,7 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { async fn delete_volume(&self, volume: &str) -> Result<()>; // 并发边读边写 TODO: wr io.Writer - async fn walk_dir(&self, opts: WalkDirOptions) -> Result>; + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result>; // Metadata operations async fn delete_version( @@ -602,10 +603,10 @@ pub struct MetaCacheEntry { pub metadata: Vec, // cached contains the metadata if decoded. - cached: Option, + pub cached: Option, // Indicates the entry can be reused and only one reference to metadata is expected. - _reusable: bool, + pub reusable: bool, } impl MetaCacheEntry { @@ -619,6 +620,7 @@ impl MetaCacheEntry { Ok(wr) } + pub fn is_dir(&self) -> bool { self.metadata.is_empty() && self.name.ends_with('/') } @@ -841,7 +843,7 @@ impl MetaCacheEntries { meta_ver: selected.as_ref().unwrap().cached.as_ref().unwrap().meta_ver, ..Default::default() }), - _reusable: true, + reusable: true, ..Default::default() }); diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 8c1711131..6f5534c79 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -347,7 +347,7 @@ impl DiskAPI for RemoteDisk { Ok(response.volumes) } - async fn walk_dir(&self, opts: WalkDirOptions) -> Result> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { info!("walk_dir"); let walk_dir_options = serde_json::to_string(&opts)?; let mut client = node_service_time_out_client(&self.addr) diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs new file mode 100644 index 000000000..ca2c3904e --- /dev/null +++ b/ecstore/src/io.rs @@ -0,0 +1,68 @@ +use std::pin::Pin; +use std::task::{Context, Poll}; +use tokio::fs::File; +use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; + +#[derive(Default)] +pub enum Reader { + #[default] + NotUse, + File(File), +} + +impl AsyncRead for Reader { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll> { + match self.get_mut() { + Reader::File(file) => { + let file = Pin::new(file); + file.poll_read(cx, buf) + } + Reader::NotUse => Poll::Ready(Ok(())), + } + } +} + +#[derive(Default)] +pub enum Writer { + #[default] + NotUse, + File(File), +} + +impl AsyncWrite for Writer { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + match self.get_mut() { + Writer::File(file) => { + // Create a pinned reference from the file + let file = Pin::new(file); + file.poll_write(cx, buf) + } + Writer::NotUse => Poll::Ready(Ok(0)), + } + } + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + match self.get_mut() { + Writer::File(file) => { + let file = Pin::new(file); + file.poll_flush(cx) + } + Writer::NotUse => Poll::Ready(Ok(())), + } + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + match self.get_mut() { + Writer::File(file) => { + let file = Pin::new(file); + file.poll_shutdown(cx) + } + Writer::NotUse => Poll::Ready(Ok(())), + } + } +} + +// #[tokio::test] +// async fn test_reader{ + +// } diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index 642ab1525..0043ad04d 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -13,6 +13,8 @@ mod file_meta; pub mod file_meta_inline; pub mod global; pub mod heal; +pub mod io; +pub mod metacache; pub mod metrics_realtime; pub mod notification_sys; pub mod peer; diff --git a/ecstore/src/metacache/mod.rs b/ecstore/src/metacache/mod.rs new file mode 100644 index 000000000..d3baa8178 --- /dev/null +++ b/ecstore/src/metacache/mod.rs @@ -0,0 +1 @@ +pub mod writer; diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs new file mode 100644 index 000000000..0be530eb8 --- /dev/null +++ b/ecstore/src/metacache/writer.rs @@ -0,0 +1,206 @@ +use std::io::ErrorKind; +use std::io::Read; +use std::io::Write; +use std::str::from_utf8; + +use crate::disk::MetaCacheEntry; +use crate::error::Error; +use crate::error::Result; + +const METACACHE_STREAM_VERSION: u8 = 2; + +pub struct MetacacheWriter { + wr: W, + buf: Vec, + created: bool, +} + +impl MetacacheWriter { + pub fn new(wr: W, block_size: usize) -> Self { + Self { + wr, + buf: Vec::with_capacity(block_size), + created: false, + } + } + + async fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { + if objs.is_empty() { + return Ok(()); + } + + if !self.created { + rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; + self.created = false; + } + + for obj in objs.iter() { + if obj.name.is_empty() { + return Err(Error::msg("metacacheWriter: no name")); + } + + rmp::encode::write_bool(&mut self.wr, true)?; + + rmp::encode::write_str(&mut self.wr, &obj.name)?; + + rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; + } + + Ok(()) + } + + async fn close(&mut self) -> Result<()> { + rmp::encode::write_bool(&mut self.wr, false)?; + + self.wr.flush()?; + Ok(()) + } +} + +pub struct MetacacheReader { + rd: R, + init: bool, + err: Option, + buf: Vec, +} + +impl MetacacheReader { + pub fn new(rd: R) -> Self { + Self { + rd, + init: false, + err: None, + buf: Vec::new(), + } + } + + pub fn check_init(&mut self) { + if !self.init { + let ver = match rmp::decode::read_u8(&mut self.rd) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + 0 + } + }; + match ver { + 1 | 2 => (), + _ => { + self.err = Some(Error::msg("invalid version")); + } + } + + self.init = true; + } + } + + pub fn peek(&mut self) -> Result { + self.check_init(); + + if let Some(err) = &self.err { + return Err(err.clone()); + } + + match rmp::decode::read_bool(&mut self.rd) { + Ok(res) => { + if !res { + self.err = Some(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + } + } + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + + let l = match rmp::decode::read_str_len(&mut self.rd) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + + self.buf.resize(l as usize, 0); + let name = match self.rd.read_exact(&mut self.buf) { + Ok(()) => { + let name_buf = self.buf.to_vec(); + match from_utf8(&name_buf) { + Ok(decoded) => Ok(decoded.to_owned()), + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + Err(Error::msg(err.to_string())) + } + } + } + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + Err(Error::msg(err.to_string())) + } + }?; + + let l = match rmp::decode::read_bin_len(&mut self.rd) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + self.buf.resize(l as usize, 0); + match self.rd.read_exact(&mut self.buf) { + Ok(res) => res, + Err(err) => { + self.err = Some(Error::msg(err.to_string())); + return Err(Error::new(err)); + } + }; + + let metadata = self.buf.clone(); + + Ok(MetaCacheEntry { + name, + metadata, + cached: None, + reusable: false, + }) + } +} + +#[tokio::test] +async fn test_writer() { + use std::fs::File; + use std::fs::OpenOptions; + + let file_path = "./test_writer.txt"; + let f = OpenOptions::new() + .create(true) + .read(true) + .write(true) + .truncate(true) + .open(file_path) + .unwrap(); + + // let wr = Writer::File(f); + + let mut w = MetacacheWriter::new(f, 1024); + + let mut objs = Vec::new(); + for i in 0..10 { + objs.push(MetaCacheEntry { + name: format!("item{}", i), + metadata: vec![0u8, 10], + cached: None, + reusable: false, + }); + } + + w.write(&objs).await.unwrap(); + w.close().await.unwrap(); + + let nf = File::open(file_path).unwrap(); + + let meta = nf.metadata().unwrap(); + + println!("{}", meta.len()); +} diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 58c209d22..cde79dfc6 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -6,7 +6,6 @@ use std::{ time::Duration, }; -use crate::heal::heal_ops::{HealEntryFn, HealSequence}; use crate::{ bitrot::{bitrot_verify, close_bitrot_writers, new_bitrot_filereader, new_bitrot_filewriter, BitrotFileWriter}, cache_value::metacache_set::{list_path_raw, ListPathRawOptions}, @@ -56,6 +55,10 @@ use crate::{ heal::data_scanner::{globalHealConfig, HEAL_DELETE_DANGLING}, store_api::ListObjectVersionsInfo, }; +use crate::{ + heal::heal_ops::{HealEntryFn, HealSequence}, + io::Writer, +}; use futures::future::join_all; use glob::Pattern; use http::HeaderMap; @@ -1327,7 +1330,7 @@ impl SetDisks { let opts = opts.clone(); futures.push(async move { if let Some(disk) = disk { - disk.walk_dir(opts).await + disk.walk_dir(opts, Writer::NotUse).await } else { Err(Error::new(DiskError::DiskNotFound)) } diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index 881b11c69..c529ac8ca 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -743,7 +743,7 @@ impl Node for NodeService { })); } }; - match disk.walk_dir(opts).await { + match disk.walk_dir(opts, ecstore::io::Writer::NotUse).await { Ok(entries) => { let entries = entries .into_iter() From 43bc4db87c3106fab09024f5d818770e06170694 Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 6 Dec 2024 13:50:42 +0800 Subject: [PATCH 42/77] metacache done --- ecstore/src/disk/mod.rs | 2 +- ecstore/src/io.rs | 175 +++++++++++++++++++++++++++++++- ecstore/src/metacache/writer.rs | 97 ++++++++++-------- 3 files changed, 228 insertions(+), 46 deletions(-) diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 56d975414..5fec3bc29 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -594,7 +594,7 @@ pub struct MetadataResolutionParams { pub candidates: Vec>, } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)] pub struct MetaCacheEntry { // name is the full name of the object including prefixes pub name: String, diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index ca2c3904e..cdaabaebc 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -1,3 +1,5 @@ +use std::io::Read; +use std::io::Write; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::fs::File; @@ -62,7 +64,174 @@ impl AsyncWrite for Writer { } } -// #[tokio::test] -// async fn test_reader{ +pub struct AsyncToSync { + inner: R, +} -// } +impl AsyncToSync { + pub fn new_reader(inner: R) -> Self { + Self { inner } + } + fn read_async(&mut self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll> { + let mut read_buf = ReadBuf::new(buf); + // Poll the underlying AsyncRead to fill the ReadBuf + match Pin::new(&mut self.inner).poll_read(cx, &mut read_buf) { + Poll::Ready(Ok(())) => Poll::Ready(Ok(read_buf.filled().len())), + Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Pending => Poll::Pending, + } + } +} + +impl AsyncToSync { + pub fn new_writer(inner: R) -> Self { + Self { inner } + } + // This function will perform a write using AsyncWrite + fn write_async(&mut self, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + let result = Pin::new(&mut self.inner).poll_write(cx, buf); + match result { + Poll::Ready(Ok(n)) => Poll::Ready(Ok(n)), + Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Pending => Poll::Pending, + } + } + + // This function will perform a flush using AsyncWrite + fn flush_async(&mut self, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.inner).poll_flush(cx) + } +} + +impl Read for AsyncToSync { + fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); + loop { + match self.read_async(&mut cx, buf) { + Poll::Ready(Ok(n)) => return Ok(n), + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => { + // If Pending, we need to wait for the readiness. + // Here, we can use an arbitrary mechanism to yield control, + // this might be blocking until some readiness occurs can be complex. + // A full blocking implementation would require an async runtime to block on. + std::thread::sleep(std::time::Duration::from_millis(1)); // Replace with proper waiting if needed + } + } + } + } +} + +impl Write for AsyncToSync { + fn write(&mut self, buf: &[u8]) -> std::io::Result { + let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); + loop { + match self.write_async(&mut cx, buf) { + Poll::Ready(Ok(n)) => return Ok(n), + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => { + // Here we are blocking and waiting for the async operation to complete. + std::thread::sleep(std::time::Duration::from_millis(1)); // Not efficient, see notes. + } + } + } + } + + fn flush(&mut self) -> std::io::Result<()> { + let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); + loop { + match self.flush_async(&mut cx) { + Poll::Ready(Ok(())) => return Ok(()), + Poll::Ready(Err(e)) => return Err(e), + Poll::Pending => { + // Again, blocking to wait for flush. + std::thread::sleep(std::time::Duration::from_millis(1)); // Not efficient, see notes. + } + } + } + } +} + +pub struct VecAsyncWriter { + buffer: Vec, +} + +impl VecAsyncWriter { + /// Create a new VecAsyncWriter with an empty Vec. + pub fn new(buffer: Vec) -> Self { + VecAsyncWriter { buffer } + } + + /// Retrieve the underlying buffer. + pub fn get_buffer(&self) -> &[u8] { + &self.buffer + } +} + +// Implementing AsyncWrite trait for VecAsyncWriter +impl AsyncWrite for VecAsyncWriter { + fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + let len = buf.len(); + + // Assume synchronous writing for simplicity + self.get_mut().buffer.extend_from_slice(buf); + + // Returning the length of written data + Poll::Ready(Ok(len)) + } + + fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { + // In this case, flushing is a no-op for a Vec + Poll::Ready(Ok(())) + } + + fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + // Similar to flush, shutdown has no effect here + Poll::Ready(Ok(())) + } +} + +pub struct VecAsyncReader { + buffer: Vec, + position: usize, +} + +impl VecAsyncReader { + /// Create a new VecAsyncReader with the given Vec. + pub fn new(buffer: Vec) -> Self { + VecAsyncReader { buffer, position: 0 } + } + + /// Reset the reader position. + pub fn reset(&mut self) { + self.position = 0; + } +} + +// Implementing AsyncRead trait for VecAsyncReader +impl AsyncRead for VecAsyncReader { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf) -> Poll> { + let this = self.get_mut(); + + // Check how many bytes are available to read + let len = this.buffer.len(); + let bytes_available = len - this.position; + + if bytes_available == 0 { + // If there's no more data to read, return ready with an Eof + return Poll::Ready(Ok(())); + } + + // Calculate how much we can read into the provided buffer + let to_read = std::cmp::min(bytes_available, buf.remaining()); + + // Write the data to the buf + buf.put_slice(&this.buffer[this.position..this.position + to_read]); + + // Update the position + this.position += to_read; + + // Indicate how many bytes were read + Poll::Ready(Ok(())) + } +} diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 0be530eb8..57b0d189e 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -1,30 +1,23 @@ -use std::io::ErrorKind; -use std::io::Read; -use std::io::Write; -use std::str::from_utf8; - use crate::disk::MetaCacheEntry; use crate::error::Error; use crate::error::Result; +use std::io::Read; +use std::io::Write; +use std::str::from_utf8; const METACACHE_STREAM_VERSION: u8 = 2; pub struct MetacacheWriter { wr: W, - buf: Vec, created: bool, } -impl MetacacheWriter { - pub fn new(wr: W, block_size: usize) -> Self { - Self { - wr, - buf: Vec::with_capacity(block_size), - created: false, - } +impl MetacacheWriter { + pub fn new(wr: W) -> Self { + Self { wr, created: false } } - async fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { + pub fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { if objs.is_empty() { return Ok(()); } @@ -49,9 +42,8 @@ impl MetacacheWriter { Ok(()) } - async fn close(&mut self) -> Result<()> { + pub fn close(&mut self) -> Result<()> { rmp::encode::write_bool(&mut self.wr, false)?; - self.wr.flush()?; Ok(()) } @@ -74,8 +66,15 @@ impl MetacacheReader { } } - pub fn check_init(&mut self) { + fn check_init(&mut self) { if !self.init { + // let mut buf = match self.read_buf(1).await { + // Ok(res) => res, + // Err(err) => { + // self.err = Some(Error::msg(err.to_string())); + // return; + // } + // }; let ver = match rmp::decode::read_u8(&mut self.rd) { Ok(res) => res, Err(err) => { @@ -94,7 +93,7 @@ impl MetacacheReader { } } - pub fn peek(&mut self) -> Result { + pub fn peek(&mut self) -> Result> { self.check_init(); if let Some(err) = &self.err { @@ -104,8 +103,7 @@ impl MetacacheReader { match rmp::decode::read_bool(&mut self.rd) { Ok(res) => { if !res { - self.err = Some(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); - return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + return Ok(None); } } Err(err) => { @@ -158,49 +156,64 @@ impl MetacacheReader { let metadata = self.buf.clone(); - Ok(MetaCacheEntry { + Ok(Some(MetaCacheEntry { name, metadata, cached: None, reusable: false, - }) + })) + } + + pub fn read_all(&mut self) -> Result> { + let mut ret = Vec::new(); + + loop { + if let Some(entry) = self.peek()? { + ret.push(entry); + continue; + } + + break; + } + + Ok(ret) } } #[tokio::test] async fn test_writer() { - use std::fs::File; - use std::fs::OpenOptions; + use crate::io::AsyncToSync; + use crate::io::VecAsyncReader; + use crate::io::VecAsyncWriter; - let file_path = "./test_writer.txt"; - let f = OpenOptions::new() - .create(true) - .read(true) - .write(true) - .truncate(true) - .open(file_path) - .unwrap(); + let mut f = VecAsyncWriter::new(Vec::new()); - // let wr = Writer::File(f); - - let mut w = MetacacheWriter::new(f, 1024); + let mut w = MetacacheWriter::new(AsyncToSync::new_writer(&mut f)); let mut objs = Vec::new(); for i in 0..10 { - objs.push(MetaCacheEntry { + let info = MetaCacheEntry { name: format!("item{}", i), metadata: vec![0u8, 10], cached: None, reusable: false, - }); + }; + println!("old {:?}", &info); + objs.push(info); } - w.write(&objs).await.unwrap(); - w.close().await.unwrap(); + w.write(&objs).unwrap(); - let nf = File::open(file_path).unwrap(); + w.close().unwrap(); - let meta = nf.metadata().unwrap(); + let nf = VecAsyncReader::new(f.get_buffer().to_vec()); - println!("{}", meta.len()); + let mut r = MetacacheReader::new(AsyncToSync::new_reader(nf)); + let nobjs = r.read_all().unwrap(); + + for info in nobjs.iter() { + println!("new {:?}", &info); + } + + assert_eq!(objs, nobjs) } From 5501649d7974781a1e452570344d633c00a0f6eb Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 9 Dec 2024 10:03:02 +0800 Subject: [PATCH 43/77] scandir --- ecstore/src/disk/local.rs | 255 +++++++++++++++++++++----------- ecstore/src/metacache/writer.rs | 74 +++++++-- 2 files changed, 236 insertions(+), 93 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 5994cfa3c..8eec78e08 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -26,6 +26,8 @@ use crate::heal::data_usage_cache::{DataUsageCache, DataUsageEntry}; use crate::heal::error::{ERR_IGNORE_FILE_CONTRIB, ERR_SKIP_FILE}; use crate::heal::heal_commands::{HealScanMode, HealingTracker}; use crate::heal::heal_ops::HEALING_TRACKER_FILENAME; +use crate::io::AsyncToSync; +use crate::metacache::writer::MetacacheWriter; use crate::new_object_layer_fn; use crate::set_disk::{ conv_part_err_to_int, CHECK_PART_FILE_CORRUPT, CHECK_PART_FILE_NOT_FOUND, CHECK_PART_SUCCESS, CHECK_PART_UNKNOWN, @@ -34,7 +36,7 @@ use crate::set_disk::{ use crate::store_api::{BitrotAlgorithm, StorageAPI}; use crate::utils::fs::{access, lstat, O_APPEND, O_CREATE, O_RDONLY, O_WRONLY}; use crate::utils::os::get_info; -use crate::utils::path::{clean, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; +use crate::utils::path::{clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; use crate::{ file_meta::FileMeta, store_api::{FileInfo, RawFileInfo}, @@ -45,7 +47,7 @@ use nix::NixPath; use path_absolutize::Absolutize; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; -use std::io::Cursor; +use std::io::{Cursor, Write}; use std::os::unix::fs::MetadataExt; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; @@ -59,7 +61,7 @@ use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{info, warn}; +use tracing::{error, info, warn}; use uuid::Uuid; #[derive(Debug)] @@ -712,6 +714,162 @@ impl LocalDisk { let n = file.read_to_end(&mut data).await?; bitrot_verify(&mut Cursor::new(data), n, part_size, algo, sum.to_vec(), shard_size) } + + async fn scan_dir( + &self, + current: &mut String, + opts: &WalkDirOptions, + out: &mut MetacacheWriter, + objs_returned: &mut i32, + ) -> Result<()> { + let forward = { + if !opts.forward_to.is_empty() && opts.forward_to.starts_with(&*current) { + let forward = opts.forward_to.trim_start_matches(&*current); + if let Some(idx) = forward.find('/') { + &forward[..idx] + } else { + forward + } + } else { + "" + } + }; + + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + + let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { + Ok(res) => res, + Err(e) => { + if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { + info!("list_dir err {:?}", &e); + } + + if opts.report_notfound && is_err_file_not_found(&e) { + return Err(e); + } + return Ok(()); + } + }; + + if entries.is_empty() { + return Ok(()); + } + + let s = SLASH_SEPARATOR.chars().next().unwrap_or_default(); + *current = current.trim_matches(s).to_owned(); + + let bucket = opts.bucket.as_str(); + + let mut dir_objes = HashSet::new(); + + // 第一层过滤 + for item in entries.iter_mut() { + // warn!("walk_dir get entry {:?}", &entry); + + let entry = item.clone(); + // check limit + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + // check prefix + if !opts.filter_prefix.is_empty() && !entry.starts_with(&opts.filter_prefix) { + *item = "".to_owned(); + continue; + } + + if !forward.is_empty() && entry.as_str() < forward { + *item = "".to_owned(); + continue; + } + + if entry.ends_with(SLASH_SEPARATOR) { + if entry.ends_with(GLOBAL_DIR_SUFFIX_WITH_SLASH) { + let entry = format!("{}{}", entry.as_str().trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH), SLASH_SEPARATOR); + dir_objes.insert(entry.clone()); + *item = entry; + continue; + } + + *item = entry.trim_end_matches(SLASH_SEPARATOR).to_owned(); + continue; + } + + *item = "".to_owned(); + + if entry.ends_with(STORAGE_FORMAT_FILE) { + // + let metadata = self + .read_metadata(self.get_object_path(bucket, format!("{}/{}", ¤t, &entry).as_str())?) + .await?; + let name = entry.trim_end_matches(STORAGE_FORMAT_FILE).trim_end_matches(SLASH_SEPARATOR); + let name = decode_dir_object(format!("{}/{}", ¤t, &name).as_str()); + + out.write_obj(&MetaCacheEntry { + name, + metadata, + ..Default::default() + })?; + *objs_returned += 1; + return Ok(()); + } + } + + entries.sort(); + + let mut entries = entries.as_slice(); + if !forward.is_empty() { + for (i, entry) in entries.iter().enumerate() { + if entry.as_str() >= forward || forward.starts_with(entry.as_str()) { + entries = &entries[i..]; + break; + } + } + } + + let prefix = ""; + let mut dir_stack: Vec = Vec::with_capacity(5); + + for entry in entries.iter() { + // + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + + if entry.is_empty() { + continue; + } + + let name = format!("{}{}", current, entry); + + if !dir_stack.is_empty() { + if let Some(pop) = dir_stack.pop() { + if pop < name { + // + out.write_obj(&MetaCacheEntry { + name: pop, + ..Default::default() + })?; + + if opts.recursive { + if let Err(er) = Box::pin(self.scan_dir(current, opts, out, objs_returned)).await { + error!("scan_dir err {:?}", er); + } + } + } + } + } + + if let Some(dir) = dir_objes.get(entry) { + // + } + } + + // FIXME:TODO: + + Ok(()) + } } fn is_root_path(path: impl AsRef) -> bool { @@ -1293,7 +1451,7 @@ impl DiskAPI for LocalDisk { Ok(entries) } - // FIXME: TODO: io.writer + // FIXME: TODO: io.writer TODO cancel async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { // warn!("walk_dir opts {:?}", &opts); @@ -1305,7 +1463,11 @@ impl DiskAPI for LocalDisk { } } - let mut metas = Vec::new(); + let mut wr = wr; + + let mut out = MetacacheWriter::new(AsyncToSync::new_writer(&mut wr)); + + let mut objs_returned = 0; if opts.base_dir.ends_with(SLASH_SEPARATOR) { let fpath = self.get_object_path( @@ -1318,87 +1480,14 @@ impl DiskAPI for LocalDisk { metadata: data, ..Default::default() }; - metas.push(meta); - return Ok(metas); + out.write_obj(&meta)?; + objs_returned += 1; } } - let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { - Ok(res) => res, - Err(e) => { - if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { - info!("list_dir err {:?}", &e); - } - - if opts.report_notfound && is_err_file_not_found(&e) { - return Err(e); - } - return Ok(Vec::new()); - } - }; - - if entries.is_empty() { - return Ok(Vec::new()); - } - - entries.sort(); - - // 已读计数 - let objs_returned = 0; - - let bucket = opts.bucket.as_str(); - - let mut dir_objes = HashSet::new(); - - // 第一层过滤 - for entry in entries.iter() { - // warn!("walk_dir get entry {:?}", &entry); - - // check limit - if opts.limit > 0 && objs_returned >= opts.limit { - return Ok(metas); - } - // check prefix - if !opts.filter_prefix.is_empty() && !entry.starts_with(&opts.filter_prefix) { - continue; - } - - let mut meta = MetaCacheEntry { ..Default::default() }; - - let mut name = { - if opts.base_dir.is_empty() { - entry.clone() - } else { - format!("{}{}{}", opts.base_dir.trim_end_matches(SLASH_SEPARATOR), SLASH_SEPARATOR, entry) - } - }; - - if name.ends_with(SLASH_SEPARATOR) { - if name.ends_with(GLOBAL_DIR_SUFFIX_WITH_SLASH) { - name = format!("{}{}", name.as_str().trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH), SLASH_SEPARATOR); - dir_objes.insert(name.clone()); - } else { - name = name.as_str().trim_end_matches(SLASH_SEPARATOR).to_owned(); - } - } - meta.name = name; - - let fpath = self.get_object_path(bucket, format!("{}/{}", &meta.name, STORAGE_FORMAT_FILE).as_str())?; - - if let Ok(data) = self.read_metadata(&fpath).await { - meta.metadata = data; - } else { - let fpath = self.get_object_path(bucket, &meta.name)?; - - if !is_empty_dir(fpath).await { - meta.name = format!("{}{}", &meta.name, SLASH_SEPARATOR); - } - } - - metas.push(meta); - } - - Ok(metas) + let mut current = opts.base_dir.clone(); + self.scan_dir(&mut current, &opts, &mut out, &mut objs_returned).await?; + Ok(Vec::new()) } // #[tracing::instrument(skip(self))] diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 57b0d189e..cc23cf6ec 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -4,17 +4,35 @@ use crate::error::Result; use std::io::Read; use std::io::Write; use std::str::from_utf8; +// use std::sync::Arc; +// use tokio::sync::mpsc; +// use tokio::sync::mpsc::Sender; +// use tokio::task; const METACACHE_STREAM_VERSION: u8 = 2; +#[derive(Debug)] pub struct MetacacheWriter { wr: W, created: bool, + // err: Option, } impl MetacacheWriter { pub fn new(wr: W) -> Self { - Self { wr, created: false } + Self { + wr, + created: false, + // err: None, + } + } + + pub fn init(&mut self) -> Result<()> { + if !self.created { + rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; + self.created = true; + } + Ok(()) } pub fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { @@ -22,26 +40,62 @@ impl MetacacheWriter { return Ok(()); } - if !self.created { - rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; - self.created = false; - } + self.init()?; for obj in objs.iter() { if obj.name.is_empty() { return Err(Error::msg("metacacheWriter: no name")); } - rmp::encode::write_bool(&mut self.wr, true)?; - - rmp::encode::write_str(&mut self.wr, &obj.name)?; - - rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; + self.write_obj(obj)?; } Ok(()) } + pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + self.init()?; + rmp::encode::write_bool(&mut self.wr, true)?; + + rmp::encode::write_str(&mut self.wr, &obj.name)?; + + rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; + Ok(()) + } + + // pub async fn stream(&mut self) -> Result> { + // let (sender, mut receiver) = mpsc::channel::(100); + + // let wr = Arc::new(self); + + // task::spawn(async move { + // while let Some(obj) = receiver.recv().await { + // // if obj.name.is_empty() || self.err.is_some() { + // // continue; + // // } + + // let _ = wr.write_obj(&obj); + + // // if let Err(err) = rmp::encode::write_bool(&mut self.wr, true) { + // // self.err = Some(Error::new(err)); + // // continue; + // // } + + // // if let Err(err) = rmp::encode::write_str(&mut self.wr, &obj.name) { + // // self.err = Some(Error::new(err)); + // // continue; + // // } + + // // if let Err(err) = rmp::encode::write_bin(&mut self.wr, &obj.metadata) { + // // self.err = Some(Error::new(err)); + // // continue; + // // } + // } + // }); + + // Ok(sender) + // } + pub fn close(&mut self) -> Result<()> { rmp::encode::write_bool(&mut self.wr, false)?; self.wr.flush()?; From b7fdd5f70acd185a67f7bf720a6c78c777bba193 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 9 Dec 2024 15:55:02 +0800 Subject: [PATCH 44/77] test walk --- ecstore/src/disk/local.rs | 108 ++++++++++++++++++++++++++++++-- ecstore/src/metacache/writer.rs | 2 + 2 files changed, 106 insertions(+), 4 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 8eec78e08..8ab0f6ee0 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -6,7 +6,8 @@ use super::{endpoint::Endpoint, error::DiskError, format::FormatV3}; use super::{ os, CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskMetrics, FileInfoVersions, FileReader, FileWriter, Info, MetaCacheEntry, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, - UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET, STORAGE_FORMAT_FILE_BACKUP, + UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, FORMAT_CONFIG_FILE, RUSTFS_META_BUCKET, + STORAGE_FORMAT_FILE_BACKUP, }; use crate::bitrot::bitrot_verify; use crate::bucket::metadata_sys::{self}; @@ -739,9 +740,12 @@ impl LocalDisk { return Ok(()); } + println!("list_dir opts {} {}", &opts.bucket, &opts.base_dir); + let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { Ok(res) => res, Err(e) => { + println!("list_dir err {:?}", &e); if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { info!("list_dir err {:?}", &e); } @@ -749,10 +753,13 @@ impl LocalDisk { if opts.report_notfound && is_err_file_not_found(&e) { return Err(e); } + return Ok(()); } }; + println!("list_dir entries {:?}", &entries); + if entries.is_empty() { return Ok(()); } @@ -861,12 +868,71 @@ impl LocalDisk { } } - if let Some(dir) = dir_objes.get(entry) { - // + let mut meta = MetaCacheEntry { + name, + ..Default::default() + }; + + let mut is_dir_obj = false; + + if let Some(_dir) = dir_objes.get(entry) { + is_dir_obj = true; + meta.name + .truncate(meta.name.len() - meta.name.chars().last().unwrap().len_utf8()); + meta.name.push_str(GLOBAL_DIR_SUFFIX_WITH_SLASH); } + + match self + .read_metadata(self.get_object_path(&opts.bucket, format!("{}/{}", &meta.name, FORMAT_CONFIG_FILE).as_str())?) + .await + { + Ok(res) => { + if is_dir_obj { + meta.name = meta.name.trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH).to_owned(); + meta.name.push_str(SLASH_SEPARATOR); + } + + meta.metadata = res; + + out.write_obj(&meta)?; + *objs_returned += 1; + } + Err(err) => { + warn!("scan dir read_metadata err {:?}", err); + if let Some(e) = err.downcast_ref::() { + if os_is_not_exist(e) || is_sys_err_is_dir(e) { + // NOT an object, append to stack (with slash) + // If dirObject, but no metadata (which is unexpected) we skip it. + if !is_dir_obj && !is_empty_dir(self.get_object_path(&opts.bucket, &meta.name)?).await { + meta.name.push_str(SLASH_SEPARATOR); + dir_stack.push(meta.name); + } + } + } + + continue; + } + }; } - // FIXME:TODO: + while let Some(dir) = dir_stack.pop() { + if opts.limit > 0 && *objs_returned >= opts.limit { + return Ok(()); + } + + out.write_obj(&MetaCacheEntry { + name: dir.clone(), + ..Default::default() + })?; + *objs_returned += 1; + + if opts.recursive { + let mut dir = dir; + if let Err(er) = Box::pin(self.scan_dir(&mut dir, opts, out, objs_returned)).await { + warn!("scan_dir err {:?}", &er); + } + } + } Ok(()) } @@ -1452,6 +1518,7 @@ impl DiskAPI for LocalDisk { } // FIXME: TODO: io.writer TODO cancel + #[tracing::instrument(level = "debug", skip(self, wr))] async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { // warn!("walk_dir opts {:?}", &opts); @@ -2266,6 +2333,9 @@ async fn get_disk_info(drive_path: PathBuf) -> Result<(Info, bool)> { #[cfg(test)] mod test { + use utils::fs::open_file; + use utils::fs::O_RDWR; + use super::*; #[tokio::test] @@ -2345,4 +2415,34 @@ mod test { let _ = fs::remove_dir_all(&p).await; } + + #[tokio::test] + async fn test_walk_dir() { + let ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + let disk = match LocalDisk::new(&ep, false).await { + Ok(res) => res, + Err(err) => { + println!("LocalDisk::new err {:?}", err); + return; + } + }; + + let mut f = match open_file("./testfile.txt", O_CREATE | O_RDWR).await { + Ok(res) => res, + Err(err) => { + println!("openfile err {:?}", err); + return; + } + }; + + let opts = WalkDirOptions { + bucket: "dada".to_owned(), + // base_dir: "dada".to_owned(), + recursive: true, + ..Default::default() + }; + if let Err(err) = disk.walk_dir(opts, crate::io::Writer::File(f)).await { + println!("walk_dir err {:?}", err); + } + } } diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index cc23cf6ec..0ce58d9a5 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -54,6 +54,8 @@ impl MetacacheWriter { } pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + println!("write_obj {:?}", &obj); + self.init()?; rmp::encode::write_bool(&mut self.wr, true)?; From 707311f3d805edaf709cdd7cc93125c1e51d037d Mon Sep 17 00:00:00 2001 From: mujunxiang <1948535941@qq.com> Date: Fri, 6 Dec 2024 14:32:17 +0800 Subject: [PATCH 45/77] tmp(1) Signed-off-by: mujunxiang <1948535941@qq.com> --- ecstore/src/heal/heal_ops.rs | 2 +- ecstore/src/notification_sys.rs | 6 ++---- ecstore/src/store_api.rs | 1 + madmin/Cargo.toml | 1 + rustfs/src/admin/handlers/trace.rs | 7 ++++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ecstore/src/heal/heal_ops.rs b/ecstore/src/heal/heal_ops.rs index b7b694b41..ed774ecbe 100644 --- a/ecstore/src/heal/heal_ops.rs +++ b/ecstore/src/heal/heal_ops.rs @@ -2,7 +2,7 @@ use super::{ background_heal_ops::HealTask, data_scanner::HEAL_DELETE_DANGLING, error::ERR_SKIP_FILE, - heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, + heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingDisk, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, }; use crate::store_api::StorageAPI; use crate::{ diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index 8a994d939..aaf6d4d12 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -32,7 +32,7 @@ pub struct NotificationSys { impl NotificationSys { pub async fn new(eps: EndpointServerPools) -> Self { - let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(eps).await; + let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(&eps).await; Self { peer_clients, all_peer_clients, @@ -46,9 +46,7 @@ pub struct NotificationPeerErr { } impl NotificationSys { - pub fn rest_client_from_hash(&self, s:&str) ->Option{ - - + pub fn rest_client_from_hash(&self, s: &str) -> Option { None } pub async fn delete_policy(&self) -> Vec { diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index fc37c3ccc..48a860fee 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -9,6 +9,7 @@ use crate::{ use futures::StreamExt; use http::HeaderMap; use madmin::heal_commands::HealResultItem; +use madmin::info_commands::DiskMetrics; use rmp_serde::Serializer; use s3s::{dto::StreamingBlob, Body}; use serde::{Deserialize, Serialize}; diff --git a/madmin/Cargo.toml b/madmin/Cargo.toml index 5a32ec152..1d385f9b9 100644 --- a/madmin/Cargo.toml +++ b/madmin/Cargo.toml @@ -18,3 +18,4 @@ psutil = "3.3.0" serde.workspace = true time.workspace =true tracing.workspace = true +time.workspace =true diff --git a/rustfs/src/admin/handlers/trace.rs b/rustfs/src/admin/handlers/trace.rs index 0134c4fd6..cf3c1710a 100644 --- a/rustfs/src/admin/handlers/trace.rs +++ b/rustfs/src/admin/handlers/trace.rs @@ -4,6 +4,7 @@ use hyper::Uri; use madmin::service_commands::ServiceTraceOpts; use matchit::Params; use s3s::{s3_error, Body, S3Request, S3Response, S3Result}; +use tokio::sync::mpsc; use tracing::warn; use crate::admin::router::Operation; @@ -24,11 +25,11 @@ impl Operation for Trace { async fn call(&self, req: S3Request, _params: Params<'_, '_>) -> S3Result> { warn!("handle Trace"); - let _trace_opts = extract_trace_options(&req.uri)?; + let trace_opts = extract_trace_options(&req.uri)?; // let (tx, rx) = mpsc::channel(10000); - let _perrs = match GLOBAL_Endpoints.get() { - Some(ep) => PeerRestClient::new_clients(ep.clone()).await, + let perrs = match GLOBAL_Endpoints.get() { + Some(ep) => PeerRestClient::new_clients(ep).await, None => (Vec::new(), Vec::new()), }; return Err(s3_error!(NotImplemented)); From 78d00d60f30d5ac1d83d345043f5ea07b12d1089 Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 10 Dec 2024 16:59:27 +0800 Subject: [PATCH 46/77] AssumeRoleHandle done --- ecstore/src/store_api.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index 48a860fee..fc37c3ccc 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -9,7 +9,6 @@ use crate::{ use futures::StreamExt; use http::HeaderMap; use madmin::heal_commands::HealResultItem; -use madmin::info_commands::DiskMetrics; use rmp_serde::Serializer; use s3s::{dto::StreamingBlob, Body}; use serde::{Deserialize, Serialize}; From 92cafd766e827467be38976afcafbcdc6c08650a Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 11 Dec 2024 16:05:29 +0800 Subject: [PATCH 47/77] fix:#159, fix:#160 --- ecstore/src/set_disk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index cde79dfc6..621ab8e6e 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1605,7 +1605,7 @@ impl SetDisks { // TODO: 优化并发 可用数量中断 let (parts_metadata, errs) = Self::read_all_fileinfo(&disks, "", bucket, object, vid.as_str(), read_data, false).await; // warn!("get_object_fileinfo parts_metadata {:?}", &parts_metadata); - // warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); + warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); let _min_disks = self.set_drive_count - self.default_parity_count; From b92d68e4aa6dfb7ebef331edddf463c3c8b19d4c Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 11:15:49 +0800 Subject: [PATCH 48/77] clippy --- ecstore/src/disk/local.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 8ab0f6ee0..2c44ca105 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -62,7 +62,7 @@ use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{error, info, warn}; +use tracing::{info, warn}; use uuid::Uuid; #[derive(Debug)] From 5ef03665bd3741348b7024c68adeddd82193f970 Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 13 Dec 2024 16:14:57 +0800 Subject: [PATCH 49/77] test --- ecstore/src/disk/local.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 2c44ca105..06477765c 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -2418,7 +2418,11 @@ mod test { #[tokio::test] async fn test_walk_dir() { - let ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + ep.pool_idx = 0; + ep.set_idx = 0; + ep.disk_idx = 0; + let disk = match LocalDisk::new(&ep, false).await { Ok(res) => res, Err(err) => { From a46aaf3f118c2e523a73c7c4499844dbcbbfd98e Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 13 Dec 2024 17:13:32 +0800 Subject: [PATCH 50/77] test work_dir done --- ecstore/src/disk/local.rs | 29 ++++++++++------------------- ecstore/src/metacache/writer.rs | 2 -- ecstore/src/utils/path.rs | 27 +++++++++++++++++++++++++++ scripts/run.sh | 4 ++-- 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 06477765c..7a11bb5b8 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -37,7 +37,7 @@ use crate::set_disk::{ use crate::store_api::{BitrotAlgorithm, StorageAPI}; use crate::utils::fs::{access, lstat, O_APPEND, O_CREATE, O_RDONLY, O_WRONLY}; use crate::utils::os::get_info; -use crate::utils::path::{clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; +use crate::utils::path::{self, clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; use crate::{ file_meta::FileMeta, store_api::{FileInfo, RawFileInfo}, @@ -740,26 +740,19 @@ impl LocalDisk { return Ok(()); } - println!("list_dir opts {} {}", &opts.bucket, &opts.base_dir); - - let mut entries = match self.list_dir("", &opts.bucket, &opts.base_dir, -1).await { + let mut entries = match self.list_dir("", &opts.bucket, current, -1).await { Ok(res) => res, Err(e) => { - println!("list_dir err {:?}", &e); - if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { - info!("list_dir err {:?}", &e); - } + if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) {} - if opts.report_notfound && is_err_file_not_found(&e) { - return Err(e); + if opts.report_notfound && is_err_file_not_found(&e) && current == &opts.base_dir { + return Err(Error::new(DiskError::FileNotFound)); } return Ok(()); } }; - println!("list_dir entries {:?}", &entries); - if entries.is_empty() { return Ok(()); } @@ -848,7 +841,7 @@ impl LocalDisk { continue; } - let name = format!("{}{}", current, entry); + let name = path::path_join_buf(&[current, &entry]); if !dir_stack.is_empty() { if let Some(pop) = dir_stack.pop() { @@ -882,10 +875,9 @@ impl LocalDisk { meta.name.push_str(GLOBAL_DIR_SUFFIX_WITH_SLASH); } - match self - .read_metadata(self.get_object_path(&opts.bucket, format!("{}/{}", &meta.name, FORMAT_CONFIG_FILE).as_str())?) - .await - { + let fname = format!("{}/{}", &meta.name, STORAGE_FORMAT_FILE); + + match self.read_metadata(self.get_object_path(&opts.bucket, fname.as_str())?).await { Ok(res) => { if is_dir_obj { meta.name = meta.name.trim_end_matches(GLOBAL_DIR_SUFFIX_WITH_SLASH).to_owned(); @@ -898,7 +890,6 @@ impl LocalDisk { *objs_returned += 1; } Err(err) => { - warn!("scan dir read_metadata err {:?}", err); if let Some(e) = err.downcast_ref::() { if os_is_not_exist(e) || is_sys_err_is_dir(e) { // NOT an object, append to stack (with slash) @@ -928,6 +919,7 @@ impl LocalDisk { if opts.recursive { let mut dir = dir; + if let Err(er) = Box::pin(self.scan_dir(&mut dir, opts, out, objs_returned)).await { warn!("scan_dir err {:?}", &er); } @@ -2441,7 +2433,6 @@ mod test { let opts = WalkDirOptions { bucket: "dada".to_owned(), - // base_dir: "dada".to_owned(), recursive: true, ..Default::default() }; diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 0ce58d9a5..cc23cf6ec 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -54,8 +54,6 @@ impl MetacacheWriter { } pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { - println!("write_obj {:?}", &obj); - self.init()?; rmp::encode::write_bool(&mut self.wr, true)?; diff --git a/ecstore/src/utils/path.rs b/ecstore/src/utils/path.rs index cd538bc07..9f2c22a08 100644 --- a/ecstore/src/utils/path.rs +++ b/ecstore/src/utils/path.rs @@ -1,3 +1,4 @@ +use std::path::Path; use std::path::PathBuf; const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; @@ -69,6 +70,32 @@ pub fn path_join(elem: &[PathBuf]) -> PathBuf { joined_path } +pub fn path_join_buf(elements: &[&str]) -> String { + let trailing_slash = !elements.is_empty() && elements.last().unwrap().ends_with('/'); + + let mut dst = String::new(); + let mut added = 0; + + for e in elements { + if added > 0 || !e.is_empty() { + if added > 0 { + dst.push('/'); + } + dst.push_str(e); + added += e.len(); + } + } + + let result = dst.to_string(); + let cpath = Path::new(&result).components().collect::(); + let clean_path = cpath.to_string_lossy(); + + if trailing_slash { + return format!("{}/", clean_path); + } + clean_path.to_string() +} + pub fn path_to_bucket_object_with_base_path(bash_path: &str, path: &str) -> (String, String) { let path = path.trim_start_matches(bash_path).trim_start_matches(SLASH_SEPARATOR); if let Some(m) = path.find(SLASH_SEPARATOR) { diff --git a/scripts/run.sh b/scripts/run.sh index 5b1326e6a..4f1942d12 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -18,8 +18,8 @@ fi export RUSTFS_STORAGE_CLASS_INLINE_BLOCK="512 KB" -DATA_DIR_ARG="./target/volume/test{0...4}" -# DATA_DIR_ARG="./target/volume/test" +# DATA_DIR_ARG="./target/volume/test{0...4}" +DATA_DIR_ARG="./target/volume/test" if [ -n "$1" ]; then DATA_DIR_ARG="$1" From adf4cfd76a2fb5dc98e8ea7f995ec7792aba3c2f Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 09:29:44 +0800 Subject: [PATCH 51/77] test metacache --- ecstore/src/disk/local.rs | 8 +++++++- ecstore/src/io.rs | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 7a11bb5b8..aac07a218 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -2325,8 +2325,10 @@ async fn get_disk_info(drive_path: PathBuf) -> Result<(Info, bool)> { #[cfg(test)] mod test { + use tokio::io::BufWriter; use utils::fs::open_file; use utils::fs::O_RDWR; + use utils::fs::O_TRUNC; use super::*; @@ -2423,7 +2425,7 @@ mod test { } }; - let mut f = match open_file("./testfile.txt", O_CREATE | O_RDWR).await { + let f = match open_file("./testfile.txt", O_CREATE | O_RDWR | O_TRUNC).await { Ok(res) => res, Err(err) => { println!("openfile err {:?}", err); @@ -2431,6 +2433,8 @@ mod test { } }; + let buf = BufWriter::new(Vec::new()); + let opts = WalkDirOptions { bucket: "dada".to_owned(), recursive: true, @@ -2439,5 +2443,7 @@ mod test { if let Err(err) = disk.walk_dir(opts, crate::io::Writer::File(f)).await { println!("walk_dir err {:?}", err); } + + MetacacheReader::new() } } diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index cdaabaebc..a4d9c3cc1 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -3,6 +3,8 @@ use std::io::Write; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::fs::File; +use tokio::io::BufReader; +use tokio::io::BufWriter; use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; #[derive(Default)] @@ -10,6 +12,7 @@ pub enum Reader { #[default] NotUse, File(File), + Buffer(BufReader>), } impl AsyncRead for Reader { @@ -19,6 +22,9 @@ impl AsyncRead for Reader { let file = Pin::new(file); file.poll_read(cx, buf) } + Reader::Buffer(buffer) => { + todo!() + } Reader::NotUse => Poll::Ready(Ok(())), } } @@ -29,36 +35,30 @@ pub enum Writer { #[default] NotUse, File(File), + Buffer(BufWriter>), } impl AsyncWrite for Writer { fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { match self.get_mut() { - Writer::File(file) => { - // Create a pinned reference from the file - let file = Pin::new(file); - file.poll_write(cx, buf) - } + Writer::File(file) => Pin::new(file).poll_write(cx, buf), + Writer::Buffer(buff) => Pin::new(buff).poll_write(cx, buf), Writer::NotUse => Poll::Ready(Ok(0)), } } fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match self.get_mut() { - Writer::File(file) => { - let file = Pin::new(file); - file.poll_flush(cx) - } + Writer::File(file) => Pin::new(file).poll_flush(cx), + Writer::Buffer(buff) => Pin::new(buff).poll_flush(cx), Writer::NotUse => Poll::Ready(Ok(())), } } fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { match self.get_mut() { - Writer::File(file) => { - let file = Pin::new(file); - file.poll_shutdown(cx) - } + Writer::File(file) => Pin::new(file).poll_shutdown(cx), + Writer::Buffer(buff) => Pin::new(buff).poll_shutdown(cx), Writer::NotUse => Poll::Ready(Ok(())), } } From 99c229524d0d3634513e50a85bf6488a4b5461e7 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 17:45:28 +0800 Subject: [PATCH 52/77] test metawrite --- ecstore/src/cache_value/metacache_set.rs | 4 +- ecstore/src/disk/local.rs | 66 ++++--- ecstore/src/disk/mod.rs | 6 +- ecstore/src/disk/remote.rs | 7 +- ecstore/src/io.rs | 15 +- ecstore/src/metacache/writer.rs | 229 +++++++++++++++-------- ecstore/src/set_disk.rs | 2 +- rustfs/src/grpc.rs | 2 +- 8 files changed, 210 insertions(+), 121 deletions(-) diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index 4e2bbe579..a7ed75af0 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -89,7 +89,7 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - limit: opts_clone.per_disk_limit, ..Default::default() }, - Writer::NotUse, + &mut Writer::NotUse, ) .await { @@ -130,7 +130,7 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - limit: opts_clone.per_disk_limit, ..Default::default() }, - Writer::NotUse, + &mut Writer::NotUse, ) .await { diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index aac07a218..5a8979bb4 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -59,10 +59,10 @@ use std::{ }; use time::OffsetDateTime; use tokio::fs::{self, File}; -use tokio::io::{AsyncReadExt, AsyncWriteExt, ErrorKind}; +use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt, ErrorKind}; use tokio::sync::mpsc::Sender; use tokio::sync::RwLock; -use tracing::{info, warn}; +use tracing::{error, info, warn}; use uuid::Uuid; #[derive(Debug)] @@ -716,7 +716,7 @@ impl LocalDisk { bitrot_verify(&mut Cursor::new(data), n, part_size, algo, sum.to_vec(), shard_size) } - async fn scan_dir( + async fn scan_dir( &self, current: &mut String, opts: &WalkDirOptions, @@ -810,7 +810,8 @@ impl LocalDisk { name, metadata, ..Default::default() - })?; + }) + .await?; *objs_returned += 1; return Ok(()); } @@ -850,7 +851,8 @@ impl LocalDisk { out.write_obj(&MetaCacheEntry { name: pop, ..Default::default() - })?; + }) + .await?; if opts.recursive { if let Err(er) = Box::pin(self.scan_dir(current, opts, out, objs_returned)).await { @@ -886,7 +888,7 @@ impl LocalDisk { meta.metadata = res; - out.write_obj(&meta)?; + out.write_obj(&meta).await?; *objs_returned += 1; } Err(err) => { @@ -914,7 +916,8 @@ impl LocalDisk { out.write_obj(&MetaCacheEntry { name: dir.clone(), ..Default::default() - })?; + }) + .await?; *objs_returned += 1; if opts.recursive { @@ -1511,7 +1514,7 @@ impl DiskAPI for LocalDisk { // FIXME: TODO: io.writer TODO cancel #[tracing::instrument(level = "debug", skip(self, wr))] - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result> { // warn!("walk_dir opts {:?}", &opts); let volume_dir = self.get_bucket_path(&opts.bucket)?; @@ -1524,7 +1527,7 @@ impl DiskAPI for LocalDisk { let mut wr = wr; - let mut out = MetacacheWriter::new(AsyncToSync::new_writer(&mut wr)); + let mut out = MetacacheWriter::new(&mut wr); let mut objs_returned = 0; @@ -1539,7 +1542,7 @@ impl DiskAPI for LocalDisk { metadata: data, ..Default::default() }; - out.write_obj(&meta)?; + out.write_obj(&meta).await?; objs_returned += 1; } } @@ -2330,6 +2333,10 @@ mod test { use utils::fs::O_RDWR; use utils::fs::O_TRUNC; + use crate::io::VecAsyncReader; + use crate::io::VecAsyncWriter; + use crate::metacache::writer::MetacacheReader; + use super::*; #[tokio::test] @@ -2425,25 +2432,32 @@ mod test { } }; - let f = match open_file("./testfile.txt", O_CREATE | O_RDWR | O_TRUNC).await { - Ok(res) => res, - Err(err) => { - println!("openfile err {:?}", err); - return; + let (rd, mut wr) = tokio::io::duplex(64); + + // let mut wr = VecAsyncWriter::new(Vec::new()); + + let job = tokio::spawn(async move { + let opts = WalkDirOptions { + bucket: "dada".to_owned(), + recursive: true, + ..Default::default() + }; + if let Err(err) = disk.walk_dir(opts, &mut wr).await { + println!("walk_dir err {:?}", err); } - }; + }); - let buf = BufWriter::new(Vec::new()); + // let rd = VecAsyncReader::new(wr.get_buffer().to_vec()); - let opts = WalkDirOptions { - bucket: "dada".to_owned(), - recursive: true, - ..Default::default() - }; - if let Err(err) = disk.walk_dir(opts, crate::io::Writer::File(f)).await { - println!("walk_dir err {:?}", err); - } + let rd_job = tokio::spawn(async move { + let mut mrd = MetacacheReader::new(rd); - MetacacheReader::new() + while let Some(info) = mrd.peek().await.unwrap_or_default() { + println!("{:?}", info) + } + }); + + job.await.unwrap(); + rd_job.await.unwrap(); } } diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 5fec3bc29..c47dd9afe 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -46,7 +46,7 @@ use std::{ use time::OffsetDateTime; use tokio::{ fs::File, - io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt}, + io::{AsyncReadExt, AsyncSeekExt, AsyncWrite, AsyncWriteExt}, sync::mpsc::{self, Sender}, }; use tokio_stream::wrappers::ReceiverStream; @@ -210,7 +210,7 @@ impl DiskAPI for Disk { } } - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { + async fn walk_dir(&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,7 +406,7 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { async fn delete_volume(&self, volume: &str) -> Result<()>; // 并发边读边写 TODO: wr io.Writer - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result>; + async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result>; // Metadata operations async fn delete_version( diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 6f5534c79..a68d6d827 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -10,7 +10,10 @@ use protos::{ StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WalkDirRequest, WriteAllRequest, WriteMetadataRequest, }, }; -use tokio::sync::mpsc::{self, Sender}; +use tokio::{ + io::AsyncWrite, + sync::mpsc::{self, Sender}, +}; use tokio_stream::{wrappers::ReceiverStream, StreamExt}; use tonic::Request; use tracing::info; @@ -347,7 +350,7 @@ impl DiskAPI for RemoteDisk { Ok(response.volumes) } - async fn walk_dir(&self, opts: WalkDirOptions, wr: crate::io::Writer) -> Result> { + async fn walk_dir(&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) diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index a4d9c3cc1..a6b182ce8 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -3,8 +3,6 @@ use std::io::Write; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::fs::File; -use tokio::io::BufReader; -use tokio::io::BufWriter; use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; #[derive(Default)] @@ -12,19 +10,14 @@ pub enum Reader { #[default] NotUse, File(File), - Buffer(BufReader>), + Buffer(VecAsyncReader), } impl AsyncRead for Reader { fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll> { match self.get_mut() { - Reader::File(file) => { - let file = Pin::new(file); - file.poll_read(cx, buf) - } - Reader::Buffer(buffer) => { - todo!() - } + Reader::File(file) => Pin::new(file).poll_read(cx, buf), + Reader::Buffer(buffer) => Pin::new(buffer).poll_read(cx, buf), Reader::NotUse => Poll::Ready(Ok(())), } } @@ -35,7 +28,7 @@ pub enum Writer { #[default] NotUse, File(File), - Buffer(BufWriter>), + Buffer(VecAsyncWriter), } impl AsyncWrite for Writer { diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index cc23cf6ec..ddc55f913 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -1,9 +1,16 @@ use crate::disk::MetaCacheEntry; use crate::error::Error; use crate::error::Result; +use rmp::decode::RmpRead; +use rmp::encode::RmpWrite; +use rmp::Marker; use std::io::Read; use std::io::Write; use std::str::from_utf8; +use tokio::io::AsyncRead; +use tokio::io::AsyncReadExt; +use tokio::io::AsyncWrite; +use tokio::io::AsyncWriteExt; // use std::sync::Arc; // use tokio::sync::mpsc; // use tokio::sync::mpsc::Sender; @@ -16,50 +23,64 @@ pub struct MetacacheWriter { wr: W, created: bool, // err: Option, + buf: Vec, } -impl MetacacheWriter { +impl MetacacheWriter { pub fn new(wr: W) -> Self { Self { wr, created: false, // err: None, + buf: Vec::new(), } } - pub fn init(&mut self) -> Result<()> { + pub async fn flush(&mut self) -> Result<()> { + self.wr.write_all(&self.buf).await?; + self.buf.clear(); + + Ok(()) + } + + pub async fn init(&mut self) -> Result<()> { if !self.created { - rmp::encode::write_u8(&mut self.wr, METACACHE_STREAM_VERSION)?; + rmp::encode::write_u8(&mut self.buf, METACACHE_STREAM_VERSION).map_err(|e| Error::msg(format!("{:?}", e)))?; + self.flush().await?; self.created = true; } Ok(()) } - pub fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { + pub async fn write(&mut self, objs: &[MetaCacheEntry]) -> Result<()> { if objs.is_empty() { return Ok(()); } - self.init()?; + self.init().await?; for obj in objs.iter() { if obj.name.is_empty() { return Err(Error::msg("metacacheWriter: no name")); } - self.write_obj(obj)?; + self.write_obj(obj).await?; } Ok(()) } - pub fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { - self.init()?; - rmp::encode::write_bool(&mut self.wr, true)?; + pub async fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + self.init().await?; - rmp::encode::write_str(&mut self.wr, &obj.name)?; + rmp::encode::write_bool(&mut self.buf, true).map_err(|e| Error::msg(format!("{:?}", e)))?; + + rmp::encode::write_str(&mut self.buf, &obj.name).map_err(|e| Error::msg(format!("{:?}", e)))?; + + rmp::encode::write_bin(&mut self.buf, &obj.metadata).map_err(|e| Error::msg(format!("{:?}", e)))?; + + self.flush().await?; - rmp::encode::write_bin(&mut self.wr, &obj.metadata)?; Ok(()) } @@ -96,9 +117,9 @@ impl MetacacheWriter { // Ok(sender) // } - pub fn close(&mut self) -> Result<()> { - rmp::encode::write_bool(&mut self.wr, false)?; - self.wr.flush()?; + pub async fn close(&mut self) -> Result<()> { + rmp::encode::write_bool(&mut self.buf, false).map_err(|e| Error::msg(format!("{:?}", e)))?; + self.flush().await?; Ok(()) } } @@ -108,34 +129,60 @@ pub struct MetacacheReader { init: bool, err: Option, buf: Vec, + offset: usize, } -impl MetacacheReader { +impl MetacacheReader { pub fn new(rd: R) -> Self { Self { rd, init: false, err: None, buf: Vec::new(), + offset: 0, } } - fn check_init(&mut self) { + pub async fn read_more(&mut self, read_size: usize) -> Result<&[u8]> { + let ext_size = read_size + self.offset; + + let extra = ext_size - self.offset; + if self.buf.capacity() >= ext_size { + // Extend the buffer if we have enough space. + self.buf.resize(ext_size, 0); + } else { + self.buf.extend(vec![0u8; extra]); + } + + let pref = self.offset; + + self.rd.read_exact(&mut self.buf[pref..ext_size]).await?; + + self.offset += read_size; + + let data = &self.buf[pref..ext_size]; + + println!("pref {} offset {},ext_size {}, data {:?}", pref, self.offset, ext_size, &data); + + Ok(data) + } + + fn reset(&mut self) { + self.buf.clear(); + self.offset = 0; + } + + async fn check_init(&mut self) -> Result<()> { if !self.init { - // let mut buf = match self.read_buf(1).await { - // Ok(res) => res, - // Err(err) => { - // self.err = Some(Error::msg(err.to_string())); - // return; - // } - // }; - let ver = match rmp::decode::read_u8(&mut self.rd) { + let ver = match rmp::decode::read_u8(&mut self.read_more(2).await?) { Ok(res) => res, Err(err) => { - self.err = Some(Error::msg(err.to_string())); + self.err = Some(Error::msg(format!("{:?}", err))); 0 } }; + + println!("ver {}", ver); match ver { 1 | 2 => (), _ => { @@ -145,70 +192,99 @@ impl MetacacheReader { self.init = true; } + Ok(()) } - pub fn peek(&mut self) -> Result> { - self.check_init(); + async fn read_str_len(&mut self) -> Result { + let mark = match rmp::decode::read_marker(&mut self.read_more(1).await?) { + Ok(res) => res, + Err(err) => { + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); + } + }; + + match mark { + Marker::FixStr(size) => Ok(u32::from(size)), + Marker::Str8 => Ok(u32::from(self.read_u8().await?)), + Marker::Str16 => Ok(u32::from(self.read_u16().await?)), + Marker::Str32 => Ok(self.read_u32().await?), + _ => Err(Error::msg("str marker err")), + } + } + + async fn read_bin_len(&mut self) -> Result { + let mark = match rmp::decode::read_marker(&mut self.read_more(1).await?) { + Ok(res) => res, + Err(err) => { + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); + } + }; + + match mark { + Marker::Bin8 => Ok(u32::from(self.read_u8().await?)), + Marker::Bin16 => Ok(u32::from(self.read_u16().await?)), + Marker::Bin32 => Ok(self.read_u32().await?), + _ => Err(Error::msg("bin marker err")), + } + } + + async fn read_u8(&mut self) -> Result { + let a = self.read_more(1).await?; + + Ok(a[0]) + } + + async fn read_u16(&mut self) -> Result { + rmp::decode::read_u16(&mut self.read_more(2).await?).map_err(|e| Error::msg(format!("{:?}", e))) + } + + async fn read_u32(&mut self) -> Result { + rmp::decode::read_u32(&mut self.read_more(4).await?).map_err(|e| Error::msg(format!("{:?}", e))) + } + + pub async fn peek(&mut self) -> Result> { + self.check_init().await; if let Some(err) = &self.err { return Err(err.clone()); } - match rmp::decode::read_bool(&mut self.rd) { + match rmp::decode::read_bool(&mut self.read_more(1).await?) { Ok(res) => { if !res { return Ok(None); } } Err(err) => { - self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); } }; - let l = match rmp::decode::read_str_len(&mut self.rd) { - Ok(res) => res, + let l = self.read_str_len().await?; + + let buf = self.read_more(l as usize).await?; + let name_buf = buf.to_vec(); + let name = match from_utf8(&name_buf) { + Ok(decoded) => decoded.to_owned(), Err(err) => { self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); + return Err(Error::msg(err.to_string())); } }; - self.buf.resize(l as usize, 0); - let name = match self.rd.read_exact(&mut self.buf) { - Ok(()) => { - let name_buf = self.buf.to_vec(); - match from_utf8(&name_buf) { - Ok(decoded) => Ok(decoded.to_owned()), - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - Err(Error::msg(err.to_string())) - } - } - } - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - Err(Error::msg(err.to_string())) - } - }?; + let l = self.read_bin_len().await?; - let l = match rmp::decode::read_bin_len(&mut self.rd) { - Ok(res) => res, - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); - } - }; - self.buf.resize(l as usize, 0); - match self.rd.read_exact(&mut self.buf) { - Ok(res) => res, - Err(err) => { - self.err = Some(Error::msg(err.to_string())); - return Err(Error::new(err)); - } - }; + let buf = self.read_more(l as usize).await?; - let metadata = self.buf.clone(); + let metadata = buf.to_vec(); + + self.reset(); Ok(Some(MetaCacheEntry { name, @@ -218,11 +294,11 @@ impl MetacacheReader { })) } - pub fn read_all(&mut self) -> Result> { + pub async fn read_all(&mut self) -> Result> { let mut ret = Vec::new(); loop { - if let Some(entry) = self.peek()? { + if let Some(entry) = self.peek().await? { ret.push(entry); continue; } @@ -236,13 +312,12 @@ impl MetacacheReader { #[tokio::test] async fn test_writer() { - use crate::io::AsyncToSync; use crate::io::VecAsyncReader; use crate::io::VecAsyncWriter; let mut f = VecAsyncWriter::new(Vec::new()); - let mut w = MetacacheWriter::new(AsyncToSync::new_writer(&mut f)); + let mut w = MetacacheWriter::new(&mut f); let mut objs = Vec::new(); for i in 0..10 { @@ -256,14 +331,18 @@ async fn test_writer() { objs.push(info); } - w.write(&objs).unwrap(); + w.write(&objs).await.unwrap(); - w.close().unwrap(); + w.close().await.unwrap(); - let nf = VecAsyncReader::new(f.get_buffer().to_vec()); + let data = f.get_buffer().to_vec(); - let mut r = MetacacheReader::new(AsyncToSync::new_reader(nf)); - let nobjs = r.read_all().unwrap(); + println!("data len {}", data.len()); + + let nf = VecAsyncReader::new(data); + + let mut r = MetacacheReader::new(nf); + let nobjs = r.read_all().await.unwrap(); for info in nobjs.iter() { println!("new {:?}", &info); diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 621ab8e6e..a7d1ab0ac 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1330,7 +1330,7 @@ impl SetDisks { let opts = opts.clone(); futures.push(async move { if let Some(disk) = disk { - disk.walk_dir(opts, Writer::NotUse).await + disk.walk_dir(opts, &mut Writer::NotUse).await } else { Err(Error::new(DiskError::DiskNotFound)) } diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index c529ac8ca..a2be08bac 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -743,7 +743,7 @@ impl Node for NodeService { })); } }; - match disk.walk_dir(opts, ecstore::io::Writer::NotUse).await { + match disk.walk_dir(opts, &mut ecstore::io::Writer::NotUse).await { Ok(entries) => { let entries = entries .into_iter() From 8ab8201403e2271bdd29baf291120d28bdcfe2c9 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 20:02:49 +0800 Subject: [PATCH 53/77] test walk_dir done --- ecstore/src/disk/local.rs | 31 +++++++++++++++++++++---------- ecstore/src/io.rs | 4 ++-- ecstore/src/metacache/writer.rs | 22 +++++++++++----------- ecstore/src/utils/path.rs | 2 +- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 5a8979bb4..2fe011da9 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -37,7 +37,10 @@ use crate::set_disk::{ use crate::store_api::{BitrotAlgorithm, StorageAPI}; use crate::utils::fs::{access, lstat, O_APPEND, O_CREATE, O_RDONLY, O_WRONLY}; use crate::utils::os::get_info; -use crate::utils::path::{self, clean, decode_dir_object, has_suffix, path_join, GLOBAL_DIR_SUFFIX_WITH_SLASH, SLASH_SEPARATOR}; +use crate::utils::path::{ + self, clean, decode_dir_object, has_suffix, path_join, path_join_buf, GLOBAL_DIR_SUFFIX, GLOBAL_DIR_SUFFIX_WITH_SLASH, + SLASH_SEPARATOR, +}; use crate::{ file_meta::FileMeta, store_api::{FileInfo, RawFileInfo}, @@ -743,7 +746,9 @@ impl LocalDisk { let mut entries = match self.list_dir("", &opts.bucket, current, -1).await { Ok(res) => res, Err(e) => { - if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) {} + if !DiskError::VolumeNotFound.is(&e) && !is_err_file_not_found(&e) { + error!("scan list_dir {}, err {:?}", ¤t, &e); + } if opts.report_notfound && is_err_file_not_found(&e) && current == &opts.base_dir { return Err(Error::new(DiskError::FileNotFound)); @@ -849,13 +854,13 @@ impl LocalDisk { if pop < name { // out.write_obj(&MetaCacheEntry { - name: pop, + name: pop.clone(), ..Default::default() }) .await?; if opts.recursive { - if let Err(er) = Box::pin(self.scan_dir(current, opts, out, objs_returned)).await { + if let Err(er) = Box::pin(self.scan_dir(&mut pop.clone(), opts, out, objs_returned)).await { error!("scan_dir err {:?}", er); } } @@ -1495,7 +1500,11 @@ impl DiskAPI for LocalDisk { } let volume_dir = self.get_bucket_path(volume)?; - let dir_path_abs = volume_dir.join(Path::new(&dir_path)); + let dir_path_abs = volume_dir.join(Path::new(&dir_path.trim_start_matches(SLASH_SEPARATOR))); + println!( + "list dir volume_dir: {:?} join dir_path {} = abs {:?}", + &volume_dir, &dir_path, dir_path_abs + ); let entries = match os::read_dir(&dir_path_abs, count).await { Ok(res) => res, @@ -1534,8 +1543,14 @@ impl DiskAPI for LocalDisk { if opts.base_dir.ends_with(SLASH_SEPARATOR) { let fpath = self.get_object_path( &opts.bucket, - format!("{}/{}", opts.base_dir.trim_end_matches(SLASH_SEPARATOR), STORAGE_FORMAT_FILE).as_str(), + path_join_buf(&[ + format!("{}{}", opts.base_dir.trim_end_matches(SLASH_SEPARATOR), GLOBAL_DIR_SUFFIX).as_str(), + STORAGE_FORMAT_FILE, + ]) + .as_str(), )?; + + println!("fpath {:?}", &fpath); if let Ok(data) = self.read_metadata(fpath).await { let meta = MetaCacheEntry { name: opts.base_dir.clone(), @@ -2434,8 +2449,6 @@ mod test { let (rd, mut wr) = tokio::io::duplex(64); - // let mut wr = VecAsyncWriter::new(Vec::new()); - let job = tokio::spawn(async move { let opts = WalkDirOptions { bucket: "dada".to_owned(), @@ -2447,8 +2460,6 @@ mod test { } }); - // let rd = VecAsyncReader::new(wr.get_buffer().to_vec()); - let rd_job = tokio::spawn(async move { let mut mrd = MetacacheReader::new(rd); diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index a6b182ce8..e1ed0b48d 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -163,7 +163,7 @@ impl VecAsyncWriter { // Implementing AsyncWrite trait for VecAsyncWriter impl AsyncWrite for VecAsyncWriter { - fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + fn poll_write(self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &[u8]) -> Poll> { let len = buf.len(); // Assume synchronous writing for simplicity @@ -178,7 +178,7 @@ impl AsyncWrite for VecAsyncWriter { Poll::Ready(Ok(())) } - fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { // Similar to flush, shutdown has no effect here Poll::Ready(Ok(())) } diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index ddc55f913..a405722e5 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -71,6 +71,8 @@ impl MetacacheWriter { } pub async fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { + println!("write_obj {:?}", &obj); + self.init().await?; rmp::encode::write_bool(&mut self.buf, true).map_err(|e| Error::msg(format!("{:?}", e)))?; @@ -162,8 +164,6 @@ impl MetacacheReader { let data = &self.buf[pref..ext_size]; - println!("pref {} offset {},ext_size {}, data {:?}", pref, self.offset, ext_size, &data); - Ok(data) } @@ -181,8 +181,6 @@ impl MetacacheReader { 0 } }; - - println!("ver {}", ver); match ver { 1 | 2 => (), _ => { @@ -233,21 +231,25 @@ impl MetacacheReader { } async fn read_u8(&mut self) -> Result { - let a = self.read_more(1).await?; + let buf = self.read_more(1).await?; - Ok(a[0]) + Ok(u8::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } async fn read_u16(&mut self) -> Result { - rmp::decode::read_u16(&mut self.read_more(2).await?).map_err(|e| Error::msg(format!("{:?}", e))) + let buf = self.read_more(2).await?; + + Ok(u16::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } async fn read_u32(&mut self) -> Result { - rmp::decode::read_u32(&mut self.read_more(4).await?).map_err(|e| Error::msg(format!("{:?}", e))) + let buf = self.read_more(4).await?; + + Ok(u32::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } pub async fn peek(&mut self) -> Result> { - self.check_init().await; + self.check_init().await?; if let Some(err) = &self.err { return Err(err.clone()); @@ -337,8 +339,6 @@ async fn test_writer() { let data = f.get_buffer().to_vec(); - println!("data len {}", data.len()); - let nf = VecAsyncReader::new(data); let mut r = MetacacheReader::new(nf); diff --git a/ecstore/src/utils/path.rs b/ecstore/src/utils/path.rs index 9f2c22a08..745aef679 100644 --- a/ecstore/src/utils/path.rs +++ b/ecstore/src/utils/path.rs @@ -1,7 +1,7 @@ use std::path::Path; use std::path::PathBuf; -const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; +pub const GLOBAL_DIR_SUFFIX: &str = "__XLDIR__"; pub const SLASH_SEPARATOR: &str = "/"; From 9dd75b4a3b8ec8b77e9e8f682823d3b42aa8274b Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 22:08:09 +0800 Subject: [PATCH 54/77] test walk_dir done --- ecstore/src/metacache/writer.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index a405722e5..518104462 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -71,8 +71,6 @@ impl MetacacheWriter { } pub async fn write_obj(&mut self, obj: &MetaCacheEntry) -> Result<()> { - println!("write_obj {:?}", &obj); - self.init().await?; rmp::encode::write_bool(&mut self.buf, true).map_err(|e| Error::msg(format!("{:?}", e)))?; From 64e631fcdb6c266cf6c82ce21cb524ce9e417eae Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 22:20:33 +0800 Subject: [PATCH 55/77] cargo check --- .../generated/flatbuffers_generated/models.rs | 207 +- .../src/generated/proto_gen/node_service.rs | 3832 +++++++++++++---- ecstore/src/disk/local.rs | 5 +- ecstore/src/heal/heal_ops.rs | 2 +- ecstore/src/metacache/writer.rs | 4 - ecstore/src/notification_sys.rs | 2 +- madmin/Cargo.toml | 1 - rustfs/src/admin/handlers/trace.rs | 2 +- rustfs/src/main.rs | 1 - 9 files changed, 3158 insertions(+), 898 deletions(-) diff --git a/common/protos/src/generated/flatbuffers_generated/models.rs b/common/protos/src/generated/flatbuffers_generated/models.rs index e4949fdcf..aa1f6ae2f 100644 --- a/common/protos/src/generated/flatbuffers_generated/models.rs +++ b/common/protos/src/generated/flatbuffers_generated/models.rs @@ -1,9 +1,10 @@ // automatically generated by the FlatBuffers compiler, do not modify + // @generated -use core::cmp::Ordering; use core::mem; +use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -11,114 +12,112 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod models { - use core::cmp::Ordering; - use core::mem; + use core::mem; + use core::cmp::Ordering; - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; - pub enum PingBodyOffset {} - #[derive(Copy, Clone, PartialEq)] +pub enum PingBodyOffset {} +#[derive(Copy, Clone, PartialEq)] - pub struct PingBody<'a> { - pub _tab: flatbuffers::Table<'a>, +pub struct PingBody<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { + type Inner = PingBody<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> PingBody<'a> { + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; + + pub const fn get_fully_qualified_name() -> &'static str { + "models.PingBody" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PingBody { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PingBodyArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = PingBodyBuilder::new(_fbb); + if let Some(x) = args.payload { builder.add_payload(x); } + builder.finish() + } + + + #[inline] + pub fn payload(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(PingBody::VT_PAYLOAD, None)} + } +} + +impl flatbuffers::Verifiable for PingBody<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>("payload", Self::VT_PAYLOAD, false)? + .finish(); + Ok(()) + } +} +pub struct PingBodyArgs<'a> { + pub payload: Option>>, +} +impl<'a> Default for PingBodyArgs<'a> { + #[inline] + fn default() -> Self { + PingBodyArgs { + payload: None, } + } +} - impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { - type Inner = PingBody<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: flatbuffers::Table::new(buf, loc), - } - } +pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { + #[inline] + pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(PingBody::VT_PAYLOAD, payload); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PingBodyBuilder { + fbb_: _fbb, + start_: start, } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} - impl<'a> PingBody<'a> { - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; +impl core::fmt::Debug for PingBody<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PingBody"); + ds.field("payload", &self.payload()); + ds.finish() + } +} +} // pub mod models - pub const fn get_fully_qualified_name() -> &'static str { - "models.PingBody" - } - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PingBody { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PingBodyArgs<'args>, - ) -> flatbuffers::WIPOffset> { - let mut builder = PingBodyBuilder::new(_fbb); - if let Some(x) = args.payload { - builder.add_payload(x); - } - builder.finish() - } - - #[inline] - pub fn payload(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::>>(PingBody::VT_PAYLOAD, None) - } - } - } - - impl flatbuffers::Verifiable for PingBody<'_> { - #[inline] - fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("payload", Self::VT_PAYLOAD, false)? - .finish(); - Ok(()) - } - } - pub struct PingBodyArgs<'a> { - pub payload: Option>>, - } - impl<'a> Default for PingBodyArgs<'a> { - #[inline] - fn default() -> Self { - PingBodyArgs { payload: None } - } - } - - pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, - } - impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::>(PingBody::VT_PAYLOAD, payload); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PingBodyBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } - } - - impl core::fmt::Debug for PingBody<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PingBody"); - ds.field("payload", &self.payload()); - ds.finish() - } - } -} // pub mod models diff --git a/common/protos/src/generated/proto_gen/node_service.rs b/common/protos/src/generated/proto_gen/node_service.rs index 6c4aef0e1..74e524da1 100644 --- a/common/protos/src/generated/proto_gen/node_service.rs +++ b/common/protos/src/generated/proto_gen/node_service.rs @@ -615,7 +615,10 @@ pub struct GenerallyLockResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mss { #[prost(map = "string, string", tag = "1")] - pub value: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + pub value: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct LocalStorageInfoRequest { @@ -779,7 +782,10 @@ pub struct DownloadProfileDataResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(map = "string, bytes", tag = "2")] - pub data: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::vec::Vec>, + pub data: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, #[prost(string, optional, tag = "3")] pub error_info: ::core::option::Option<::prost::alloc::string::String>, } @@ -1046,9 +1052,15 @@ pub struct LoadTransitionTierConfigResponse { } /// Generated client implementations. pub mod node_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] - use tonic::codegen::http::Uri; + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct NodeServiceClient { inner: tonic::client::Grpc, @@ -1079,16 +1091,22 @@ pub mod node_service_client { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: F) -> NodeServiceClient> + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> NodeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, - Response = http::Response<>::ResponseBody>, + Response = http::Response< + >::ResponseBody, + >, >, - >>::Error: - Into + std::marker::Send + std::marker::Sync, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, { NodeServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -1131,9 +1149,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Ping"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Ping", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Ping")); @@ -1142,13 +1166,22 @@ pub mod node_service_client { pub async fn heal_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/HealBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/HealBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "HealBucket")); @@ -1157,13 +1190,22 @@ pub mod node_service_client { pub async fn list_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListBucket")); @@ -1172,13 +1214,22 @@ pub mod node_service_client { pub async fn make_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeBucket")); @@ -1187,13 +1238,22 @@ pub mod node_service_client { pub async fn get_bucket_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetBucketInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketInfo")); @@ -1202,13 +1262,22 @@ pub mod node_service_client { pub async fn delete_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucket")); @@ -1217,13 +1286,22 @@ pub mod node_service_client { pub async fn read_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAll"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadAll", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAll")); @@ -1232,13 +1310,22 @@ pub mod node_service_client { pub async fn write_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteAll"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteAll", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteAll")); @@ -1251,9 +1338,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Delete"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Delete", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Delete")); @@ -1262,13 +1355,22 @@ pub mod node_service_client { pub async fn verify_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/VerifyFile"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/VerifyFile", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "VerifyFile")); @@ -1277,13 +1379,22 @@ pub mod node_service_client { pub async fn check_parts( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/CheckParts"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/CheckParts", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "CheckParts")); @@ -1292,13 +1403,22 @@ pub mod node_service_client { pub async fn rename_part( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenamePart"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenamePart", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenamePart")); @@ -1307,13 +1427,22 @@ pub mod node_service_client { pub async fn rename_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameFile"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenameFile", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameFile")); @@ -1326,9 +1455,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Write"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Write", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Write")); @@ -1337,13 +1472,22 @@ pub mod node_service_client { pub async fn write_stream( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteStream"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteStream", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteStream")); @@ -1353,13 +1497,22 @@ pub mod node_service_client { pub async fn read_at( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAt"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadAt", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAt")); @@ -1368,13 +1521,22 @@ pub mod node_service_client { pub async fn list_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListDir"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListDir", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListDir")); @@ -1383,13 +1545,22 @@ pub mod node_service_client { pub async fn walk_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WalkDir"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WalkDir", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WalkDir")); @@ -1398,13 +1569,22 @@ pub mod node_service_client { pub async fn rename_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameData"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenameData", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameData")); @@ -1413,13 +1593,22 @@ pub mod node_service_client { pub async fn make_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolumes"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeVolumes", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolumes")); @@ -1428,13 +1617,22 @@ pub mod node_service_client { pub async fn make_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolume")); @@ -1443,13 +1641,22 @@ pub mod node_service_client { pub async fn list_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListVolumes"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListVolumes", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListVolumes")); @@ -1458,13 +1665,22 @@ pub mod node_service_client { pub async fn stat_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StatVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StatVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StatVolume")); @@ -1473,13 +1689,22 @@ pub mod node_service_client { pub async fn delete_paths( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePaths"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeletePaths", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePaths")); @@ -1488,13 +1713,22 @@ pub mod node_service_client { pub async fn update_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UpdateMetadata", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetadata")); @@ -1503,13 +1737,22 @@ pub mod node_service_client { pub async fn write_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteMetadata", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteMetadata")); @@ -1518,13 +1761,22 @@ pub mod node_service_client { pub async fn read_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadVersion"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadVersion", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadVersion")); @@ -1537,9 +1789,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadXL"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadXL", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadXL")); @@ -1548,13 +1806,22 @@ pub mod node_service_client { pub async fn delete_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersion"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVersion", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersion")); @@ -1563,13 +1830,22 @@ pub mod node_service_client { pub async fn delete_versions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersions"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVersions", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersions")); @@ -1578,13 +1854,22 @@ pub mod node_service_client { pub async fn read_multiple( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadMultiple"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadMultiple", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadMultiple")); @@ -1593,13 +1878,22 @@ pub mod node_service_client { pub async fn delete_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVolume")); @@ -1608,13 +1902,22 @@ pub mod node_service_client { pub async fn disk_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DiskInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DiskInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DiskInfo")); @@ -1623,13 +1926,22 @@ pub mod node_service_client { pub async fn ns_scanner( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/NsScanner"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/NsScanner", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "NsScanner")); @@ -1638,13 +1950,22 @@ pub mod node_service_client { pub async fn lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Lock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Lock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Lock")); @@ -1653,13 +1974,22 @@ pub mod node_service_client { pub async fn un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UnLock")); @@ -1668,13 +1998,22 @@ pub mod node_service_client { pub async fn r_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RLock")); @@ -1683,13 +2022,22 @@ pub mod node_service_client { pub async fn r_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RUnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RUnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RUnLock")); @@ -1698,13 +2046,22 @@ pub mod node_service_client { pub async fn force_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ForceUnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ForceUnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ForceUnLock")); @@ -1713,13 +2070,22 @@ pub mod node_service_client { pub async fn refresh( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Refresh"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Refresh", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Refresh")); @@ -1728,13 +2094,22 @@ pub mod node_service_client { pub async fn local_storage_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LocalStorageInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LocalStorageInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LocalStorageInfo")); @@ -1743,13 +2118,22 @@ pub mod node_service_client { pub async fn server_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ServerInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ServerInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ServerInfo")); @@ -1758,13 +2142,22 @@ pub mod node_service_client { pub async fn get_cpus( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetCpus"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetCpus", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetCpus")); @@ -1773,13 +2166,22 @@ pub mod node_service_client { pub async fn get_net_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetNetInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetNetInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetNetInfo")); @@ -1788,13 +2190,22 @@ pub mod node_service_client { pub async fn get_partitions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetPartitions"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetPartitions", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetPartitions")); @@ -1803,13 +2214,22 @@ pub mod node_service_client { pub async fn get_os_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetOsInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetOsInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetOsInfo")); @@ -1818,13 +2238,22 @@ pub mod node_service_client { pub async fn get_se_linux_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSELinuxInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSELinuxInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSELinuxInfo")); @@ -1833,13 +2262,22 @@ pub mod node_service_client { pub async fn get_sys_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSysConfig", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysConfig")); @@ -1848,13 +2286,22 @@ pub mod node_service_client { pub async fn get_sys_errors( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysErrors"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSysErrors", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysErrors")); @@ -1863,13 +2310,22 @@ pub mod node_service_client { pub async fn get_mem_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMemInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMemInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMemInfo")); @@ -1878,13 +2334,22 @@ pub mod node_service_client { pub async fn get_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetrics"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMetrics", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMetrics")); @@ -1893,13 +2358,22 @@ pub mod node_service_client { pub async fn get_proc_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetProcInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetProcInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetProcInfo")); @@ -1908,13 +2382,22 @@ pub mod node_service_client { pub async fn start_profiling( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StartProfiling"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StartProfiling", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StartProfiling")); @@ -1923,28 +2406,48 @@ pub mod node_service_client { pub async fn download_profile_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DownloadProfileData"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DownloadProfileData", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DownloadProfileData")); + .insert( + GrpcMethod::new("node_service.NodeService", "DownloadProfileData"), + ); self.inner.unary(req, path, codec).await } pub async fn get_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketStats"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetBucketStats", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketStats")); @@ -1953,13 +2456,22 @@ pub mod node_service_client { pub async fn get_sr_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSRMetrics"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSRMetrics", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSRMetrics")); @@ -1968,58 +2480,100 @@ pub mod node_service_client { pub async fn get_all_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetAllBucketStats"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetAllBucketStats", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "GetAllBucketStats")); + .insert( + GrpcMethod::new("node_service.NodeService", "GetAllBucketStats"), + ); self.inner.unary(req, path, codec).await } pub async fn load_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadBucketMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadBucketMetadata", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucketMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteBucketMetadata", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata")); + .insert( + GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePolicy"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeletePolicy", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePolicy")); @@ -2028,13 +2582,22 @@ pub mod node_service_client { pub async fn load_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicy"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadPolicy", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicy")); @@ -2043,28 +2606,48 @@ pub mod node_service_client { pub async fn load_policy_mapping( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicyMapping"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadPolicyMapping", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteUser"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteUser", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteUser")); @@ -2073,28 +2656,48 @@ pub mod node_service_client { pub async fn delete_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteServiceAccount"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteServiceAccount", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount")); + .insert( + GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount"), + ); self.inner.unary(req, path, codec).await } pub async fn load_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadUser"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadUser", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadUser")); @@ -2103,28 +2706,48 @@ pub mod node_service_client { pub async fn load_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadServiceAccount"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadServiceAccount", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadServiceAccount")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadServiceAccount"), + ); self.inner.unary(req, path, codec).await } pub async fn load_group( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadGroup"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadGroup", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadGroup")); @@ -2133,16 +2756,30 @@ pub mod node_service_client { pub async fn reload_site_replication_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadSiteReplicationConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReloadSiteReplicationConfig", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "ReloadSiteReplicationConfig")); + .insert( + GrpcMethod::new( + "node_service.NodeService", + "ReloadSiteReplicationConfig", + ), + ); self.inner.unary(req, path, codec).await } /// rpc VerifyBinary() returns () {}; @@ -2150,13 +2787,22 @@ pub mod node_service_client { pub async fn signal_service( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/SignalService"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/SignalService", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "SignalService")); @@ -2165,58 +2811,100 @@ pub mod node_service_client { pub async fn background_heal_status( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/BackgroundHealStatus"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/BackgroundHealStatus", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus")); + .insert( + GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus"), + ); self.inner.unary(req, path, codec).await } pub async fn get_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetacacheListing"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMetacacheListing", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "GetMetacacheListing")); + .insert( + GrpcMethod::new("node_service.NodeService", "GetMetacacheListing"), + ); self.inner.unary(req, path, codec).await } pub async fn update_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetacacheListing"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UpdateMetacacheListing", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing")); + .insert( + GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing"), + ); self.inner.unary(req, path, codec).await } pub async fn reload_pool_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadPoolMeta"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReloadPoolMeta", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReloadPoolMeta")); @@ -2225,13 +2913,22 @@ pub mod node_service_client { pub async fn stop_rebalance( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StopRebalance"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StopRebalance", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StopRebalance")); @@ -2240,38 +2937,69 @@ pub mod node_service_client { pub async fn load_rebalance_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadRebalanceMeta"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadRebalanceMeta", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta"), + ); self.inner.unary(req, path, codec).await } pub async fn load_transition_tier_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadTransitionTierConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadTransitionTierConfig", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadTransitionTierConfig")); + .insert( + GrpcMethod::new( + "node_service.NodeService", + "LoadTransitionTierConfig", + ), + ); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod node_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with NodeServiceServer. #[async_trait] @@ -2284,23 +3012,38 @@ pub mod node_service_server { async fn heal_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn list_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_bucket_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_all( &self, request: tonic::Request, @@ -2308,7 +3051,10 @@ pub mod node_service_server { async fn write_all( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete( &self, request: tonic::Request, @@ -2316,33 +3062,52 @@ pub mod node_service_server { async fn verify_file( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn check_parts( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn rename_part( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn rename_file( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn write( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WriteStream method. - type WriteStreamStream: tonic::codegen::tokio_stream::Stream> + type WriteStreamStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn write_stream( &self, request: tonic::Request>, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the ReadAt method. - type ReadAtStream: tonic::codegen::tokio_stream::Stream> + type ReadAtStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; /// rpc Append(AppendRequest) returns (AppendResponse) {}; @@ -2361,39 +3126,66 @@ pub mod node_service_server { async fn rename_data( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_volumes( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn list_volumes( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn stat_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_paths( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn write_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_version( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_xl( &self, request: tonic::Request, @@ -2401,25 +3193,42 @@ pub mod node_service_server { async fn delete_version( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_versions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_multiple( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn disk_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the NsScanner method. - type NsScannerStream: tonic::codegen::tokio_stream::Stream> + type NsScannerStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn ns_scanner( @@ -2429,35 +3238,59 @@ pub mod node_service_server { async fn lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn r_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn r_un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn force_un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn refresh( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn local_storage_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn server_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_cpus( &self, request: tonic::Request, @@ -2465,137 +3298,236 @@ pub mod node_service_server { async fn get_net_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_partitions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_os_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_se_linux_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sys_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sys_errors( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_mem_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_metrics( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_proc_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn start_profiling( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn download_profile_data( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sr_metrics( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_all_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_policy( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_policy( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_policy_mapping( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_user( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_service_account( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_user( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_service_account( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_group( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn reload_site_replication_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// rpc VerifyBinary() returns () {}; /// rpc CommitBinary() returns () {}; async fn signal_service( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn background_heal_status( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn reload_pool_meta( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn stop_rebalance( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_rebalance_meta( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_transition_tier_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } #[derive(Debug)] pub struct NodeServiceServer { @@ -2618,7 +3550,10 @@ pub mod node_service_server { max_encoding_message_size: None, } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -2662,7 +3597,10 @@ pub mod node_service_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -2670,12 +3608,21 @@ pub mod node_service_server { "/node_service.NodeService/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl tonic::server::UnaryService for PingSvc { + impl tonic::server::UnaryService + for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::ping(&inner, request).await }; + let fut = async move { + ::ping(&inner, request).await + }; Box::pin(fut) } } @@ -2688,8 +3635,14 @@ pub mod node_service_server { let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2698,12 +3651,23 @@ pub mod node_service_server { "/node_service.NodeService/HealBucket" => { #[allow(non_camel_case_types)] struct HealBucketSvc(pub Arc); - impl tonic::server::UnaryService for HealBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for HealBucketSvc { type Response = super::HealBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::heal_bucket(&inner, request).await }; + let fut = async move { + ::heal_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2716,8 +3680,14 @@ pub mod node_service_server { let method = HealBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2726,12 +3696,23 @@ pub mod node_service_server { "/node_service.NodeService/ListBucket" => { #[allow(non_camel_case_types)] struct ListBucketSvc(pub Arc); - impl tonic::server::UnaryService for ListBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListBucketSvc { type Response = super::ListBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_bucket(&inner, request).await }; + let fut = async move { + ::list_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2744,8 +3725,14 @@ pub mod node_service_server { let method = ListBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2754,12 +3741,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeBucket" => { #[allow(non_camel_case_types)] struct MakeBucketSvc(pub Arc); - impl tonic::server::UnaryService for MakeBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeBucketSvc { type Response = super::MakeBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_bucket(&inner, request).await }; + let fut = async move { + ::make_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2772,8 +3770,14 @@ pub mod node_service_server { let method = MakeBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2782,12 +3786,23 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketInfo" => { #[allow(non_camel_case_types)] struct GetBucketInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetBucketInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetBucketInfoSvc { type Response = super::GetBucketInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_bucket_info(&inner, request).await }; + let fut = async move { + ::get_bucket_info(&inner, request).await + }; Box::pin(fut) } } @@ -2800,8 +3815,14 @@ pub mod node_service_server { let method = GetBucketInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2810,12 +3831,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucket" => { #[allow(non_camel_case_types)] struct DeleteBucketSvc(pub Arc); - impl tonic::server::UnaryService for DeleteBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteBucketSvc { type Response = super::DeleteBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_bucket(&inner, request).await }; + let fut = async move { + ::delete_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2828,8 +3860,14 @@ pub mod node_service_server { let method = DeleteBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2838,12 +3876,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadAll" => { #[allow(non_camel_case_types)] struct ReadAllSvc(pub Arc); - impl tonic::server::UnaryService for ReadAllSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadAllSvc { type Response = super::ReadAllResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_all(&inner, request).await }; + let fut = async move { + ::read_all(&inner, request).await + }; Box::pin(fut) } } @@ -2856,8 +3905,14 @@ pub mod node_service_server { let method = ReadAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2866,12 +3921,23 @@ pub mod node_service_server { "/node_service.NodeService/WriteAll" => { #[allow(non_camel_case_types)] struct WriteAllSvc(pub Arc); - impl tonic::server::UnaryService for WriteAllSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WriteAllSvc { type Response = super::WriteAllResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_all(&inner, request).await }; + let fut = async move { + ::write_all(&inner, request).await + }; Box::pin(fut) } } @@ -2884,8 +3950,14 @@ pub mod node_service_server { let method = WriteAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2894,12 +3966,23 @@ pub mod node_service_server { "/node_service.NodeService/Delete" => { #[allow(non_camel_case_types)] struct DeleteSvc(pub Arc); - impl tonic::server::UnaryService for DeleteSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteSvc { type Response = super::DeleteResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete(&inner, request).await }; + let fut = async move { + ::delete(&inner, request).await + }; Box::pin(fut) } } @@ -2912,8 +3995,14 @@ pub mod node_service_server { let method = DeleteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2922,12 +4011,23 @@ pub mod node_service_server { "/node_service.NodeService/VerifyFile" => { #[allow(non_camel_case_types)] struct VerifyFileSvc(pub Arc); - impl tonic::server::UnaryService for VerifyFileSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for VerifyFileSvc { type Response = super::VerifyFileResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::verify_file(&inner, request).await }; + let fut = async move { + ::verify_file(&inner, request).await + }; Box::pin(fut) } } @@ -2940,8 +4040,14 @@ pub mod node_service_server { let method = VerifyFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2950,12 +4056,23 @@ pub mod node_service_server { "/node_service.NodeService/CheckParts" => { #[allow(non_camel_case_types)] struct CheckPartsSvc(pub Arc); - impl tonic::server::UnaryService for CheckPartsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for CheckPartsSvc { type Response = super::CheckPartsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::check_parts(&inner, request).await }; + let fut = async move { + ::check_parts(&inner, request).await + }; Box::pin(fut) } } @@ -2968,8 +4085,14 @@ pub mod node_service_server { let method = CheckPartsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2978,12 +4101,23 @@ pub mod node_service_server { "/node_service.NodeService/RenamePart" => { #[allow(non_camel_case_types)] struct RenamePartSvc(pub Arc); - impl tonic::server::UnaryService for RenamePartSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenamePartSvc { type Response = super::RenamePartResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_part(&inner, request).await }; + let fut = async move { + ::rename_part(&inner, request).await + }; Box::pin(fut) } } @@ -2996,8 +4130,14 @@ pub mod node_service_server { let method = RenamePartSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3006,12 +4146,23 @@ pub mod node_service_server { "/node_service.NodeService/RenameFile" => { #[allow(non_camel_case_types)] struct RenameFileSvc(pub Arc); - impl tonic::server::UnaryService for RenameFileSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenameFileSvc { type Response = super::RenameFileResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_file(&inner, request).await }; + let fut = async move { + ::rename_file(&inner, request).await + }; Box::pin(fut) } } @@ -3024,8 +4175,14 @@ pub mod node_service_server { let method = RenameFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3034,12 +4191,21 @@ pub mod node_service_server { "/node_service.NodeService/Write" => { #[allow(non_camel_case_types)] struct WriteSvc(pub Arc); - impl tonic::server::UnaryService for WriteSvc { + impl tonic::server::UnaryService + for WriteSvc { type Response = super::WriteResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write(&inner, request).await }; + let fut = async move { + ::write(&inner, request).await + }; Box::pin(fut) } } @@ -3052,8 +4218,14 @@ pub mod node_service_server { let method = WriteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3062,13 +4234,26 @@ pub mod node_service_server { "/node_service.NodeService/WriteStream" => { #[allow(non_camel_case_types)] struct WriteStreamSvc(pub Arc); - impl tonic::server::StreamingService for WriteStreamSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for WriteStreamSvc { type Response = super::WriteResponse; type ResponseStream = T::WriteStreamStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_stream(&inner, request).await }; + let fut = async move { + ::write_stream(&inner, request).await + }; Box::pin(fut) } } @@ -3081,8 +4266,14 @@ pub mod node_service_server { let method = WriteStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3091,13 +4282,26 @@ pub mod node_service_server { "/node_service.NodeService/ReadAt" => { #[allow(non_camel_case_types)] struct ReadAtSvc(pub Arc); - impl tonic::server::StreamingService for ReadAtSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for ReadAtSvc { type Response = super::ReadAtResponse; type ResponseStream = T::ReadAtStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_at(&inner, request).await }; + let fut = async move { + ::read_at(&inner, request).await + }; Box::pin(fut) } } @@ -3110,8 +4314,14 @@ pub mod node_service_server { let method = ReadAtSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3120,12 +4330,23 @@ pub mod node_service_server { "/node_service.NodeService/ListDir" => { #[allow(non_camel_case_types)] struct ListDirSvc(pub Arc); - impl tonic::server::UnaryService for ListDirSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListDirSvc { type Response = super::ListDirResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_dir(&inner, request).await }; + let fut = async move { + ::list_dir(&inner, request).await + }; Box::pin(fut) } } @@ -3138,8 +4359,14 @@ pub mod node_service_server { let method = ListDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3148,12 +4375,23 @@ pub mod node_service_server { "/node_service.NodeService/WalkDir" => { #[allow(non_camel_case_types)] struct WalkDirSvc(pub Arc); - impl tonic::server::UnaryService for WalkDirSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WalkDirSvc { type Response = super::WalkDirResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::walk_dir(&inner, request).await }; + let fut = async move { + ::walk_dir(&inner, request).await + }; Box::pin(fut) } } @@ -3166,8 +4404,14 @@ pub mod node_service_server { let method = WalkDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3176,12 +4420,23 @@ pub mod node_service_server { "/node_service.NodeService/RenameData" => { #[allow(non_camel_case_types)] struct RenameDataSvc(pub Arc); - impl tonic::server::UnaryService for RenameDataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenameDataSvc { type Response = super::RenameDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_data(&inner, request).await }; + let fut = async move { + ::rename_data(&inner, request).await + }; Box::pin(fut) } } @@ -3194,8 +4449,14 @@ pub mod node_service_server { let method = RenameDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3204,12 +4465,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolumes" => { #[allow(non_camel_case_types)] struct MakeVolumesSvc(pub Arc); - impl tonic::server::UnaryService for MakeVolumesSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeVolumesSvc { type Response = super::MakeVolumesResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_volumes(&inner, request).await }; + let fut = async move { + ::make_volumes(&inner, request).await + }; Box::pin(fut) } } @@ -3222,8 +4494,14 @@ pub mod node_service_server { let method = MakeVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3232,12 +4510,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolume" => { #[allow(non_camel_case_types)] struct MakeVolumeSvc(pub Arc); - impl tonic::server::UnaryService for MakeVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeVolumeSvc { type Response = super::MakeVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_volume(&inner, request).await }; + let fut = async move { + ::make_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3250,8 +4539,14 @@ pub mod node_service_server { let method = MakeVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3260,12 +4555,23 @@ pub mod node_service_server { "/node_service.NodeService/ListVolumes" => { #[allow(non_camel_case_types)] struct ListVolumesSvc(pub Arc); - impl tonic::server::UnaryService for ListVolumesSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListVolumesSvc { type Response = super::ListVolumesResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_volumes(&inner, request).await }; + let fut = async move { + ::list_volumes(&inner, request).await + }; Box::pin(fut) } } @@ -3278,8 +4584,14 @@ pub mod node_service_server { let method = ListVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3288,12 +4600,23 @@ pub mod node_service_server { "/node_service.NodeService/StatVolume" => { #[allow(non_camel_case_types)] struct StatVolumeSvc(pub Arc); - impl tonic::server::UnaryService for StatVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StatVolumeSvc { type Response = super::StatVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::stat_volume(&inner, request).await }; + let fut = async move { + ::stat_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3306,8 +4629,14 @@ pub mod node_service_server { let method = StatVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3316,12 +4645,23 @@ pub mod node_service_server { "/node_service.NodeService/DeletePaths" => { #[allow(non_camel_case_types)] struct DeletePathsSvc(pub Arc); - impl tonic::server::UnaryService for DeletePathsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeletePathsSvc { type Response = super::DeletePathsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_paths(&inner, request).await }; + let fut = async move { + ::delete_paths(&inner, request).await + }; Box::pin(fut) } } @@ -3334,8 +4674,14 @@ pub mod node_service_server { let method = DeletePathsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3344,12 +4690,23 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetadata" => { #[allow(non_camel_case_types)] struct UpdateMetadataSvc(pub Arc); - impl tonic::server::UnaryService for UpdateMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UpdateMetadataSvc { type Response = super::UpdateMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::update_metadata(&inner, request).await }; + let fut = async move { + ::update_metadata(&inner, request).await + }; Box::pin(fut) } } @@ -3362,8 +4719,14 @@ pub mod node_service_server { let method = UpdateMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3372,12 +4735,23 @@ pub mod node_service_server { "/node_service.NodeService/WriteMetadata" => { #[allow(non_camel_case_types)] struct WriteMetadataSvc(pub Arc); - impl tonic::server::UnaryService for WriteMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WriteMetadataSvc { type Response = super::WriteMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_metadata(&inner, request).await }; + let fut = async move { + ::write_metadata(&inner, request).await + }; Box::pin(fut) } } @@ -3390,8 +4764,14 @@ pub mod node_service_server { let method = WriteMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3400,12 +4780,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadVersion" => { #[allow(non_camel_case_types)] struct ReadVersionSvc(pub Arc); - impl tonic::server::UnaryService for ReadVersionSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadVersionSvc { type Response = super::ReadVersionResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_version(&inner, request).await }; + let fut = async move { + ::read_version(&inner, request).await + }; Box::pin(fut) } } @@ -3418,8 +4809,14 @@ pub mod node_service_server { let method = ReadVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3428,12 +4825,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadXL" => { #[allow(non_camel_case_types)] struct ReadXLSvc(pub Arc); - impl tonic::server::UnaryService for ReadXLSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadXLSvc { type Response = super::ReadXlResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_xl(&inner, request).await }; + let fut = async move { + ::read_xl(&inner, request).await + }; Box::pin(fut) } } @@ -3446,8 +4854,14 @@ pub mod node_service_server { let method = ReadXLSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3456,12 +4870,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersion" => { #[allow(non_camel_case_types)] struct DeleteVersionSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVersionSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVersionSvc { type Response = super::DeleteVersionResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_version(&inner, request).await }; + let fut = async move { + ::delete_version(&inner, request).await + }; Box::pin(fut) } } @@ -3474,8 +4899,14 @@ pub mod node_service_server { let method = DeleteVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3484,12 +4915,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersions" => { #[allow(non_camel_case_types)] struct DeleteVersionsSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVersionsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVersionsSvc { type Response = super::DeleteVersionsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_versions(&inner, request).await }; + let fut = async move { + ::delete_versions(&inner, request).await + }; Box::pin(fut) } } @@ -3502,8 +4944,14 @@ pub mod node_service_server { let method = DeleteVersionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3512,12 +4960,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadMultiple" => { #[allow(non_camel_case_types)] struct ReadMultipleSvc(pub Arc); - impl tonic::server::UnaryService for ReadMultipleSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadMultipleSvc { type Response = super::ReadMultipleResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_multiple(&inner, request).await }; + let fut = async move { + ::read_multiple(&inner, request).await + }; Box::pin(fut) } } @@ -3530,8 +4989,14 @@ pub mod node_service_server { let method = ReadMultipleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3540,12 +5005,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVolume" => { #[allow(non_camel_case_types)] struct DeleteVolumeSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVolumeSvc { type Response = super::DeleteVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_volume(&inner, request).await }; + let fut = async move { + ::delete_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3558,8 +5034,14 @@ pub mod node_service_server { let method = DeleteVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3568,12 +5050,23 @@ pub mod node_service_server { "/node_service.NodeService/DiskInfo" => { #[allow(non_camel_case_types)] struct DiskInfoSvc(pub Arc); - impl tonic::server::UnaryService for DiskInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DiskInfoSvc { type Response = super::DiskInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::disk_info(&inner, request).await }; + let fut = async move { + ::disk_info(&inner, request).await + }; Box::pin(fut) } } @@ -3586,8 +5079,14 @@ pub mod node_service_server { let method = DiskInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3596,13 +5095,26 @@ pub mod node_service_server { "/node_service.NodeService/NsScanner" => { #[allow(non_camel_case_types)] struct NsScannerSvc(pub Arc); - impl tonic::server::StreamingService for NsScannerSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for NsScannerSvc { type Response = super::NsScannerResponse; type ResponseStream = T::NsScannerStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::ns_scanner(&inner, request).await }; + let fut = async move { + ::ns_scanner(&inner, request).await + }; Box::pin(fut) } } @@ -3615,8 +5127,14 @@ pub mod node_service_server { let method = NsScannerSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3625,12 +5143,23 @@ pub mod node_service_server { "/node_service.NodeService/Lock" => { #[allow(non_camel_case_types)] struct LockSvc(pub Arc); - impl tonic::server::UnaryService for LockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::lock(&inner, request).await }; + let fut = async move { + ::lock(&inner, request).await + }; Box::pin(fut) } } @@ -3643,8 +5172,14 @@ pub mod node_service_server { let method = LockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3653,12 +5188,23 @@ pub mod node_service_server { "/node_service.NodeService/UnLock" => { #[allow(non_camel_case_types)] struct UnLockSvc(pub Arc); - impl tonic::server::UnaryService for UnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::un_lock(&inner, request).await }; + let fut = async move { + ::un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3671,8 +5217,14 @@ pub mod node_service_server { let method = UnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3681,12 +5233,23 @@ pub mod node_service_server { "/node_service.NodeService/RLock" => { #[allow(non_camel_case_types)] struct RLockSvc(pub Arc); - impl tonic::server::UnaryService for RLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::r_lock(&inner, request).await }; + let fut = async move { + ::r_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3699,8 +5262,14 @@ pub mod node_service_server { let method = RLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3709,12 +5278,23 @@ pub mod node_service_server { "/node_service.NodeService/RUnLock" => { #[allow(non_camel_case_types)] struct RUnLockSvc(pub Arc); - impl tonic::server::UnaryService for RUnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::r_un_lock(&inner, request).await }; + let fut = async move { + ::r_un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3727,8 +5307,14 @@ pub mod node_service_server { let method = RUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3737,12 +5323,23 @@ pub mod node_service_server { "/node_service.NodeService/ForceUnLock" => { #[allow(non_camel_case_types)] struct ForceUnLockSvc(pub Arc); - impl tonic::server::UnaryService for ForceUnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ForceUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::force_un_lock(&inner, request).await }; + let fut = async move { + ::force_un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3755,8 +5352,14 @@ pub mod node_service_server { let method = ForceUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3765,12 +5368,23 @@ pub mod node_service_server { "/node_service.NodeService/Refresh" => { #[allow(non_camel_case_types)] struct RefreshSvc(pub Arc); - impl tonic::server::UnaryService for RefreshSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RefreshSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::refresh(&inner, request).await }; + let fut = async move { + ::refresh(&inner, request).await + }; Box::pin(fut) } } @@ -3783,8 +5397,14 @@ pub mod node_service_server { let method = RefreshSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3793,12 +5413,24 @@ pub mod node_service_server { "/node_service.NodeService/LocalStorageInfo" => { #[allow(non_camel_case_types)] struct LocalStorageInfoSvc(pub Arc); - impl tonic::server::UnaryService for LocalStorageInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LocalStorageInfoSvc { type Response = super::LocalStorageInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::local_storage_info(&inner, request).await }; + let fut = async move { + ::local_storage_info(&inner, request) + .await + }; Box::pin(fut) } } @@ -3811,8 +5443,14 @@ pub mod node_service_server { let method = LocalStorageInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3821,12 +5459,23 @@ pub mod node_service_server { "/node_service.NodeService/ServerInfo" => { #[allow(non_camel_case_types)] struct ServerInfoSvc(pub Arc); - impl tonic::server::UnaryService for ServerInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ServerInfoSvc { type Response = super::ServerInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::server_info(&inner, request).await }; + let fut = async move { + ::server_info(&inner, request).await + }; Box::pin(fut) } } @@ -3839,8 +5488,14 @@ pub mod node_service_server { let method = ServerInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3849,12 +5504,23 @@ pub mod node_service_server { "/node_service.NodeService/GetCpus" => { #[allow(non_camel_case_types)] struct GetCpusSvc(pub Arc); - impl tonic::server::UnaryService for GetCpusSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetCpusSvc { type Response = super::GetCpusResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_cpus(&inner, request).await }; + let fut = async move { + ::get_cpus(&inner, request).await + }; Box::pin(fut) } } @@ -3867,8 +5533,14 @@ pub mod node_service_server { let method = GetCpusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3877,12 +5549,23 @@ pub mod node_service_server { "/node_service.NodeService/GetNetInfo" => { #[allow(non_camel_case_types)] struct GetNetInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetNetInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetNetInfoSvc { type Response = super::GetNetInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_net_info(&inner, request).await }; + let fut = async move { + ::get_net_info(&inner, request).await + }; Box::pin(fut) } } @@ -3895,8 +5578,14 @@ pub mod node_service_server { let method = GetNetInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3905,12 +5594,23 @@ pub mod node_service_server { "/node_service.NodeService/GetPartitions" => { #[allow(non_camel_case_types)] struct GetPartitionsSvc(pub Arc); - impl tonic::server::UnaryService for GetPartitionsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetPartitionsSvc { type Response = super::GetPartitionsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_partitions(&inner, request).await }; + let fut = async move { + ::get_partitions(&inner, request).await + }; Box::pin(fut) } } @@ -3923,8 +5623,14 @@ pub mod node_service_server { let method = GetPartitionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3933,12 +5639,23 @@ pub mod node_service_server { "/node_service.NodeService/GetOsInfo" => { #[allow(non_camel_case_types)] struct GetOsInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetOsInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetOsInfoSvc { type Response = super::GetOsInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_os_info(&inner, request).await }; + let fut = async move { + ::get_os_info(&inner, request).await + }; Box::pin(fut) } } @@ -3951,8 +5668,14 @@ pub mod node_service_server { let method = GetOsInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3961,12 +5684,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSELinuxInfo" => { #[allow(non_camel_case_types)] struct GetSELinuxInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetSELinuxInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSELinuxInfoSvc { type Response = super::GetSeLinuxInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_se_linux_info(&inner, request).await }; + let fut = async move { + ::get_se_linux_info(&inner, request).await + }; Box::pin(fut) } } @@ -3979,8 +5713,14 @@ pub mod node_service_server { let method = GetSELinuxInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3989,12 +5729,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSysConfig" => { #[allow(non_camel_case_types)] struct GetSysConfigSvc(pub Arc); - impl tonic::server::UnaryService for GetSysConfigSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSysConfigSvc { type Response = super::GetSysConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sys_config(&inner, request).await }; + let fut = async move { + ::get_sys_config(&inner, request).await + }; Box::pin(fut) } } @@ -4007,8 +5758,14 @@ pub mod node_service_server { let method = GetSysConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4017,12 +5774,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSysErrors" => { #[allow(non_camel_case_types)] struct GetSysErrorsSvc(pub Arc); - impl tonic::server::UnaryService for GetSysErrorsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSysErrorsSvc { type Response = super::GetSysErrorsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sys_errors(&inner, request).await }; + let fut = async move { + ::get_sys_errors(&inner, request).await + }; Box::pin(fut) } } @@ -4035,8 +5803,14 @@ pub mod node_service_server { let method = GetSysErrorsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4045,12 +5819,23 @@ pub mod node_service_server { "/node_service.NodeService/GetMemInfo" => { #[allow(non_camel_case_types)] struct GetMemInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetMemInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMemInfoSvc { type Response = super::GetMemInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_mem_info(&inner, request).await }; + let fut = async move { + ::get_mem_info(&inner, request).await + }; Box::pin(fut) } } @@ -4063,8 +5848,14 @@ pub mod node_service_server { let method = GetMemInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4073,12 +5864,23 @@ pub mod node_service_server { "/node_service.NodeService/GetMetrics" => { #[allow(non_camel_case_types)] struct GetMetricsSvc(pub Arc); - impl tonic::server::UnaryService for GetMetricsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMetricsSvc { type Response = super::GetMetricsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_metrics(&inner, request).await }; + let fut = async move { + ::get_metrics(&inner, request).await + }; Box::pin(fut) } } @@ -4091,8 +5893,14 @@ pub mod node_service_server { let method = GetMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4101,12 +5909,23 @@ pub mod node_service_server { "/node_service.NodeService/GetProcInfo" => { #[allow(non_camel_case_types)] struct GetProcInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetProcInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetProcInfoSvc { type Response = super::GetProcInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_proc_info(&inner, request).await }; + let fut = async move { + ::get_proc_info(&inner, request).await + }; Box::pin(fut) } } @@ -4119,8 +5938,14 @@ pub mod node_service_server { let method = GetProcInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4129,12 +5954,23 @@ pub mod node_service_server { "/node_service.NodeService/StartProfiling" => { #[allow(non_camel_case_types)] struct StartProfilingSvc(pub Arc); - impl tonic::server::UnaryService for StartProfilingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StartProfilingSvc { type Response = super::StartProfilingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::start_profiling(&inner, request).await }; + let fut = async move { + ::start_profiling(&inner, request).await + }; Box::pin(fut) } } @@ -4147,8 +5983,14 @@ pub mod node_service_server { let method = StartProfilingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4157,12 +5999,24 @@ pub mod node_service_server { "/node_service.NodeService/DownloadProfileData" => { #[allow(non_camel_case_types)] struct DownloadProfileDataSvc(pub Arc); - impl tonic::server::UnaryService for DownloadProfileDataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DownloadProfileDataSvc { type Response = super::DownloadProfileDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::download_profile_data(&inner, request).await }; + let fut = async move { + ::download_profile_data(&inner, request) + .await + }; Box::pin(fut) } } @@ -4175,8 +6029,14 @@ pub mod node_service_server { let method = DownloadProfileDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4185,12 +6045,23 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketStats" => { #[allow(non_camel_case_types)] struct GetBucketStatsSvc(pub Arc); - impl tonic::server::UnaryService for GetBucketStatsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetBucketStatsSvc { type Response = super::GetBucketStatsDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_bucket_stats(&inner, request).await }; + let fut = async move { + ::get_bucket_stats(&inner, request).await + }; Box::pin(fut) } } @@ -4203,8 +6074,14 @@ pub mod node_service_server { let method = GetBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4213,12 +6090,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSRMetrics" => { #[allow(non_camel_case_types)] struct GetSRMetricsSvc(pub Arc); - impl tonic::server::UnaryService for GetSRMetricsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSRMetricsSvc { type Response = super::GetSrMetricsDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sr_metrics(&inner, request).await }; + let fut = async move { + ::get_sr_metrics(&inner, request).await + }; Box::pin(fut) } } @@ -4231,8 +6119,14 @@ pub mod node_service_server { let method = GetSRMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4241,12 +6135,24 @@ pub mod node_service_server { "/node_service.NodeService/GetAllBucketStats" => { #[allow(non_camel_case_types)] struct GetAllBucketStatsSvc(pub Arc); - impl tonic::server::UnaryService for GetAllBucketStatsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetAllBucketStatsSvc { type Response = super::GetAllBucketStatsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_all_bucket_stats(&inner, request).await }; + let fut = async move { + ::get_all_bucket_stats(&inner, request) + .await + }; Box::pin(fut) } } @@ -4259,8 +6165,14 @@ pub mod node_service_server { let method = GetAllBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4269,12 +6181,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadBucketMetadata" => { #[allow(non_camel_case_types)] struct LoadBucketMetadataSvc(pub Arc); - impl tonic::server::UnaryService for LoadBucketMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadBucketMetadataSvc { type Response = super::LoadBucketMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_bucket_metadata(&inner, request).await }; + let fut = async move { + ::load_bucket_metadata(&inner, request) + .await + }; Box::pin(fut) } } @@ -4287,8 +6211,14 @@ pub mod node_service_server { let method = LoadBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4297,12 +6227,24 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucketMetadata" => { #[allow(non_camel_case_types)] struct DeleteBucketMetadataSvc(pub Arc); - impl tonic::server::UnaryService for DeleteBucketMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteBucketMetadataSvc { type Response = super::DeleteBucketMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_bucket_metadata(&inner, request).await }; + let fut = async move { + ::delete_bucket_metadata(&inner, request) + .await + }; Box::pin(fut) } } @@ -4315,8 +6257,14 @@ pub mod node_service_server { let method = DeleteBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4325,12 +6273,23 @@ pub mod node_service_server { "/node_service.NodeService/DeletePolicy" => { #[allow(non_camel_case_types)] struct DeletePolicySvc(pub Arc); - impl tonic::server::UnaryService for DeletePolicySvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeletePolicySvc { type Response = super::DeletePolicyResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_policy(&inner, request).await }; + let fut = async move { + ::delete_policy(&inner, request).await + }; Box::pin(fut) } } @@ -4343,8 +6302,14 @@ pub mod node_service_server { let method = DeletePolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4353,12 +6318,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicy" => { #[allow(non_camel_case_types)] struct LoadPolicySvc(pub Arc); - impl tonic::server::UnaryService for LoadPolicySvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadPolicySvc { type Response = super::LoadPolicyResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_policy(&inner, request).await }; + let fut = async move { + ::load_policy(&inner, request).await + }; Box::pin(fut) } } @@ -4371,8 +6347,14 @@ pub mod node_service_server { let method = LoadPolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4381,12 +6363,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicyMapping" => { #[allow(non_camel_case_types)] struct LoadPolicyMappingSvc(pub Arc); - impl tonic::server::UnaryService for LoadPolicyMappingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadPolicyMappingSvc { type Response = super::LoadPolicyMappingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_policy_mapping(&inner, request).await }; + let fut = async move { + ::load_policy_mapping(&inner, request) + .await + }; Box::pin(fut) } } @@ -4399,8 +6393,14 @@ pub mod node_service_server { let method = LoadPolicyMappingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4409,12 +6409,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteUser" => { #[allow(non_camel_case_types)] struct DeleteUserSvc(pub Arc); - impl tonic::server::UnaryService for DeleteUserSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteUserSvc { type Response = super::DeleteUserResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_user(&inner, request).await }; + let fut = async move { + ::delete_user(&inner, request).await + }; Box::pin(fut) } } @@ -4427,8 +6438,14 @@ pub mod node_service_server { let method = DeleteUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4437,12 +6454,24 @@ pub mod node_service_server { "/node_service.NodeService/DeleteServiceAccount" => { #[allow(non_camel_case_types)] struct DeleteServiceAccountSvc(pub Arc); - impl tonic::server::UnaryService for DeleteServiceAccountSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteServiceAccountSvc { type Response = super::DeleteServiceAccountResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_service_account(&inner, request).await }; + let fut = async move { + ::delete_service_account(&inner, request) + .await + }; Box::pin(fut) } } @@ -4455,8 +6484,14 @@ pub mod node_service_server { let method = DeleteServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4465,12 +6500,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadUser" => { #[allow(non_camel_case_types)] struct LoadUserSvc(pub Arc); - impl tonic::server::UnaryService for LoadUserSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadUserSvc { type Response = super::LoadUserResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_user(&inner, request).await }; + let fut = async move { + ::load_user(&inner, request).await + }; Box::pin(fut) } } @@ -4483,8 +6529,14 @@ pub mod node_service_server { let method = LoadUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4493,12 +6545,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadServiceAccount" => { #[allow(non_camel_case_types)] struct LoadServiceAccountSvc(pub Arc); - impl tonic::server::UnaryService for LoadServiceAccountSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadServiceAccountSvc { type Response = super::LoadServiceAccountResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_service_account(&inner, request).await }; + let fut = async move { + ::load_service_account(&inner, request) + .await + }; Box::pin(fut) } } @@ -4511,8 +6575,14 @@ pub mod node_service_server { let method = LoadServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4521,12 +6591,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadGroup" => { #[allow(non_camel_case_types)] struct LoadGroupSvc(pub Arc); - impl tonic::server::UnaryService for LoadGroupSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadGroupSvc { type Response = super::LoadGroupResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_group(&inner, request).await }; + let fut = async move { + ::load_group(&inner, request).await + }; Box::pin(fut) } } @@ -4539,8 +6620,14 @@ pub mod node_service_server { let method = LoadGroupSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4549,14 +6636,30 @@ pub mod node_service_server { "/node_service.NodeService/ReloadSiteReplicationConfig" => { #[allow(non_camel_case_types)] struct ReloadSiteReplicationConfigSvc(pub Arc); - impl tonic::server::UnaryService - for ReloadSiteReplicationConfigSvc - { + impl< + T: NodeService, + > tonic::server::UnaryService< + super::ReloadSiteReplicationConfigRequest, + > for ReloadSiteReplicationConfigSvc { type Response = super::ReloadSiteReplicationConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::ReloadSiteReplicationConfigRequest, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::reload_site_replication_config(&inner, request).await }; + let fut = async move { + ::reload_site_replication_config( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4569,8 +6672,14 @@ pub mod node_service_server { let method = ReloadSiteReplicationConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4579,12 +6688,23 @@ pub mod node_service_server { "/node_service.NodeService/SignalService" => { #[allow(non_camel_case_types)] struct SignalServiceSvc(pub Arc); - impl tonic::server::UnaryService for SignalServiceSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for SignalServiceSvc { type Response = super::SignalServiceResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::signal_service(&inner, request).await }; + let fut = async move { + ::signal_service(&inner, request).await + }; Box::pin(fut) } } @@ -4597,8 +6717,14 @@ pub mod node_service_server { let method = SignalServiceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4607,12 +6733,24 @@ pub mod node_service_server { "/node_service.NodeService/BackgroundHealStatus" => { #[allow(non_camel_case_types)] struct BackgroundHealStatusSvc(pub Arc); - impl tonic::server::UnaryService for BackgroundHealStatusSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for BackgroundHealStatusSvc { type Response = super::BackgroundHealStatusResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::background_heal_status(&inner, request).await }; + let fut = async move { + ::background_heal_status(&inner, request) + .await + }; Box::pin(fut) } } @@ -4625,8 +6763,14 @@ pub mod node_service_server { let method = BackgroundHealStatusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4635,12 +6779,24 @@ pub mod node_service_server { "/node_service.NodeService/GetMetacacheListing" => { #[allow(non_camel_case_types)] struct GetMetacacheListingSvc(pub Arc); - impl tonic::server::UnaryService for GetMetacacheListingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMetacacheListingSvc { type Response = super::GetMetacacheListingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_metacache_listing(&inner, request).await }; + let fut = async move { + ::get_metacache_listing(&inner, request) + .await + }; Box::pin(fut) } } @@ -4653,8 +6809,14 @@ pub mod node_service_server { let method = GetMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4663,12 +6825,27 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetacacheListing" => { #[allow(non_camel_case_types)] struct UpdateMetacacheListingSvc(pub Arc); - impl tonic::server::UnaryService for UpdateMetacacheListingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UpdateMetacacheListingSvc { type Response = super::UpdateMetacacheListingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::update_metacache_listing(&inner, request).await }; + let fut = async move { + ::update_metacache_listing( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4681,8 +6858,14 @@ pub mod node_service_server { let method = UpdateMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4691,12 +6874,23 @@ pub mod node_service_server { "/node_service.NodeService/ReloadPoolMeta" => { #[allow(non_camel_case_types)] struct ReloadPoolMetaSvc(pub Arc); - impl tonic::server::UnaryService for ReloadPoolMetaSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReloadPoolMetaSvc { type Response = super::ReloadPoolMetaResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::reload_pool_meta(&inner, request).await }; + let fut = async move { + ::reload_pool_meta(&inner, request).await + }; Box::pin(fut) } } @@ -4709,8 +6903,14 @@ pub mod node_service_server { let method = ReloadPoolMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4719,12 +6919,23 @@ pub mod node_service_server { "/node_service.NodeService/StopRebalance" => { #[allow(non_camel_case_types)] struct StopRebalanceSvc(pub Arc); - impl tonic::server::UnaryService for StopRebalanceSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StopRebalanceSvc { type Response = super::StopRebalanceResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::stop_rebalance(&inner, request).await }; + let fut = async move { + ::stop_rebalance(&inner, request).await + }; Box::pin(fut) } } @@ -4737,8 +6948,14 @@ pub mod node_service_server { let method = StopRebalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4747,12 +6964,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadRebalanceMeta" => { #[allow(non_camel_case_types)] struct LoadRebalanceMetaSvc(pub Arc); - impl tonic::server::UnaryService for LoadRebalanceMetaSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadRebalanceMetaSvc { type Response = super::LoadRebalanceMetaResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_rebalance_meta(&inner, request).await }; + let fut = async move { + ::load_rebalance_meta(&inner, request) + .await + }; Box::pin(fut) } } @@ -4765,8 +6994,14 @@ pub mod node_service_server { let method = LoadRebalanceMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4775,12 +7010,29 @@ pub mod node_service_server { "/node_service.NodeService/LoadTransitionTierConfig" => { #[allow(non_camel_case_types)] struct LoadTransitionTierConfigSvc(pub Arc); - impl tonic::server::UnaryService for LoadTransitionTierConfigSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadTransitionTierConfigSvc { type Response = super::LoadTransitionTierConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::LoadTransitionTierConfigRequest, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_transition_tier_config(&inner, request).await }; + let fut = async move { + ::load_transition_tier_config( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4793,20 +7045,36 @@ pub mod node_service_server { let method = LoadTransitionTierConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } - _ => Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers.insert(tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into()); - headers.insert(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE); - Ok(response) - }), + _ => { + Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } } } } diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 2fe011da9..72cf24178 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -6,8 +6,7 @@ use super::{endpoint::Endpoint, error::DiskError, format::FormatV3}; use super::{ os, CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskMetrics, FileInfoVersions, FileReader, FileWriter, Info, MetaCacheEntry, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, - UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, FORMAT_CONFIG_FILE, RUSTFS_META_BUCKET, - STORAGE_FORMAT_FILE_BACKUP, + UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET, STORAGE_FORMAT_FILE_BACKUP, }; use crate::bitrot::bitrot_verify; use crate::bucket::metadata_sys::{self}; @@ -51,7 +50,7 @@ use nix::NixPath; use path_absolutize::Absolutize; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; -use std::io::{Cursor, Write}; +use std::io::Cursor; use std::os::unix::fs::MetadataExt; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; diff --git a/ecstore/src/heal/heal_ops.rs b/ecstore/src/heal/heal_ops.rs index ed774ecbe..b7b694b41 100644 --- a/ecstore/src/heal/heal_ops.rs +++ b/ecstore/src/heal/heal_ops.rs @@ -2,7 +2,7 @@ use super::{ background_heal_ops::HealTask, data_scanner::HEAL_DELETE_DANGLING, error::ERR_SKIP_FILE, - heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingDisk, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, + heal_commands::{HealOpts, HealScanMode, HealStopSuccess, HealingTracker, HEAL_ITEM_BUCKET_METADATA}, }; use crate::store_api::StorageAPI; use crate::{ diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 518104462..384708664 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -1,11 +1,7 @@ use crate::disk::MetaCacheEntry; use crate::error::Error; use crate::error::Result; -use rmp::decode::RmpRead; -use rmp::encode::RmpWrite; use rmp::Marker; -use std::io::Read; -use std::io::Write; use std::str::from_utf8; use tokio::io::AsyncRead; use tokio::io::AsyncReadExt; diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index aaf6d4d12..063db66b9 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -32,7 +32,7 @@ pub struct NotificationSys { impl NotificationSys { pub async fn new(eps: EndpointServerPools) -> Self { - let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(&eps).await; + let (peer_clients, all_peer_clients) = PeerRestClient::new_clients(eps).await; Self { peer_clients, all_peer_clients, diff --git a/madmin/Cargo.toml b/madmin/Cargo.toml index 1d385f9b9..5a32ec152 100644 --- a/madmin/Cargo.toml +++ b/madmin/Cargo.toml @@ -18,4 +18,3 @@ psutil = "3.3.0" serde.workspace = true time.workspace =true tracing.workspace = true -time.workspace =true diff --git a/rustfs/src/admin/handlers/trace.rs b/rustfs/src/admin/handlers/trace.rs index cf3c1710a..f6430ba90 100644 --- a/rustfs/src/admin/handlers/trace.rs +++ b/rustfs/src/admin/handlers/trace.rs @@ -29,7 +29,7 @@ impl Operation for Trace { // let (tx, rx) = mpsc::channel(10000); let perrs = match GLOBAL_Endpoints.get() { - Some(ep) => PeerRestClient::new_clients(ep).await, + Some(ep) => PeerRestClient::new_clients(ep.clone()).await, None => (Vec::new(), Vec::new()), }; return Err(s3_error!(NotImplemented)); diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index 4dea0f4fa..f9b6746ad 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -211,7 +211,6 @@ async fn run(opt: config::Opt) -> Result<()> { .await .map_err(|err| { error!("ECStore::new {:?}", &err); - panic!("{}", err); Error::from_string(err.to_string()) })?; From dc0d415b1596e31d67e980ac87ba0a0d1267252d Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 16 Dec 2024 23:05:16 +0800 Subject: [PATCH 56/77] test walk_dir done --- ecstore/src/disk/local.rs | 28 +++++++++++++++------------- ecstore/src/metacache/writer.rs | 4 +++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 2fe011da9..fa82685af 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -818,6 +818,7 @@ impl LocalDisk { }) .await?; *objs_returned += 1; + return Ok(()); } } @@ -927,7 +928,6 @@ impl LocalDisk { if opts.recursive { let mut dir = dir; - if let Err(er) = Box::pin(self.scan_dir(&mut dir, opts, out, objs_returned)).await { warn!("scan_dir err {:?}", &er); } @@ -1501,10 +1501,6 @@ impl DiskAPI for LocalDisk { let volume_dir = self.get_bucket_path(volume)?; let dir_path_abs = volume_dir.join(Path::new(&dir_path.trim_start_matches(SLASH_SEPARATOR))); - println!( - "list dir volume_dir: {:?} join dir_path {} = abs {:?}", - &volume_dir, &dir_path, dir_path_abs - ); let entries = match os::read_dir(&dir_path_abs, count).await { Ok(res) => res, @@ -1524,8 +1520,6 @@ impl DiskAPI for LocalDisk { // FIXME: TODO: io.writer TODO cancel #[tracing::instrument(level = "debug", skip(self, wr))] async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result> { - // warn!("walk_dir opts {:?}", &opts); - let volume_dir = self.get_bucket_path(&opts.bucket)?; if !skip_access_checks(&opts.bucket) { @@ -1550,7 +1544,6 @@ impl DiskAPI for LocalDisk { .as_str(), )?; - println!("fpath {:?}", &fpath); if let Ok(data) = self.read_metadata(fpath).await { let meta = MetaCacheEntry { name: opts.base_dir.clone(), @@ -1564,6 +1557,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()) } @@ -2343,6 +2337,7 @@ async fn get_disk_info(drive_path: PathBuf) -> Result<(Info, bool)> { #[cfg(test)] mod test { + use futures::future::join_all; use tokio::io::BufWriter; use utils::fs::open_file; use utils::fs::O_RDWR; @@ -2447,11 +2442,12 @@ mod test { } }; - let (rd, mut wr) = tokio::io::duplex(64); + let (rd, mut wr) = tokio::io::duplex(1024); let job = tokio::spawn(async move { let opts = WalkDirOptions { bucket: "dada".to_owned(), + base_dir: "".to_owned(), recursive: true, ..Default::default() }; @@ -2460,15 +2456,21 @@ mod test { } }); - let rd_job = tokio::spawn(async move { + let job2 = tokio::spawn(async move { let mut mrd = MetacacheReader::new(rd); while let Some(info) = mrd.peek().await.unwrap_or_default() { - println!("{:?}", info) + println!("info {:?}", info.name) } }); + job.await; + job2.await; - job.await.unwrap(); - rd_job.await.unwrap(); + // let mut jobs = Vec::new(); + + // jobs.push(job); + // jobs.push(job2); + + // join_all(jobs).await; } } diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 24a5ee79e..c9e2ce599 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -70,6 +70,8 @@ impl MetacacheWriter { self.init().await?; rmp::encode::write_bool(&mut self.buf, true).map_err(|e| Error::msg(format!("{:?}", e)))?; + rmp::encode::write_str(&mut self.buf, &obj.name).map_err(|e| Error::msg(format!("{:?}", e)))?; + rmp::encode::write_bin(&mut self.buf, &obj.metadata).map_err(|e| Error::msg(format!("{:?}", e)))?; self.flush().await?; Ok(()) @@ -197,7 +199,7 @@ impl MetacacheReader { Marker::Str8 => Ok(u32::from(self.read_u8().await?)), Marker::Str16 => Ok(u32::from(self.read_u16().await?)), Marker::Str32 => Ok(self.read_u32().await?), - _ => Err(Error::msg("str marker err")), + marker => Err(Error::msg("str marker err")), } } From 4195371a1ebae955c0d5a9abf9d61e7018276c3e Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 17 Dec 2024 14:28:37 +0800 Subject: [PATCH 57/77] test_list_path_raw done --- ecstore/src/cache_value/metacache_set.rs | 340 ++++++++++++++--------- ecstore/src/disk/error.rs | 11 + ecstore/src/disk/local.rs | 47 ---- ecstore/src/disk/mod.rs | 7 +- ecstore/src/endpoints.rs | 3 +- ecstore/src/error.rs | 7 +- ecstore/src/file_meta.rs | 4 - ecstore/src/metacache/writer.rs | 51 +++- ecstore/src/store_list_objects.rs | 129 +++++++++ 9 files changed, 401 insertions(+), 198 deletions(-) diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index a7ed75af0..2f719485d 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -1,5 +1,6 @@ use std::{future::Future, pin::Pin, sync::Arc}; +use futures::{future::join_all, join}; use tokio::{ spawn, sync::{ @@ -8,11 +9,16 @@ use tokio::{ RwLock, }, }; +use tracing::error; use crate::{ - disk::{DiskAPI, DiskStore, MetaCacheEntries, MetaCacheEntry, WalkDirOptions}, + disk::{ + error::{is_err_eof, is_err_file_not_found, is_err_volume_not_found, DiskError}, + DiskAPI, DiskStore, MetaCacheEntries, MetaCacheEntry, WalkDirOptions, + }, error::{Error, Result}, io::Writer, + metacache::writer::MetacacheReader, }; type AgreedFn = Box Pin + Send>> + Send + 'static>; @@ -62,44 +68,40 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - return Err(Error::from_string("list_path_raw: 0 drives provided")); } + let mut jobs: Vec>> = Vec::new(); let mut readers = Vec::with_capacity(opts.disks.len()); let fds = Arc::new(RwLock::new(opts.fallback_disks.clone())); for disk in opts.disks.iter() { - let disk = disk.clone(); + let opdisk = disk.clone(); let opts_clone = opts.clone(); let fds_clone = fds.clone(); - let (m_tx, m_rx) = mpsc::channel::(100); - readers.push(m_rx); - spawn(async move { + // let (m_tx, m_rx) = mpsc::channel::(100); + // readers.push(m_rx); + let (rd, mut wr) = tokio::io::duplex(64); + readers.push(MetacacheReader::new(rd)); + jobs.push(spawn(async move { + let wakl_opts = WalkDirOptions { + bucket: opts_clone.bucket.clone(), + base_dir: opts_clone.path.clone(), + recursive: opts_clone.recursice, + report_notfound: opts_clone.report_not_found, + filter_prefix: opts_clone.filter_prefix.clone(), + forward_to: opts_clone.forward_to.clone(), + limit: opts_clone.per_disk_limit, + ..Default::default() + }; + let mut need_fallback = false; - if disk.is_none() { - need_fallback = true; - } else { - match disk - .as_ref() - .unwrap() - .walk_dir( - WalkDirOptions { - bucket: opts_clone.bucket.clone(), - base_dir: opts_clone.path.clone(), - recursive: opts_clone.recursice, - report_notfound: opts_clone.report_not_found, - filter_prefix: opts_clone.filter_prefix.clone(), - forward_to: opts_clone.forward_to.clone(), - limit: opts_clone.per_disk_limit, - ..Default::default() - }, - &mut Writer::NotUse, - ) - .await - { - Ok(r) => { - for v in r.iter() { - let _ = m_tx.send(v.to_owned()).await; - } + if let Some(disk) = opdisk { + match disk.walk_dir(wakl_opts, &mut wr).await { + Ok(_res) => {} + Err(err) => { + error!("walk dir err {:?}", &err); + need_fallback = true; } - Err(_) => need_fallback = true, } + } else { + need_fallback = true; } while need_fallback { @@ -108,133 +110,203 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - if fds_w.is_empty() { break None; } - let fd = fds_w.remove(0); - if fd.is_some() && fd.as_ref().unwrap().is_online().await { - break fd; + + if let Some(fd) = fds_w.remove(0) { + if fd.is_online().await { + break Some(fd); + } } }; - if f_disk.is_none() { + + if let Some(disk) = f_disk { + match disk + .as_ref() + .walk_dir( + WalkDirOptions { + bucket: opts_clone.bucket.clone(), + base_dir: opts_clone.path.clone(), + recursive: opts_clone.recursice, + report_notfound: opts_clone.report_not_found, + filter_prefix: opts_clone.filter_prefix.clone(), + forward_to: opts_clone.forward_to.clone(), + limit: opts_clone.per_disk_limit, + ..Default::default() + }, + &mut wr, + ) + .await + { + Ok(_r) => { + need_fallback = false; + } + Err(err) => { + error!("walk dir2 err {:?}", &err); + break; + } + } + } else { break; } - match disk - .as_ref() - .unwrap() - .walk_dir( - WalkDirOptions { - bucket: opts_clone.bucket.clone(), - base_dir: opts_clone.path.clone(), - recursive: opts_clone.recursice, - report_notfound: opts_clone.report_not_found, - filter_prefix: opts_clone.filter_prefix.clone(), - forward_to: opts_clone.forward_to.clone(), - limit: opts_clone.per_disk_limit, - ..Default::default() - }, - &mut Writer::NotUse, - ) - .await - { - Ok(r) => { - for v in r.iter() { - let _ = m_tx.send(v.to_owned()).await; - } - need_fallback = false; - } - Err(_) => break, - } } - }); + + Ok(()) + })); } - let errs: Vec> = vec![None; readers.len()]; - loop { - let mut current = MetaCacheEntry::default(); - let (mut at_eof, mut has_err, mut agree) = (0, 0, 0); - if rx.try_recv().is_ok() { - return Err(Error::from_string("canceled")); - } - let mut top_entries: Vec = Vec::with_capacity(readers.len()); - // top_entries.clear(); + let revjob = spawn(async move { + let mut errs: Vec> = vec![None; readers.len()]; + loop { + let mut current = MetaCacheEntry::default(); - for (i, r) in readers.iter_mut().enumerate() { - if errs[i].is_none() { - has_err += 1; - continue; + if rx.try_recv().is_ok() { + return Err(Error::from_string("canceled")); } - let entry = match r.recv().await { - Some(entry) => entry, - None => { - at_eof += 1; + let mut top_entries: Vec> = vec![None; readers.len()]; + + let mut at_eof = 0; + let mut fnf = 0; + let mut vnf = 0; + let mut has_err = 0; + let mut agree = 0; + + for (i, r) in readers.iter_mut().enumerate() { + if errs[i].is_some() { + has_err += 1; continue; } - }; - // If no current, add it. - if current.name.is_empty() { - top_entries.insert(i, entry.clone()); + + let entry = match r.peek().await { + Ok(res) => { + if let Some(entry) = res { + entry + } else { + // eof + at_eof += 1; + + continue; + } + } + Err(err) => { + if is_err_eof(&err) { + at_eof += 1; + continue; + } else if is_err_file_not_found(&err) { + at_eof += 1; + fnf += 1; + continue; + } else if is_err_volume_not_found(&err) { + at_eof += 1; + fnf += 1; + vnf += 1; + continue; + } else { + has_err += 1; + errs[i] = Some(err); + continue; + } + } + }; + + // If no current, add it. + if current.name.is_empty() { + top_entries.insert(i, Some(entry.clone())); + current = entry; + agree += 1; + + continue; + } + // If exact match, we agree. + if let Ok((_, true)) = current.matches(&entry, true) { + top_entries.insert(i, Some(entry)); + agree += 1; + + continue; + } + // If only the name matches we didn't agree, but add it for resolution. + if entry.name == current.name { + top_entries.insert(i, Some(entry)); + + continue; + } + // We got different entries + if entry.name > current.name { + continue; + } + // We got a new, better current. + // Clear existing entries. + top_entries.clear(); + agree += 1; + top_entries.insert(i, Some(entry.clone())); current = entry; - agree += 1; - continue; } - // If exact match, we agree. - if let Ok((_, true)) = current.matches(&entry, true) { - top_entries.insert(i, entry); - agree += 1; - continue; - } - // If only the name matches we didn't agree, but add it for resolution. - if entry.name == current.name { - top_entries.insert(i, entry); - continue; - } - // We got different entries - if entry.name > current.name { - continue; - } - // We got a new, better current. - // Clear existing entries. - top_entries.clear(); - agree += 1; - top_entries.insert(i, entry.clone()); - current = entry; - } - if has_err > 0 && has_err > opts.disks.len() - opts.min_disks { - if let Some(finished_fn) = opts.finished.as_ref() { - finished_fn(&errs).await; + if vnf > 0 && vnf >= (readers.len() - opts.min_disks) { + return Err(Error::new(DiskError::VolumeNotFound)); } - let mut combined_err = Vec::new(); - errs.iter().zip(opts.disks.iter()).for_each(|(err, disk)| match (err, disk) { - (Some(err), Some(disk)) => { - combined_err.push(format!("drive {} returned: {}", disk.to_string(), err)); + + if fnf > 0 && fnf >= (readers.len() - opts.min_disks) { + return Err(Error::new(DiskError::FileNotFound)); + } + + if has_err > 0 && has_err > opts.disks.len() - opts.min_disks { + if let Some(finished_fn) = opts.finished.as_ref() { + finished_fn(&errs).await; } - (Some(err), None) => { - combined_err.push(err.to_string()); + let mut combined_err = Vec::new(); + errs.iter().zip(opts.disks.iter()).for_each(|(err, disk)| match (err, disk) { + (Some(err), Some(disk)) => { + combined_err.push(format!("drive {} returned: {}", disk.to_string(), err)); + } + (Some(err), None) => { + combined_err.push(err.to_string()); + } + _ => {} + }); + + return Err(Error::from_string(combined_err.join(", "))); + } + + // Break if all at EOF or error. + if at_eof + has_err == readers.len() { + if has_err > 0 { + if let Some(finished_fn) = opts.finished.as_ref() { + if has_err > 0 { + finished_fn(&errs).await; + } + } } - _ => {} - }); - return Err(Error::from_string(combined_err.join(", "))); - } + break; + } - // Break if all at EOF or error. - if at_eof + has_err == readers.len() && has_err > 0 { - if let Some(finished_fn) = opts.finished.as_ref() { - finished_fn(&errs).await; + if agree == readers.len() { + for r in readers.iter_mut() { + let _ = r.skip(1).await; + } + if let Some(agreed_fn) = opts.agreed.as_ref() { + agreed_fn(current).await; + } + + continue; + } + + for (i, r) in readers.iter_mut().enumerate() { + if top_entries[i].is_some() { + let _ = r.skip(1).await; + } + } + + if let Some(partial_fn) = opts.partial.as_ref() { + partial_fn(MetaCacheEntries(top_entries), &errs).await; } break; } + Ok(()) + }); - if agree == readers.len() { - if let Some(agreed_fn) = opts.agreed.as_ref() { - agreed_fn(current).await; - } - continue; - } + jobs.push(revjob); - if let Some(partial_fn) = opts.partial.as_ref() { - partial_fn(MetaCacheEntries(top_entries), &errs).await; - } - } + let a = join_all(jobs).await; Ok(()) } diff --git a/ecstore/src/disk/error.rs b/ecstore/src/disk/error.rs index d20c00a3f..244c5928f 100644 --- a/ecstore/src/disk/error.rs +++ b/ecstore/src/disk/error.rs @@ -273,6 +273,17 @@ pub fn is_err_file_not_found(err: &Error) -> bool { matches!(err.downcast_ref::(), Some(DiskError::FileNotFound)) } +pub fn is_err_volume_not_found(err: &Error) -> bool { + matches!(err.downcast_ref::(), Some(DiskError::VolumeNotFound)) +} + +pub fn is_err_eof(err: &Error) -> bool { + if let Some(ioerr) = err.downcast_ref::() { + return ioerr.kind() == ErrorKind::UnexpectedEof; + } + false +} + pub fn is_sys_err_no_space(e: &io::Error) -> bool { if let Some(no) = e.raw_os_error() { return no == 28; diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index fa82685af..131630b3f 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -2426,51 +2426,4 @@ mod test { let _ = fs::remove_dir_all(&p).await; } - - #[tokio::test] - async fn test_walk_dir() { - let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); - ep.pool_idx = 0; - ep.set_idx = 0; - ep.disk_idx = 0; - - let disk = match LocalDisk::new(&ep, false).await { - Ok(res) => res, - Err(err) => { - println!("LocalDisk::new err {:?}", err); - return; - } - }; - - let (rd, mut wr) = tokio::io::duplex(1024); - - let job = tokio::spawn(async move { - let opts = WalkDirOptions { - bucket: "dada".to_owned(), - base_dir: "".to_owned(), - recursive: true, - ..Default::default() - }; - if let Err(err) = disk.walk_dir(opts, &mut wr).await { - println!("walk_dir err {:?}", err); - } - }); - - let job2 = tokio::spawn(async move { - let mut mrd = MetacacheReader::new(rd); - - while let Some(info) = mrd.peek().await.unwrap_or_default() { - println!("info {:?}", info.name) - } - }); - job.await; - job2.await; - - // let mut jobs = Vec::new(); - - // jobs.push(job); - // jobs.push(job2); - - // join_all(jobs).await; - } } diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index c47dd9afe..b1cc35d9b 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -770,7 +770,8 @@ impl MetaCacheEntry { } } -pub struct MetaCacheEntries(pub Vec); +#[derive(Debug)] +pub struct MetaCacheEntries(pub Vec>); impl MetaCacheEntries { pub fn resolve(&self, mut params: MetadataResolutionParams) -> Result> { @@ -785,7 +786,7 @@ impl MetaCacheEntries { let mut objs_agree = 0; let mut objs_valid = 0; - for entry in self.0.iter() { + for entry in self.0.iter().flatten() { if entry.name.is_empty() { continue; } @@ -859,7 +860,7 @@ impl MetaCacheEntries { } pub fn first_found(&self) -> (Option, usize) { - (self.0.iter().find(|x| !x.name.is_empty()).cloned(), self.0.len()) + (self.0.iter().find(|x| x.is_some()).cloned().unwrap_or_default(), self.0.len()) } } diff --git a/ecstore/src/endpoints.rs b/ecstore/src/endpoints.rs index b1205b87d..334c74d65 100644 --- a/ecstore/src/endpoints.rs +++ b/ecstore/src/endpoints.rs @@ -1,5 +1,4 @@ -use tracing::{info, warn}; -use url::Url; +use tracing::warn; use crate::{ disk::endpoint::{Endpoint, EndpointType}, diff --git a/ecstore/src/error.rs b/ecstore/src/error.rs index e7912cd8e..3d32b495c 100644 --- a/ecstore/src/error.rs +++ b/ecstore/src/error.rs @@ -1,9 +1,6 @@ -use std::io; - -use tracing::warn; -use tracing_error::{SpanTrace, SpanTraceStatus}; - use crate::disk::error::{clone_disk_err, DiskError}; +use std::io; +use tracing_error::{SpanTrace, SpanTraceStatus}; pub type StdError = Box; diff --git a/ecstore/src/file_meta.rs b/ecstore/src/file_meta.rs index 3dae801d6..8f6b03ea6 100644 --- a/ecstore/src/file_meta.rs +++ b/ecstore/src/file_meta.rs @@ -2096,10 +2096,6 @@ pub async fn read_xl_meta_no_data(reader: &mut R, size: us #[cfg(test)] mod test { - use std::fs; - use std::fs::File; - use std::os::unix::fs::MetadataExt; - use super::*; #[test] diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index c9e2ce599..c1bc1d98f 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -123,6 +123,8 @@ pub struct MetacacheReader { err: Option, buf: Vec, offset: usize, + + current: Option, } impl MetacacheReader { @@ -133,6 +135,7 @@ impl MetacacheReader { err: None, buf: Vec::new(), offset: 0, + current: None, } } @@ -199,7 +202,7 @@ impl MetacacheReader { Marker::Str8 => Ok(u32::from(self.read_u8().await?)), Marker::Str16 => Ok(u32::from(self.read_u16().await?)), Marker::Str32 => Ok(self.read_u32().await?), - marker => Err(Error::msg("str marker err")), + _marker => Err(Error::msg("str marker err")), } } @@ -239,6 +242,45 @@ impl MetacacheReader { Ok(u32::from_be_bytes(buf.try_into().expect("Slice with incorrect length"))) } + pub async fn skip(&mut self, size: usize) -> Result<()> { + self.check_init().await?; + + if let Some(err) = &self.err { + return Err(err.clone()); + } + + let mut n = size; + + if self.current.is_some() { + n -= 1; + self.current = None; + } + + while n > 0 { + match rmp::decode::read_bool(&mut self.read_more(1).await?) { + Ok(res) => { + if !res { + return Ok(()); + } + } + Err(err) => { + let serr = format!("{:?}", err); + self.err = Some(Error::msg(&serr)); + return Err(Error::msg(&serr)); + } + }; + + let l = self.read_str_len().await?; + let _ = self.read_more(l as usize).await?; + let l = self.read_bin_len().await?; + let _ = self.read_more(l as usize).await?; + + n -= 1; + } + + Ok(()) + } + pub async fn peek(&mut self) -> Result> { self.check_init().await?; @@ -279,12 +321,15 @@ impl MetacacheReader { self.reset(); - Ok(Some(MetaCacheEntry { + let entry = Some(MetaCacheEntry { name, metadata, cached: None, reusable: false, - })) + }); + self.current = entry.clone(); + + Ok(entry) } pub async fn read_all(&mut self) -> Result> { diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 5ff4586f1..fc7d47fe2 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -290,3 +290,132 @@ impl ECStore { Ok(ress) } } + +// list_path_raw + +#[cfg(test)] +mod test { + use crate::cache_value::metacache_set::list_path_raw; + use crate::cache_value::metacache_set::ListPathRawOptions; + use crate::disk::endpoint::Endpoint; + use crate::disk::error::is_err_eof; + use crate::disk::new_disk; + use crate::disk::DiskAPI; + use crate::disk::DiskOption; + use crate::disk::MetaCacheEntries; + use crate::disk::MetaCacheEntry; + use crate::disk::WalkDirOptions; + use crate::error::Error; + use crate::metacache::writer::MetacacheReader; + use futures::future::join_all; + use tokio::sync::broadcast; + + #[tokio::test] + async fn test_walk_dir() { + let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + ep.pool_idx = 0; + ep.set_idx = 0; + ep.disk_idx = 0; + ep.is_local = true; + + let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); + + // let disk = match LocalDisk::new(&ep, false).await { + // Ok(res) => res, + // Err(err) => { + // println!("LocalDisk::new err {:?}", err); + // return; + // } + // }; + + let (rd, mut wr) = tokio::io::duplex(64); + + let job = tokio::spawn(async move { + let opts = WalkDirOptions { + bucket: "dada".to_owned(), + base_dir: "".to_owned(), + recursive: true, + ..Default::default() + }; + + println!("walk opts {:?}", opts); + if let Err(err) = disk.walk_dir(opts, &mut wr).await { + println!("walk_dir err {:?}", err); + } + }); + + let job2 = tokio::spawn(async move { + let mut mrd = MetacacheReader::new(rd); + + loop { + match mrd.peek().await { + Ok(res) => { + if let Some(info) = res { + println!("info {:?}", info.name) + } else { + break; + } + } + Err(err) => { + if is_err_eof(&err) { + break; + } + + println!("get err {:?}", err); + break; + } + } + } + }); + join_all(vec![job, job2]).await; + } + + #[tokio::test] + async fn test_list_path_raw() { + let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + ep.pool_idx = 0; + ep.set_idx = 0; + ep.disk_idx = 0; + ep.is_local = true; + + let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); + + // let disk = match LocalDisk::new(&ep, false).await { + // Ok(res) => res, + // Err(err) => { + // println!("LocalDisk::new err {:?}", err); + // return; + // } + // }; + + let (_, rx) = broadcast::channel(1); + let bucket = "dada".to_owned(); + let forward_to = "".to_owned(); + let disks = vec![Some(disk)]; + let fallback_disks = Vec::new(); + + list_path_raw( + rx, + ListPathRawOptions { + disks, + fallback_disks, + bucket, + path: "".to_owned(), + recursice: true, + forward_to, + min_disks: 1, + report_not_found: false, + agreed: Some(Box::new(move |entry: MetaCacheEntry| { + Box::pin(async move { println!("get entry: {}", entry.name) }) + })), + partial: Some(Box::new(move |entries: MetaCacheEntries, _: &[Option]| { + Box::pin(async move { println!("get entries: {:?}", entries) }) + })), + finished: None, + ..Default::default() + }, + ) + .await + .unwrap(); + } +} From 2406e14e0402f27e8d0047d9070f80b038afbe18 Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 17 Dec 2024 16:41:25 +0800 Subject: [PATCH 58/77] test_list_path done --- ecstore/src/cache_value/metacache_set.rs | 11 +- ecstore/src/set_disk.rs | 82 +++++++++ ecstore/src/store_list_objects.rs | 216 ++++++++++++++++++++++- 3 files changed, 299 insertions(+), 10 deletions(-) diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index 2f719485d..6409bd78d 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -1,13 +1,9 @@ use std::{future::Future, pin::Pin, sync::Arc}; -use futures::{future::join_all, join}; +use futures::future::join_all; use tokio::{ spawn, - sync::{ - broadcast::Receiver as B_Receiver, - mpsc::{self}, - RwLock, - }, + sync::{broadcast::Receiver as B_Receiver, RwLock}, }; use tracing::error; @@ -17,7 +13,6 @@ use crate::{ DiskAPI, DiskStore, MetaCacheEntries, MetaCacheEntry, WalkDirOptions, }, error::{Error, Result}, - io::Writer, metacache::writer::MetacacheReader, }; @@ -306,7 +301,7 @@ pub async fn list_path_raw(mut rx: B_Receiver, opts: ListPathRawOptions) - jobs.push(revjob); - let a = join_all(jobs).await; + let _ = join_all(jobs).await; Ok(()) } diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index a7d1ab0ac..2bf2d6093 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -157,6 +157,88 @@ impl SetDisks { disks } + + pub async fn get_online_disks_with_healing_and_info(&self, incl_healing: bool) -> (Vec, Vec, usize) { + let mut disks = self.get_disks_internal().await; + + let mut infos = Vec::with_capacity(disks.len()); + + let mut futures = Vec::with_capacity(disks.len()); + + let mut rng = thread_rng(); + disks.shuffle(&mut rng); + + let mut numbers: Vec = (0..disks.len()).collect(); + numbers.shuffle(&mut rand::thread_rng()); + + for &i in numbers.iter() { + let disk = disks[i].clone(); + futures.push(async move { + if let Some(disk) = disk { + disk.disk_info(&DiskInfoOptions::default()).await + } else { + Err(Error::new(DiskError::DiskNotFound)) + } + }); + } + + let results = join_all(futures).await; + for result in results { + match result { + Ok(res) => { + infos.push(res); + } + Err(err) => { + infos.push(DiskInfo { + error: err.to_string(), + ..Default::default() + }); + } + } + } + + let mut healing: usize = 0; + + let mut scanning_disks = Vec::new(); + let mut healing_disks = Vec::new(); + let mut scanning_infos = Vec::new(); + let mut healing_infos = Vec::new(); + + let mut new_disks = Vec::new(); + let mut new_infos = Vec::new(); + + for &i in numbers.iter() { + let (info, disk) = (infos[i].clone(), disks[i].clone()); + if !info.error.is_empty() || disk.is_none() { + continue; + } + + if info.healing { + healing += 1; + if incl_healing { + healing_disks.push(disk.unwrap()); + healing_infos.push(info); + } + + continue; + } + + if !info.healing { + new_disks.push(disk.unwrap()); + new_infos.push(info); + } else { + scanning_disks.push(disk.unwrap()); + scanning_infos.push(info); + } + } + + new_disks.extend(scanning_disks); + new_infos.extend(scanning_infos); + new_disks.extend(healing_disks); + new_infos.extend(healing_infos); + + (new_disks, new_infos, healing) + } async fn _get_local_disks(&self) -> Vec> { let mut disks = self.get_disks_internal().await; diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index fc7d47fe2..1e4851bf8 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -1,13 +1,20 @@ -use crate::disk::WalkDirOptions; +use crate::cache_value::metacache_set::{list_path_raw, ListPathRawOptions}; +use crate::disk::{DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntry, MetadataResolutionParams, WalkDirOptions}; use crate::error::{Error, Result}; use crate::peer::is_reserved_or_invalid_bucket; +use crate::set_disk::SetDisks; use crate::store::check_list_objs_args; use crate::store_api::{ListObjectsInfo, ObjectInfo}; use crate::utils::path::{base_dir_from_prefix, SLASH_SEPARATOR}; use crate::{store::ECStore, store_api::ListObjectsV2Info}; use futures::future::join_all; -use std::collections::HashSet; +use rand::seq::SliceRandom; +use rand::thread_rng; +use std::collections::{HashMap, HashSet}; use std::io::ErrorKind; +use tokio::sync::broadcast::Receiver; +use tokio::sync::mpsc::Sender; +use tracing::error; const MAX_OBJECT_LIST: i32 = 1000; const MAX_DELETE_LIST: i32 = 1000; @@ -80,6 +87,8 @@ pub struct ListPathOptions { // Versioned is this a ListObjectVersions call. pub versioned: bool, + + pub stop_disk_at_limit: bool, } impl ListPathOptions { @@ -291,14 +300,169 @@ impl ECStore { } } +impl SetDisks { + pub async fn list_path(&self, rx: Receiver, opts: ListPathOptions, sender: Sender) -> Result<()> { + let (mut disks, infos, _) = self.get_online_disks_with_healing_and_info(true).await; + + let mut ask_disks = get_list_quorum(&opts.ask_disks, self.set_drive_count as i32); + if ask_disks == -1 { + let new_disks = get_quorum_disks(&disks, &infos, (disks.len() + 1) / 2); + if !new_disks.is_empty() { + disks = new_disks; + ask_disks = 1; + } else { + ask_disks = get_list_quorum("strict", self.set_drive_count as i32); + } + } + + if self.set_drive_count == 4 || ask_disks > disks.len() as i32 { + ask_disks = disks.len() as i32; + } + + let listing_quorum = ((ask_disks + 1) / 2) as usize; + + let mut fallback_disks = Vec::new(); + + if ask_disks > 0 && disks.len() > ask_disks as usize { + let mut rand = thread_rng(); + disks.shuffle(&mut rand); + + fallback_disks = disks.split_off(ask_disks as usize); + } + + let mut resolver = MetadataResolutionParams { + dir_quorum: listing_quorum, + obj_quorum: listing_quorum, + bucket: opts.bucket.clone(), + ..Default::default() + }; + + if opts.versioned { + resolver.requested_versions = 1; + } + + let limit = { + if opts.limit > 0 && opts.stop_disk_at_limit { + opts.limit + 4 + (opts.limit / 16) + } else { + 0 + } + }; + + let tx1 = sender.clone(); + let tx2 = sender.clone(); + + list_path_raw( + rx, + ListPathRawOptions { + disks: disks.iter().cloned().map(Some).collect(), + fallback_disks: fallback_disks.iter().cloned().map(Some).collect(), + bucket: opts.bucket, + path: opts.base_dir, + recursice: opts.recursive, + filter_prefix: opts.filter_prefix, + forward_to: opts.marker, + min_disks: listing_quorum, + per_disk_limit: limit, + agreed: Some(Box::new(move |entry: MetaCacheEntry| { + Box::pin({ + let value = tx1.clone(); + async move { + if let Err(err) = value.send(entry).await { + error!("list_path send fail {:?}", err); + } + } + }) + })), + partial: Some(Box::new(move |entries: MetaCacheEntries, _: &[Option]| { + Box::pin({ + let value = tx2.clone(); + let resolver = resolver.clone(); + async move { + if let Ok(Some(entry)) = entries.resolve(resolver) { + if let Err(err) = value.send(entry).await { + error!("list_path send fail {:?}", err); + } + } + } + }) + })), + finished: None, + ..Default::default() + }, + ) + .await + } +} + +fn get_list_quorum(quorum: &str, drive_count: i32) -> i32 { + match quorum { + "disk" => 1, + "reduced" => 2, + "optimal" => (drive_count + 1) / 2, + "auto" => -1, + _ => drive_count, // defaults to 'strict' + } +} + +fn get_quorum_disk_infos(disks: &[DiskStore], infos: &[DiskInfo], read_quorum: usize) -> (Vec, Vec) { + let common_mutations = calc_common_counter(infos, read_quorum); + let mut new_disks = Vec::new(); + let mut new_infos = Vec::new(); + + for (i, info) in infos.iter().enumerate() { + let mutations = info.metrics.total_deletes + info.metrics.total_writes; + if mutations >= common_mutations { + new_disks.push(disks[i].clone()); // Assuming StorageAPI derives Clone + new_infos.push(infos[i].clone()); // Assuming DiskInfo derives Clone + } + } + + (new_disks, new_infos) +} + +fn get_quorum_disks(disks: &[DiskStore], infos: &[DiskInfo], read_quorum: usize) -> Vec { + let (new_disks, _) = get_quorum_disk_infos(disks, infos, read_quorum); + new_disks +} + +fn calc_common_counter(infos: &[DiskInfo], read_quorum: usize) -> u64 { + let mut max = 0; + let mut common_count = 0; + let mut signature_map: HashMap = HashMap::new(); + + for info in infos { + if !info.error.is_empty() { + continue; + } + let mutations = info.metrics.total_deletes + info.metrics.total_writes; + *signature_map.entry(mutations).or_insert(0) += 1; + } + + for (&ops, &count) in &signature_map { + if max < count && common_count < ops { + max = count; + common_count = ops; + } + } + + if max < read_quorum { + return 0; + } + common_count +} + // list_path_raw #[cfg(test)] mod test { + use std::sync::Arc; + use crate::cache_value::metacache_set::list_path_raw; use crate::cache_value::metacache_set::ListPathRawOptions; use crate::disk::endpoint::Endpoint; use crate::disk::error::is_err_eof; + use crate::disk::format::FormatV3; use crate::disk::new_disk; use crate::disk::DiskAPI; use crate::disk::DiskOption; @@ -307,8 +471,14 @@ mod test { use crate::disk::WalkDirOptions; use crate::error::Error; use crate::metacache::writer::MetacacheReader; + use crate::set_disk::SetDisks; + use crate::store_list_objects::ListPathOptions; use futures::future::join_all; + use lock::namespace_lock::NsLockMap; use tokio::sync::broadcast; + use tokio::sync::mpsc; + use tokio::sync::RwLock; + use uuid::Uuid; #[tokio::test] async fn test_walk_dir() { @@ -418,4 +588,46 @@ mod test { .await .unwrap(); } + + #[tokio::test] + async fn test_list_path() { + let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); + ep.pool_idx = 0; + ep.set_idx = 0; + ep.disk_idx = 0; + ep.is_local = true; + + let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); + let _ = disk.set_disk_id(Some(Uuid::new_v4())).await; + + let set = SetDisks { + lockers: Vec::new(), + locker_owner: String::new(), + ns_mutex: Arc::new(RwLock::new(NsLockMap::new(false))), + disks: RwLock::new(vec![Some(disk)]), + set_endpoints: Vec::new(), + set_drive_count: 1, + default_parity_count: 0, + set_index: 0, + pool_index: 0, + format: FormatV3::new(1, 1), + }; + + let (_, rx) = broadcast::channel(1); + let bucket = "dada".to_owned(); + + let opts = ListPathOptions { + bucket, + recursive: true, + ..Default::default() + }; + + let (sender, mut recv) = mpsc::channel(10); + + set.list_path(rx, opts, sender).await.unwrap(); + + while let Some(entry) = recv.recv().await { + println!("get entry {:?}", entry.name) + } + } } From 582980fa5dbc67ac963d901ec02dc0b6ba5edfc2 Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 17 Dec 2024 17:45:56 +0800 Subject: [PATCH 59/77] test_list_merge --- ecstore/src/store_list_objects.rs | 175 +++++++++++++++++++----------- 1 file changed, 110 insertions(+), 65 deletions(-) diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 1e4851bf8..244c5a00d 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -8,12 +8,13 @@ use crate::store_api::{ListObjectsInfo, ObjectInfo}; use crate::utils::path::{base_dir_from_prefix, SLASH_SEPARATOR}; use crate::{store::ECStore, store_api::ListObjectsV2Info}; use futures::future::join_all; +use futures::select; use rand::seq::SliceRandom; use rand::thread_rng; use std::collections::{HashMap, HashSet}; use std::io::ErrorKind; -use tokio::sync::broadcast::Receiver; -use tokio::sync::mpsc::Sender; +use tokio::sync::broadcast::Receiver as B_Receiver; +use tokio::sync::mpsc::{self, Receiver, Sender}; use tracing::error; const MAX_OBJECT_LIST: i32 = 1000; @@ -223,85 +224,128 @@ impl ECStore { } // 读所有 - async fn list_merged(&self, opts: &ListPathOptions) -> Result> { - let walk_opts = WalkDirOptions { - bucket: opts.bucket.clone(), - base_dir: opts.base_dir.clone(), - ..Default::default() - }; - - // let (mut wr, mut rd) = tokio::io::duplex(1024); - + async fn list_merged( + &self, + rx: B_Receiver, + opts: ListPathOptions, + sender: Sender, + ) -> Result> { let mut futures = Vec::new(); + let mut inputs = Vec::new(); + for sets in self.pools.iter() { for set in sets.disk_set.iter() { - futures.push(set.walk_dir(&walk_opts)); + let (send, recv) = mpsc::channel(100); + + inputs.push(recv); + let opts = opts.clone(); + + let rx = rx.resubscribe(); + futures.push(set.list_path(rx, opts, send)); } } + let merge_res = merge_entry_channels(rx, inputs, sender.clone(), 1).await; + let results = join_all(futures).await; - // let mut errs = Vec::new(); - let mut ress = Vec::new(); - let mut uniq = HashSet::new(); - - for (disks_ress, _disks_errs) in results { - for disks_res in disks_ress.iter() { - if disks_res.is_none() { - // TODO handle errs - continue; - } - let entrys = disks_res.as_ref().unwrap(); - - for entry in entrys { - // warn!("lst_merged entry---- {}", &entry.name); - - if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { - continue; - } - - if !uniq.contains(&entry.name) { - uniq.insert(entry.name.clone()); - // TODO: 过滤 - - if opts.limit > 0 && ress.len() as i32 >= opts.limit { - return Ok(ress); - } - - if entry.is_object() { - // if !opts.delimiter.is_empty() { - // // entry.name.trim_start_matches(pat) - // } - - let fi = entry.to_fileinfo(&opts.bucket)?; - if let Some(f) = fi { - ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); - } - continue; - } - - if entry.is_dir() { - ress.push(ObjectInfo { - is_dir: true, - bucket: opts.bucket.clone(), - name: entry.name.clone(), - ..Default::default() - }); - } - } - } + let mut errs = Vec::new(); + for result in results { + if let Err(err) = result { + errs.push(Some(err)); + } else { + errs.push(None); } } - // warn!("list_merged errs {:?}", errs); + unimplemented!() - Ok(ress) + // // let mut errs = Vec::new(); + // let mut ress = Vec::new(); + // let mut uniq = HashSet::new(); + + // for (disks_ress, _disks_errs) in results { + // for disks_res in disks_ress.iter() { + // if disks_res.is_none() { + // // TODO handle errs + // continue; + // } + // let entrys = disks_res.as_ref().unwrap(); + + // for entry in entrys { + // // warn!("lst_merged entry---- {}", &entry.name); + + // if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { + // continue; + // } + + // if !uniq.contains(&entry.name) { + // uniq.insert(entry.name.clone()); + // // TODO: 过滤 + + // if opts.limit > 0 && ress.len() as i32 >= opts.limit { + // return Ok(ress); + // } + + // if entry.is_object() { + // // if !opts.delimiter.is_empty() { + // // // entry.name.trim_start_matches(pat) + // // } + + // let fi = entry.to_fileinfo(&opts.bucket)?; + // if let Some(f) = fi { + // ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); + // } + // continue; + // } + + // if entry.is_dir() { + // ress.push(ObjectInfo { + // is_dir: true, + // bucket: opts.bucket.clone(), + // name: entry.name.clone(), + // ..Default::default() + // }); + // } + // } + // } + // } + // } + + // // warn!("list_merged errs {:?}", errs); + + // Ok(ress) } } +async fn merge_entry_channels( + rx: B_Receiver, + ins: Vec>, + out: Sender, + read_quorum: usize, +) -> Result<()> { + // let mut rx = rx; + // let mut ins = ins; + // if ins.len() == 1 { + // let rev = ins[0].recv(); + // loop { + // tokio::select! { + // _=rx.recv()=>break, + // Some(entry) = rev =>{ + + // println!("recv entry {}", &entry.name); + // } + + // } + // } + // } + + unimplemented!() +} + impl SetDisks { - pub async fn list_path(&self, rx: Receiver, opts: ListPathOptions, sender: Sender) -> Result<()> { + pub async fn list_path(&self, rx: B_Receiver, opts: ListPathOptions, sender: Sender) -> Result<()> { let (mut disks, infos, _) = self.get_online_disks_with_healing_and_info(true).await; let mut ask_disks = get_list_quorum(&opts.ask_disks, self.set_drive_count as i32); @@ -613,7 +657,8 @@ mod test { format: FormatV3::new(1, 1), }; - let (_, rx) = broadcast::channel(1); + let (_tx, rx) = broadcast::channel(1); + let bucket = "dada".to_owned(); let opts = ListPathOptions { From 03b84cb0f14f1299aa57e041a93b46997e717b9d Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 18 Dec 2024 16:57:24 +0800 Subject: [PATCH 60/77] need test merge_entry_channels --- ecstore/src/disk/mod.rs | 21 ++++ ecstore/src/store_list_objects.rs | 190 +++++++++++++++++++++++++++--- 2 files changed, 193 insertions(+), 18 deletions(-) diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index b1cc35d9b..b982f2ec2 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -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 { + 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)] diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 244c5a00d..187d05d97 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -1,13 +1,14 @@ use crate::cache_value::metacache_set::{list_path_raw, ListPathRawOptions}; use crate::disk::{DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntry, MetadataResolutionParams, WalkDirOptions}; use crate::error::{Error, Result}; +use crate::file_meta::merge_file_meta_versions; use crate::peer::is_reserved_or_invalid_bucket; use crate::set_disk::SetDisks; use crate::store::check_list_objs_args; use crate::store_api::{ListObjectsInfo, ObjectInfo}; -use crate::utils::path::{base_dir_from_prefix, SLASH_SEPARATOR}; +use crate::utils::path::{self, base_dir_from_prefix, SLASH_SEPARATOR}; use crate::{store::ECStore, store_api::ListObjectsV2Info}; -use futures::future::join_all; +use futures::future::{join_all, ok}; use futures::select; use rand::seq::SliceRandom; use rand::thread_rng; @@ -319,29 +320,182 @@ impl ECStore { } } +async fn select_from( + in_channels: &mut [Receiver], + idx: usize, + top: &mut [Option], + n_done: &mut usize, +) -> Result<()> { + match in_channels[idx].recv().await { + Some(entry) => { + top[idx] = Some(entry); + } + None => { + top[idx] = None; + *n_done += 1; + } + } + Ok(()) +} + +// TODO: exit when cancel async fn merge_entry_channels( rx: B_Receiver, - ins: Vec>, - out: Sender, + in_channels: Vec>, + out_channel: Sender, read_quorum: usize, ) -> Result<()> { - // let mut rx = rx; - // let mut ins = ins; - // if ins.len() == 1 { - // let rev = ins[0].recv(); - // loop { - // tokio::select! { - // _=rx.recv()=>break, - // Some(entry) = rev =>{ + let mut rx = rx; + let mut in_channels = in_channels; + if in_channels.len() == 1 { + loop { + tokio::select! { + has_entry = in_channels[0].recv()=>{ + if let Some(entry) = has_entry{ + out_channel.send(entry).await?; + } else { + return Ok(()) + } + }, + _ = rx.recv()=>return Err(Error::msg("cancel")), + } + } + } - // println!("recv entry {}", &entry.name); - // } + let mut top: Vec> = vec![None; in_channels.len()]; + let mut n_done = 0; - // } - // } - // } + let in_channels_len = in_channels.len(); - unimplemented!() + for idx in 0..in_channels_len { + select_from(&mut in_channels, idx, &mut top, &mut n_done).await?; + } + + let mut last = String::new(); + let mut to_merge: Vec = Vec::new(); + loop { + if n_done == in_channels.len() { + return Ok(()); + } + + let mut best: Option = None; + let mut best_idx = 0; + to_merge.clear(); + + // FIXME: top move when select_from call + let vtop = top.clone(); + + for (i, other) in vtop.iter().enumerate() { + if let Some(other_entry) = other { + if let Some(best_entry) = &best { + let other_idx = i; + + if path::clean(&best_entry.name) == path::clean(&other_entry.name) { + let dir_matches = best_entry.is_dir() && other_entry.is_dir(); + let suffix_matche = + best_entry.name.ends_with(SLASH_SEPARATOR) == other_entry.name.ends_with(SLASH_SEPARATOR); + + if dir_matches && suffix_matche { + to_merge.push(other_idx); + continue; + } + + if !dir_matches { + // dir and object has the save name + if other_entry.is_dir() { + // TODO: read next entry to top + select_from(&mut in_channels, other_idx, &mut top, &mut n_done).await?; + continue; + } + + to_merge.clear(); + + best = Some(other_entry.clone()); + best_idx = other_idx; + continue; + } + } else if best_entry.name > other_entry.name { + to_merge.clear(); + best = Some(other_entry.clone()); + best_idx = i; + } + } else { + best = Some(other_entry.clone()); + best_idx = i; + } + } + } + + // TODO: + if !to_merge.is_empty() { + if let Some(entry) = &best { + let mut versions = Vec::with_capacity(to_merge.len() + 1); + + let mut has_xl = { + if let Ok(meta) = entry.clone().xl_meta() { + Some(meta) + } else { + None + } + }; + + if let Some(x) = &has_xl { + versions.push(x.versions.clone()); + } + + for &idx in to_merge.iter() { + let has_entry = { top.get(idx).cloned() }; + + if let Some(Some(entry)) = has_entry { + let xl2 = match entry.clone().xl_meta() { + Ok(res) => res, + Err(_) => { + select_from(&mut in_channels, idx, &mut top, &mut n_done).await?; + + continue; + } + }; + + versions.push(xl2.versions.clone()); + + if has_xl.is_none() { + select_from(&mut in_channels, best_idx, &mut top, &mut n_done).await?; + + best_idx = idx; + best = Some(entry.clone()); + has_xl = Some(xl2); + } else { + select_from(&mut in_channels, best_idx, &mut top, &mut n_done).await?; + } + } + } + + if let Some(xl) = has_xl.as_mut() { + if !versions.is_empty() { + xl.versions = merge_file_meta_versions(read_quorum, true, 0, &versions); + + if let Ok(meta) = xl.marshal_msg() { + if let Some(b) = best.as_mut() { + b.metadata = meta; + b.cached = Some(xl.clone()); + } + } + } + } + } + + to_merge.clear(); + } + + if let Some(best_entry) = &best { + if best_entry.name > last { + out_channel.send(best_entry.clone()).await?; + last = best_entry.name.clone(); + } + top[best_idx] = None; // Replace entry we just sent + select_from(&mut in_channels, best_idx, &mut top, &mut n_done).await?; + } + } } impl SetDisks { From 13302c358661944f6b86ddfdc18a5f05af8b8cbc Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 22 Dec 2024 04:57:15 +0800 Subject: [PATCH 61/77] list_object v2 use channel, todo other params --- ecstore/src/disk/error.rs | 4 + ecstore/src/disk/local.rs | 11 +- ecstore/src/disk/mod.rs | 88 +++++++++- ecstore/src/metacache/writer.rs | 1 + ecstore/src/set_disk.rs | 21 ++- ecstore/src/sets.rs | 2 +- ecstore/src/store.rs | 8 +- ecstore/src/store_api.rs | 2 +- ecstore/src/store_list_objects.rs | 281 ++++++++++++++++++++++++++++-- iam/src/store/object.rs | 29 +-- rustfs/src/storage/ecfs.rs | 12 +- 11 files changed, 408 insertions(+), 51 deletions(-) diff --git a/ecstore/src/disk/error.rs b/ecstore/src/disk/error.rs index 244c5928f..d6c9372ab 100644 --- a/ecstore/src/disk/error.rs +++ b/ecstore/src/disk/error.rs @@ -452,6 +452,10 @@ pub fn is_all_not_found(errs: &[Option]) -> bool { !errs.is_empty() } +pub fn is_all_volume_not_found(errs: &[Option]) -> bool { + DiskError::VolumeNotFound.count_errs(errs) == errs.len() +} + pub fn is_all_buckets_not_found(errs: &[Option]) -> bool { if errs.is_empty() { return false; diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 131630b3f..6caa58068 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -439,7 +439,11 @@ impl LocalDisk { } } - Err(err) + if let Some(os_err) = err.downcast_ref::() { + Err(os_err_to_file_err(std::io::Error::new(os_err.kind(), os_err.to_string()))) + } else { + Err(err) + } } } } @@ -531,7 +535,7 @@ impl LocalDisk { return Err(Error::new(DiskError::UnsupportedDisk)); } - return Err(Error::new(e)); + return Err(os_err_to_file_err(e)); } }; @@ -848,7 +852,7 @@ impl LocalDisk { continue; } - let name = path::path_join_buf(&[current, &entry]); + let name = path::path_join_buf(&[current, entry]); if !dir_stack.is_empty() { if let Some(pop) = dir_stack.pop() { @@ -1514,6 +1518,7 @@ impl DiskAPI for LocalDisk { return Err(e); } }; + Ok(entries) } diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index b982f2ec2..e351169a7 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -15,6 +15,10 @@ pub const STORAGE_FORMAT_FILE: &str = "xl.meta"; pub const STORAGE_FORMAT_FILE_BACKUP: &str = "xl.meta.bkp"; use crate::{ + bucket::{ + metadata_sys::get_versioning_config, + versioning::{self, VersioningApi}, + }, erasure::Writer, error::{Error, Result}, file_meta::{merge_file_meta_versions, FileMeta, FileMetaShallowVersion}, @@ -24,7 +28,7 @@ use crate::{ heal_commands::{HealScanMode, HealingTracker}, }, io, - store_api::{FileInfo, RawFileInfo}, + store_api::{FileInfo, ObjectInfo, RawFileInfo}, }; use endpoint::Endpoint; use error::DiskError; @@ -41,6 +45,7 @@ use std::{ cmp::Ordering, fmt::Debug, io::{Cursor, SeekFrom}, + ops::Index, path::PathBuf, sync::Arc, }; @@ -795,6 +800,10 @@ impl MetaCacheEntry { pub struct MetaCacheEntries(pub Vec>); impl MetaCacheEntries { + #[allow(clippy::should_implement_trait)] + pub fn as_ref(&self) -> &[Option] { + &self.0 + } pub fn resolve(&self, mut params: MetadataResolutionParams) -> Result> { if self.0.is_empty() { return Ok(None); @@ -885,6 +894,83 @@ impl MetaCacheEntries { } } +#[derive(Debug)] +pub struct MetaCacheEntriesSorted { + pub o: MetaCacheEntries, + // pub list_id: String, + // pub reuse: bool, + // pub lastSkippedEntry: String, +} + +impl MetaCacheEntriesSorted { + pub fn entries(&self) -> Vec { + let entries: Vec = self.o.0.iter().flatten().cloned().collect(); + entries + } + pub async fn file_infos(&self, bucket: &str, prefix: &str, delimiter: &str) -> Vec { + let vcfg = get_versioning_config(bucket).await.ok(); + let mut objects = Vec::with_capacity(self.o.as_ref().len()); + let mut prev_prefix = ""; + for entry in self.o.as_ref().iter().flatten() { + if entry.is_object() { + if !delimiter.is_empty() { + if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { + let idx = prefix.len() + idx + delimiter.len(); + if let Some(curr_prefix) = entry.name.get(0..idx) { + if curr_prefix == prev_prefix { + continue; + } + + prev_prefix = curr_prefix.clone(); + + objects.push(ObjectInfo { + is_dir: true, + bucket: bucket.to_owned(), + name: curr_prefix.to_owned(), + ..Default::default() + }); + } + continue; + } + } + + if let Ok(Some(fi)) = entry.to_fileinfo(bucket) { + // TODO:VersionPurgeStatus + let versioned = vcfg.clone().map(|v| v.0.versioned(&entry.name)).unwrap_or_default(); + objects.push(fi.to_object_info(bucket, &entry.name, versioned)); + } + continue; + } + + if entry.is_dir() { + if delimiter.is_empty() { + continue; + } + + if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { + let idx = prefix.len() + idx + delimiter.len(); + if let Some(curr_prefix) = entry.name.get(0..idx) { + if curr_prefix == prev_prefix { + continue; + } + + prev_prefix = curr_prefix.clone(); + + objects.push(ObjectInfo { + is_dir: true, + bucket: bucket.to_owned(), + name: curr_prefix.to_owned(), + ..Default::default() + }); + } + } + } + } + + objects + } +} + #[derive(Clone, Debug, Default)] pub struct DiskOption { pub cleanup: bool, diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index c1bc1d98f..95bedc7d0 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -7,6 +7,7 @@ use tokio::io::AsyncRead; use tokio::io::AsyncReadExt; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; +use tracing::warn; // use std::sync::Arc; // use tokio::sync::mpsc; // use tokio::sync::mpsc::Sender; diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 2bf2d6093..76ab932d8 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -164,12 +164,13 @@ impl SetDisks { let mut infos = Vec::with_capacity(disks.len()); let mut futures = Vec::with_capacity(disks.len()); - - let mut rng = thread_rng(); - disks.shuffle(&mut rng); - let mut numbers: Vec = (0..disks.len()).collect(); - numbers.shuffle(&mut rand::thread_rng()); + { + let mut rng = thread_rng(); + disks.shuffle(&mut rng); + + numbers.shuffle(&mut rand::thread_rng()); + } for &i in numbers.iter() { let disk = disks[i].clone(); @@ -818,6 +819,7 @@ impl SetDisks { }; if let Some(err) = reduce_read_quorum_errs(errs, object_op_ignored_errs().as_ref(), expected_rquorum) { + // warn!("object_quorum_from_meta err {:?}", &err); return Err(err); } @@ -1687,11 +1689,12 @@ impl SetDisks { // TODO: 优化并发 可用数量中断 let (parts_metadata, errs) = Self::read_all_fileinfo(&disks, "", bucket, object, vid.as_str(), read_data, false).await; // warn!("get_object_fileinfo parts_metadata {:?}", &parts_metadata); - warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); + // warn!("get_object_fileinfo {}/{} errs {:?}", bucket, object, &errs); let _min_disks = self.set_drive_count - self.default_parity_count; - let (read_quorum, _) = Self::object_quorum_from_meta(&parts_metadata, &errs, self.default_parity_count)?; + let (read_quorum, _) = Self::object_quorum_from_meta(&parts_metadata, &errs, self.default_parity_count) + .map_err(|err| to_object_err(err, vec![bucket, object]))?; if let Some(err) = reduce_read_quorum_errs(&errs, object_op_ignored_errs().as_ref(), read_quorum as usize) { error!( @@ -1700,7 +1703,7 @@ impl SetDisks { read_quorum, &errs ); - return Err(err); + return Err(to_object_err(err, vec![bucket, object])); } let (op_online_disks, mot_time, etag) = Self::list_online_disks(&disks, &parts_metadata, &errs, read_quorum as usize); @@ -3832,7 +3835,7 @@ impl StorageAPI for SetDisks { } async fn list_objects_v2( - &self, + self: Arc, _bucket: &str, _prefix: &str, _continuation_token: &str, diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index 594e88f58..ae095d2cc 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -451,7 +451,7 @@ impl StorageAPI for Sets { self.get_disks_by_key(object).delete_object(bucket, object, opts).await } async fn list_objects_v2( - &self, + self: Arc, _bucket: &str, _prefix: &str, _continuation_token: &str, diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index cfaedd03e..1b41b247d 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -1512,7 +1512,7 @@ impl StorageAPI for ECStore { // TODO: review async fn list_objects_v2( - &self, + self: Arc, bucket: &str, prefix: &str, continuation_token: &str, @@ -2170,9 +2170,11 @@ async fn init_local_peer(endpoint_pools: &EndpointServerPools, host: &String, po *GLOBAL_Local_Node_Name.write().await = peer_set[0].clone(); } -pub fn is_valid_object_prefix(object: &str) -> bool { +pub fn is_valid_object_prefix(_object: &str) -> bool { // Implement object prefix validation - !object.is_empty() // Placeholder + // !object.is_empty() // Placeholder + // FIXME: TODO: + true } fn is_valid_object_name(object: &str) -> bool { diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index fc37c3ccc..7dbd881ab 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -843,7 +843,7 @@ pub trait StorageAPI: ObjectIO { async fn delete_bucket(&self, bucket: &str, opts: &DeleteBucketOptions) -> Result<()>; // ListObjects TODO: FIXME: async fn list_objects_v2( - &self, + self: Arc, bucket: &str, prefix: &str, continuation_token: &str, diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 187d05d97..ff3b7033e 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -1,5 +1,8 @@ use crate::cache_value::metacache_set::{list_path_raw, ListPathRawOptions}; -use crate::disk::{DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntry, MetadataResolutionParams, WalkDirOptions}; +use crate::disk::error::{is_all_not_found, is_all_volume_not_found, is_err_eof, DiskError}; +use crate::disk::{ + DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntriesSorted, MetaCacheEntry, MetadataResolutionParams, WalkDirOptions, +}; use crate::error::{Error, Result}; use crate::file_meta::merge_file_meta_versions; use crate::peer::is_reserved_or_invalid_bucket; @@ -14,9 +17,10 @@ use rand::seq::SliceRandom; use rand::thread_rng; use std::collections::{HashMap, HashSet}; use std::io::ErrorKind; -use tokio::sync::broadcast::Receiver as B_Receiver; +use std::sync::Arc; +use tokio::sync::broadcast::{self, Receiver as B_Receiver}; use tokio::sync::mpsc::{self, Receiver, Sender}; -use tracing::error; +use tracing::{error, warn}; const MAX_OBJECT_LIST: i32 = 1000; const MAX_DELETE_LIST: i32 = 1000; @@ -114,7 +118,7 @@ impl ListPathOptions { impl ECStore { #[allow(clippy::too_many_arguments)] pub async fn inner_list_objects_v2( - &self, + self: Arc, bucket: &str, prefix: &str, continuation_token: &str, @@ -131,13 +135,18 @@ impl ECStore { } }; - self.list_objects_generic(bucket, prefix, marker, delimiter, max_keys).await?; - // FIXME:TODO: - unimplemented!() + let loi = self.list_objects_generic(bucket, prefix, marker, delimiter, max_keys).await?; + Ok(ListObjectsV2Info { + is_truncated: loi.is_truncated, + continuation_token: continuation_token.to_owned(), + next_continuation_token: loi.next_marker, + objects: loi.objects, + prefixes: loi.prefixes, + }) } pub async fn list_objects_generic( - &self, + self: Arc, bucket: &str, prefix: &str, marker: &str, @@ -155,14 +164,73 @@ impl ECStore { ..Default::default() }; - let merged = self.list_path(&opts).await?; + let mut err_eof = false; + let has_merged = match self.list_path(&opts).await { + Ok(res) => Some(res), + Err(err) => { + if !is_err_eof(&err) { + return Err(err); + } - // FIXME:TODO: + err_eof = true; + None + } + }; - todo!() + let mut get_objects = if let Some(merged) = has_merged { + merged.file_infos(bucket, prefix, delimiter).await + } else { + Vec::new() + }; + + let is_truncated = { + if max_keys > 0 && get_objects.len() > max_keys as usize { + get_objects.truncate(max_keys as usize); + true + } else { + !err_eof && get_objects.len() > 0 + } + }; + + let mut prefixes: Vec = Vec::new(); + + let mut objects = Vec::with_capacity(get_objects.len()); + for obj in get_objects.into_iter() { + if obj.is_dir && obj.mod_time.is_none() && !delimiter.is_empty() { + let mut found = false; + if delimiter != SLASH_SEPARATOR { + for p in prefixes.iter() { + if found { + break; + } + found = p == &obj.name; + } + } + if !found { + prefixes.push(obj.name.clone()); + } + } else { + objects.push(obj); + } + } + + let next_marker = { + if is_truncated { + objects.last().map(|last| last.name.clone()) + } else { + None + } + }; + + Ok(ListObjectsInfo { + is_truncated, + next_marker: next_marker.unwrap_or_default(), + objects, + prefixes, + }) } - pub async fn list_path(&self, o: &ListPathOptions) -> Result { + pub async fn list_path(self: Arc, o: &ListPathOptions) -> Result { check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?; // if opts.prefix.ends_with(SLASH_SEPARATOR) { // return Err(Error::msg("eof")); @@ -181,7 +249,7 @@ impl ECStore { return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); } - if o.prefix.ends_with(SLASH_SEPARATOR) { + if o.prefix.starts_with(SLASH_SEPARATOR) { return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); } @@ -207,7 +275,29 @@ impl ECStore { } // FIXME:TODO: - todo!() + let (tx, rx) = broadcast::channel(1); + + let (sender, mut recv) = mpsc::channel(o.limit as usize); + + let store = self.clone(); + let opts = o.clone(); + let rx1 = rx.resubscribe(); + tokio::spawn(async move { + if let Err(err) = store.list_merged(rx1, opts, sender).await { + error!("list_merged err {:?}", err); + } + }); + + let rx2 = rx.resubscribe(); + let res = gather_results(rx2, &o, &mut recv).await?; + + tx.send(true)?; + + // TODO: recv list_merged err + + Ok(MetaCacheEntriesSorted { + o: MetaCacheEntries(res.into_iter().map(Some).collect()), + }) // let mut opts = opts.clone(); @@ -247,20 +337,57 @@ impl ECStore { } } - let merge_res = merge_entry_channels(rx, inputs, sender.clone(), 1).await; + tokio::spawn(async move { + if let Err(err) = merge_entry_channels(rx, inputs, sender.clone(), 1).await { + println!("merge_entry_channels err {:?}", err) + } + }); + + // let merge_res = merge_entry_channels(rx, inputs, sender.clone(), 1).await; let results = join_all(futures).await; + let mut all_at_eof = true; + let mut errs = Vec::new(); for result in results { if let Err(err) = result { + all_at_eof = false; errs.push(Some(err)); } else { errs.push(None); } } - unimplemented!() + if is_all_not_found(&errs) { + if is_all_volume_not_found(&errs) { + return Err(Error::new(DiskError::VolumeNotFound)); + } + + return Ok(Vec::new()); + } + + // merge_res?; + + // TODO check cancel + + for err in errs.iter() { + if let Some(err) = err { + if is_err_eof(err) { + continue; + } + + return Err(err.clone()); + } else { + all_at_eof = false; + continue; + } + } + + // check all_at_eof + _ = all_at_eof; + + Ok(Vec::new()) // // let mut errs = Vec::new(); // let mut ress = Vec::new(); @@ -320,6 +447,42 @@ impl ECStore { } } +// TODO: FIXME: 异步 +async fn gather_results( + _rx: B_Receiver, + opts: &ListPathOptions, + recv: &mut Receiver, +) -> Result> { + let mut returned = false; + let mut results = Vec::new(); + while let Some(entry) = recv.recv().await { + if returned { + continue; + } + + // TODO: rx.recv() + + // TODO: isLatestDeletemarker + if !opts.include_directories && (entry.is_dir() || (!opts.versioned && entry.is_object())) { + continue; + } + + if !opts.marker.is_empty() && entry.name < opts.marker { + continue; + } + + // TODO: other + if opts.limit > 0 && results.len() >= opts.limit as usize { + returned = true; + continue; + } + + results.push(entry); + } + + Ok(results) +} + async fn select_from( in_channels: &mut [Receiver], idx: usize, @@ -390,6 +553,8 @@ async fn merge_entry_channels( if let Some(best_entry) = &best { let other_idx = i; + // println!("get other_entry {:?}", other_entry.name); + if path::clean(&best_entry.name) == path::clean(&other_entry.name) { let dir_matches = best_entry.is_dir() && other_entry.is_dir(); let suffix_matche = @@ -426,6 +591,8 @@ async fn merge_entry_channels( } } + // println!("get best_entry {} {:?}", &best_idx, &best.clone().unwrap_or_default().name); + // TODO: if !to_merge.is_empty() { if let Some(entry) = &best { @@ -667,10 +834,13 @@ mod test { use crate::disk::MetaCacheEntries; use crate::disk::MetaCacheEntry; use crate::disk::WalkDirOptions; + use crate::endpoints::EndpointServerPools; use crate::error::Error; use crate::metacache::writer::MetacacheReader; use crate::set_disk::SetDisks; + use crate::store::ECStore; use crate::store_list_objects::ListPathOptions; + use crate::StorageAPI; use futures::future::join_all; use lock::namespace_lock::NsLockMap; use tokio::sync::broadcast; @@ -788,7 +958,7 @@ mod test { } #[tokio::test] - async fn test_list_path() { + async fn test_set_list_path() { let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); ep.pool_idx = 0; ep.set_idx = 0; @@ -829,4 +999,81 @@ mod test { println!("get entry {:?}", entry.name) } } + + #[tokio::test] + async fn test_list_merged() { + let server_address = "localhost:9000"; + + let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( + server_address, + vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], + ) + .unwrap(); + + let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) + .await + .unwrap(); + + let (_tx, rx) = broadcast::channel(1); + + let bucket = "dada".to_owned(); + let opts = ListPathOptions { + bucket, + recursive: true, + ..Default::default() + }; + + let (sender, mut recv) = mpsc::channel(10); + + store.list_merged(rx, opts, sender).await.unwrap(); + + while let Some(entry) = recv.recv().await { + println!("get entry {:?}", entry.name) + } + } + + #[tokio::test] + async fn test_list_path() { + let server_address = "localhost:9000"; + + let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( + server_address, + vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], + ) + .unwrap(); + + let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) + .await + .unwrap(); + + let bucket = "dada".to_owned(); + let opts = ListPathOptions { + bucket, + recursive: true, + limit: 100, + + ..Default::default() + }; + + let ret = store.list_path(&opts).await.unwrap(); + println!("ret {:?}", ret); + } + + // #[tokio::test] + // async fn test_list_objects_v2() { + // let server_address = "localhost:9000"; + + // let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( + // server_address, + // vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], + // ) + // .unwrap(); + + // let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) + // .await + // .unwrap(); + + // let ret = store.list_objects_v2("data", "", "", "", 100, false, "").await.unwrap(); + // println!("ret {:?}", ret); + // } } diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index 230259668..c2b886141 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -6,6 +6,7 @@ use ecstore::{ store_api::{HTTPRangeSpec, ObjectIO, ObjectInfo, ObjectOptions, PutObjReader}, store_list_objects::ListPathOptions, utils::path::dir, + StorageAPI, }; use futures::future::try_join_all; use log::{debug, warn}; @@ -41,29 +42,31 @@ impl ObjectStore { for item in items { let prefix = format!("{}{}", prefix, item); futures.push(async move { + // let items = self + // .object_api + // .clone() + // .list_path(&ListPathOptions { + // bucket: Self::BUCKET_NAME.into(), + // prefix: prefix.clone(), + // ..Default::default() + // }) + // .await; + let items = self .object_api - .list_path(&ListPathOptions { - bucket: Self::BUCKET_NAME.into(), - prefix: prefix.clone(), - ..Default::default() - }) + .clone() + .list_objects_v2(Self::BUCKET_NAME.into(), &prefix.clone(), "", "", 0, false, "") .await; match items { - Ok(items) => Result::<_, crate::Error>::Ok(items.objects), + Ok(items) => Result::<_, crate::Error>::Ok(items.prefixes), Err(e) if is_not_found(&e) => Result::<_, crate::Error>::Ok(vec![]), Err(e) => Err(Error::StringError(format!("list {prefix} failed, err: {e:?}"))), } }); } - - Ok(try_join_all(futures) - .await? - .into_iter() - .flat_map(|x| x.into_iter()) - .map(|x| x.name) - .collect()) + // TODO: FIXME: + Ok(try_join_all(futures).await?.into_iter().flat_map(|x| x.into_iter()).collect()) } async fn load_policy(&self, name: &str) -> crate::Result { diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index b3a40ac87..2f808ef9a 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -460,8 +460,6 @@ impl S3 for FS { #[tracing::instrument(level = "debug", skip(self, req))] async fn list_objects_v2(&self, req: S3Request) -> S3Result> { - // warn!("list_objects_v2 input {:?}", &req.input); - let ListObjectsV2Input { bucket, continuation_token, @@ -475,6 +473,7 @@ impl S3 for FS { let prefix = prefix.unwrap_or_default(); let delimiter = delimiter.unwrap_or_default(); + let max_keys = max_keys.unwrap_or(1000); let Some(store) = new_object_layer_fn() else { return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string())); @@ -486,7 +485,7 @@ impl S3 for FS { &prefix, &continuation_token.unwrap_or_default(), &delimiter, - max_keys.unwrap_or_default(), + max_keys, fetch_owner.unwrap_or_default(), &start_after.unwrap_or_default(), ) @@ -519,6 +518,12 @@ impl S3 for FS { let key_count = objects.len() as i32; + let common_prefixes = object_infos + .prefixes + .into_iter() + .map(|v| CommonPrefix { prefix: Some(v) }) + .collect(); + let output = ListObjectsV2Output { key_count: Some(key_count), max_keys: Some(key_count), @@ -526,6 +531,7 @@ impl S3 for FS { delimiter: Some(delimiter), name: Some(bucket), prefix: Some(prefix), + common_prefixes: Some(common_prefixes), ..Default::default() }; From 34448c9e897e35237deee11b470b423428334eab Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 22 Dec 2024 05:04:48 +0800 Subject: [PATCH 62/77] clippy --- ecstore/src/disk/local.rs | 17 +------ ecstore/src/disk/mod.rs | 11 ++--- ecstore/src/disk/remote.rs | 3 +- ecstore/src/metacache/writer.rs | 1 - ecstore/src/store_list_objects.rs | 76 ++++--------------------------- 5 files changed, 15 insertions(+), 93 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 6caa58068..3cb6ec017 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -6,8 +6,7 @@ use super::{endpoint::Endpoint, error::DiskError, format::FormatV3}; use super::{ os, CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskMetrics, FileInfoVersions, FileReader, FileWriter, Info, MetaCacheEntry, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, - UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, FORMAT_CONFIG_FILE, RUSTFS_META_BUCKET, - STORAGE_FORMAT_FILE_BACKUP, + UpdateMetadataOpts, VolumeInfo, WalkDirOptions, BUCKET_META_PREFIX, RUSTFS_META_BUCKET, STORAGE_FORMAT_FILE_BACKUP, }; use crate::bitrot::bitrot_verify; use crate::bucket::metadata_sys::{self}; @@ -27,7 +26,6 @@ use crate::heal::data_usage_cache::{DataUsageCache, DataUsageEntry}; use crate::heal::error::{ERR_IGNORE_FILE_CONTRIB, ERR_SKIP_FILE}; use crate::heal::heal_commands::{HealScanMode, HealingTracker}; use crate::heal::heal_ops::HEALING_TRACKER_FILENAME; -use crate::io::AsyncToSync; use crate::metacache::writer::MetacacheWriter; use crate::new_object_layer_fn; use crate::set_disk::{ @@ -51,7 +49,7 @@ use nix::NixPath; use path_absolutize::Absolutize; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; -use std::io::{Cursor, Write}; +use std::io::Cursor; use std::os::unix::fs::MetadataExt; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; @@ -839,7 +837,6 @@ impl LocalDisk { } } - let prefix = ""; let mut dir_stack: Vec = Vec::with_capacity(5); for entry in entries.iter() { @@ -2342,16 +2339,6 @@ async fn get_disk_info(drive_path: PathBuf) -> Result<(Info, bool)> { #[cfg(test)] mod test { - use futures::future::join_all; - use tokio::io::BufWriter; - use utils::fs::open_file; - use utils::fs::O_RDWR; - use utils::fs::O_TRUNC; - - use crate::io::VecAsyncReader; - use crate::io::VecAsyncWriter; - use crate::metacache::writer::MetacacheReader; - use super::*; #[tokio::test] diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index e351169a7..9a961c112 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -15,10 +15,7 @@ pub const STORAGE_FORMAT_FILE: &str = "xl.meta"; pub const STORAGE_FORMAT_FILE_BACKUP: &str = "xl.meta.bkp"; use crate::{ - bucket::{ - metadata_sys::get_versioning_config, - versioning::{self, VersioningApi}, - }, + bucket::{metadata_sys::get_versioning_config, versioning::VersioningApi}, erasure::Writer, error::{Error, Result}, file_meta::{merge_file_meta_versions, FileMeta, FileMetaShallowVersion}, @@ -27,7 +24,6 @@ use crate::{ data_usage_cache::{DataUsageCache, DataUsageEntry}, heal_commands::{HealScanMode, HealingTracker}, }, - io, store_api::{FileInfo, ObjectInfo, RawFileInfo}, }; use endpoint::Endpoint; @@ -45,7 +41,6 @@ use std::{ cmp::Ordering, fmt::Debug, io::{Cursor, SeekFrom}, - ops::Index, path::PathBuf, sync::Arc, }; @@ -921,7 +916,7 @@ impl MetaCacheEntriesSorted { continue; } - prev_prefix = curr_prefix.clone(); + prev_prefix = curr_prefix; objects.push(ObjectInfo { is_dir: true, @@ -954,7 +949,7 @@ impl MetaCacheEntriesSorted { continue; } - prev_prefix = curr_prefix.clone(); + prev_prefix = curr_prefix; objects.push(ObjectInfo { is_dir: true, diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index a68d6d827..7a405a235 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -350,7 +350,8 @@ impl DiskAPI for RemoteDisk { Ok(response.volumes) } - async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result> { + // FIXME: TODO: use writer + async fn walk_dir(&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) diff --git a/ecstore/src/metacache/writer.rs b/ecstore/src/metacache/writer.rs index 95bedc7d0..c1bc1d98f 100644 --- a/ecstore/src/metacache/writer.rs +++ b/ecstore/src/metacache/writer.rs @@ -7,7 +7,6 @@ use tokio::io::AsyncRead; use tokio::io::AsyncReadExt; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; -use tracing::warn; // use std::sync::Arc; // use tokio::sync::mpsc; // use tokio::sync::mpsc::Sender; diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index ff3b7033e..2102eefdf 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -1,8 +1,6 @@ use crate::cache_value::metacache_set::{list_path_raw, ListPathRawOptions}; use crate::disk::error::{is_all_not_found, is_all_volume_not_found, is_err_eof, DiskError}; -use crate::disk::{ - DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntriesSorted, MetaCacheEntry, MetadataResolutionParams, WalkDirOptions, -}; +use crate::disk::{DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntriesSorted, MetaCacheEntry, MetadataResolutionParams}; use crate::error::{Error, Result}; use crate::file_meta::merge_file_meta_versions; use crate::peer::is_reserved_or_invalid_bucket; @@ -11,21 +9,20 @@ use crate::store::check_list_objs_args; use crate::store_api::{ListObjectsInfo, ObjectInfo}; use crate::utils::path::{self, base_dir_from_prefix, SLASH_SEPARATOR}; use crate::{store::ECStore, store_api::ListObjectsV2Info}; -use futures::future::{join_all, ok}; -use futures::select; +use futures::future::join_all; use rand::seq::SliceRandom; use rand::thread_rng; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use std::io::ErrorKind; use std::sync::Arc; use tokio::sync::broadcast::{self, Receiver as B_Receiver}; use tokio::sync::mpsc::{self, Receiver, Sender}; -use tracing::{error, warn}; +use tracing::error; const MAX_OBJECT_LIST: i32 = 1000; -const MAX_DELETE_LIST: i32 = 1000; -const MAX_UPLOADS_LIST: i32 = 10000; -const MAX_PARTS_LIST: i32 = 10000; +// const MAX_DELETE_LIST: i32 = 1000; +// const MAX_UPLOADS_LIST: i32 = 10000; +// const MAX_PARTS_LIST: i32 = 10000; const METACACHE_SHARE_PREFIX: bool = false; @@ -188,7 +185,7 @@ impl ECStore { get_objects.truncate(max_keys as usize); true } else { - !err_eof && get_objects.len() > 0 + !err_eof && !get_objects.is_empty() } }; @@ -388,62 +385,6 @@ impl ECStore { _ = all_at_eof; Ok(Vec::new()) - - // // let mut errs = Vec::new(); - // let mut ress = Vec::new(); - // let mut uniq = HashSet::new(); - - // for (disks_ress, _disks_errs) in results { - // for disks_res in disks_ress.iter() { - // if disks_res.is_none() { - // // TODO handle errs - // continue; - // } - // let entrys = disks_res.as_ref().unwrap(); - - // for entry in entrys { - // // warn!("lst_merged entry---- {}", &entry.name); - - // if !opts.prefix.is_empty() && !entry.name.starts_with(&opts.prefix) { - // continue; - // } - - // if !uniq.contains(&entry.name) { - // uniq.insert(entry.name.clone()); - // // TODO: 过滤 - - // if opts.limit > 0 && ress.len() as i32 >= opts.limit { - // return Ok(ress); - // } - - // if entry.is_object() { - // // if !opts.delimiter.is_empty() { - // // // entry.name.trim_start_matches(pat) - // // } - - // let fi = entry.to_fileinfo(&opts.bucket)?; - // if let Some(f) = fi { - // ress.push(f.to_object_info(&opts.bucket, &entry.name, false)); - // } - // continue; - // } - - // if entry.is_dir() { - // ress.push(ObjectInfo { - // is_dir: true, - // bucket: opts.bucket.clone(), - // name: entry.name.clone(), - // ..Default::default() - // }); - // } - // } - // } - // } - // } - - // // warn!("list_merged errs {:?}", errs); - - // Ok(ress) } } @@ -840,7 +781,6 @@ mod test { use crate::set_disk::SetDisks; use crate::store::ECStore; use crate::store_list_objects::ListPathOptions; - use crate::StorageAPI; use futures::future::join_all; use lock::namespace_lock::NsLockMap; use tokio::sync::broadcast; From 5158ca14c91f66ce836cc6e13ef13877918f187b Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 22 Dec 2024 05:35:08 +0800 Subject: [PATCH 63/77] fix mc ls -r --- ecstore/src/disk/mod.rs | 35 ++++++++++++++++++++++++++++++- ecstore/src/store_list_objects.rs | 13 +++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 9a961c112..000d0d0dd 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -18,7 +18,7 @@ use crate::{ bucket::{metadata_sys::get_versioning_config, versioning::VersioningApi}, erasure::Writer, error::{Error, Result}, - file_meta::{merge_file_meta_versions, FileMeta, FileMetaShallowVersion}, + file_meta::{merge_file_meta_versions, FileMeta, FileMetaShallowVersion, VersionType}, heal::{ data_scanner::ShouldSleepFn, data_usage_cache::{DataUsageCache, DataUsageEntry}, @@ -629,6 +629,39 @@ impl MetaCacheEntry { !self.metadata.is_empty() } + pub fn is_latest_deletemarker(&mut self) -> bool { + if let Some(cached) = &self.cached { + if cached.versions.is_empty() { + return true; + } + + return cached.versions[0].header.version_type == VersionType::Delete; + } + + if !FileMeta::is_xl2_v1_format(&self.metadata) { + return false; + } + + match FileMeta::check_xl2_v1(&self.metadata) { + Ok((meta, _, _)) => { + if !meta.is_empty() { + // TODO: IsLatestDeleteMarker + } + } + Err(_) => return true, + } + + match self.xl_meta() { + Ok(res) => { + if res.versions.is_empty() { + return true; + } + res.versions[0].header.version_type == VersionType::Delete + } + Err(_) => true, + } + } + #[tracing::instrument(level = "debug", skip(self))] pub fn to_fileinfo(&self, bucket: &str) -> Result> { if self.is_dir() { diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 2102eefdf..6db2c5cb9 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -17,7 +17,7 @@ use std::io::ErrorKind; use std::sync::Arc; use tokio::sync::broadcast::{self, Receiver as B_Receiver}; use tokio::sync::mpsc::{self, Receiver, Sender}; -use tracing::error; +use tracing::{error, warn}; const MAX_OBJECT_LIST: i32 = 1000; // const MAX_DELETE_LIST: i32 = 1000; @@ -318,6 +318,8 @@ impl ECStore { opts: ListPathOptions, sender: Sender, ) -> Result> { + // warn!("list_merged ops {:?}", &opts); + let mut futures = Vec::new(); let mut inputs = Vec::new(); @@ -396,7 +398,8 @@ async fn gather_results( ) -> Result> { let mut returned = false; let mut results = Vec::new(); - while let Some(entry) = recv.recv().await { + while let Some(mut entry) = recv.recv().await { + // warn!("gather_results entry {}", &entry.name); if returned { continue; } @@ -404,7 +407,9 @@ async fn gather_results( // TODO: rx.recv() // TODO: isLatestDeletemarker - if !opts.include_directories && (entry.is_dir() || (!opts.versioned && entry.is_object())) { + if !opts.include_directories + && (entry.is_dir() || (!opts.versioned && entry.is_object() && entry.is_latest_deletemarker())) + { continue; } @@ -421,6 +426,7 @@ async fn gather_results( results.push(entry); } + // warn!("gather_results results {:?}", &results); Ok(results) } @@ -456,6 +462,7 @@ async fn merge_entry_channels( tokio::select! { has_entry = in_channels[0].recv()=>{ if let Some(entry) = has_entry{ + // warn!("merge_entry_channels entry {}", &entry.name); out_channel.send(entry).await?; } else { return Ok(()) From 67ea60a0fa9af5a2bb42de0d253029bd9cc55819 Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 22 Dec 2024 10:52:52 +0800 Subject: [PATCH 64/77] todo: rpc walk_dir use writer --- ecstore/src/disk/local.rs | 4 +- ecstore/src/disk/mod.rs | 6 +-- ecstore/src/disk/remote.rs | 25 +++++++------ ecstore/src/set_disk.rs | 62 +++++++++++++++---------------- rustfs/src/grpc.rs | 76 +++++++++++++++++++------------------- 5 files changed, 89 insertions(+), 84 deletions(-) diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 3cb6ec017..0b6da5aff 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -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(&self, opts: WalkDirOptions, wr: &mut W) -> Result> { + async fn walk_dir(&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))] diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 000d0d0dd..c5f4fd9a9 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -211,7 +211,7 @@ impl DiskAPI for Disk { } } - async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result> { + async fn walk_dir(&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; async fn delete_volume(&self, volume: &str) -> Result<()>; - // 并发边读边写 TODO: wr io.Writer - async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result>; + // 并发边读边写 w <- MetaCacheEntry + async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result<()>; // Metadata operations async fn delete_version( diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 7a405a235..760b53927 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -351,7 +351,7 @@ impl DiskAPI for RemoteDisk { } // FIXME: TODO: use writer - async fn walk_dir(&self, opts: WalkDirOptions, _wr: &mut W) -> Result> { + async fn walk_dir(&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::(&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::(&json_str).ok()) + // .collect(); + + // Ok(entries) } async fn rename_data( diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 76ab932d8..cd170d907 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1402,42 +1402,42 @@ impl SetDisks { Ok((disk, fm)) } - pub async fn walk_dir(&self, opts: &WalkDirOptions) -> (Vec>>, Vec>) { - let disks = self.disks.read().await; + // pub async fn walk_dir(&self, opts: &WalkDirOptions) -> (Vec>>, Vec>) { + // let disks = self.disks.read().await; - let disks = disks.clone(); - let mut futures = Vec::new(); - let mut errs = Vec::new(); - let mut ress = Vec::new(); + // let disks = disks.clone(); + // let mut futures = Vec::new(); + // let mut errs = Vec::new(); + // let mut ress = Vec::new(); - for disk in disks.iter() { - let opts = opts.clone(); - futures.push(async move { - if let Some(disk) = disk { - disk.walk_dir(opts, &mut Writer::NotUse).await - } else { - Err(Error::new(DiskError::DiskNotFound)) - } - }); - } + // for disk in disks.iter() { + // let opts = opts.clone(); + // futures.push(async move { + // if let Some(disk) = disk { + // disk.walk_dir(opts, &mut Writer::NotUse).await + // } else { + // Err(Error::new(DiskError::DiskNotFound)) + // } + // }); + // } - let results = join_all(futures).await; + // let results = join_all(futures).await; - for res in results { - match res { - Ok(entrys) => { - ress.push(Some(entrys)); - errs.push(None); - } - Err(e) => { - ress.push(None); - errs.push(Some(e)); - } - } - } + // for res in results { + // match res { + // Ok(entrys) => { + // ress.push(Some(entrys)); + // errs.push(None); + // } + // Err(e) => { + // ress.push(None); + // errs.push(Some(e)); + // } + // } + // } - (ress, errs) - } + // (ress, errs) + // } async fn remove_object_part( &self, diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index a2be08bac..d29ace0a4 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -731,43 +731,45 @@ impl Node for NodeService { } async fn walk_dir(&self, request: Request) -> Result, Status> { - let request = request.into_inner(); - if let Some(disk) = self.find_disk(&request.disk).await { - let opts = match serde_json::from_str::(&request.walk_dir_options) { - Ok(options) => options, - Err(_) => { - return Ok(tonic::Response::new(WalkDirResponse { - success: false, - meta_cache_entry: Vec::new(), - error_info: Some("can not decode DeleteOptions".to_string()), - })); - } - }; - match disk.walk_dir(opts, &mut ecstore::io::Writer::NotUse).await { - Ok(entries) => { - let entries = entries - .into_iter() - .filter_map(|entry| serde_json::to_string(&entry).ok()) - .collect(); - Ok(tonic::Response::new(WalkDirResponse { - success: true, - meta_cache_entry: entries, - error_info: None, - })) - } - Err(err) => Ok(tonic::Response::new(WalkDirResponse { - success: false, - meta_cache_entry: Vec::new(), - error_info: Some(err.to_string()), - })), - } - } else { - Ok(tonic::Response::new(WalkDirResponse { - success: false, - meta_cache_entry: Vec::new(), - error_info: Some("can not find disk".to_string()), - })) - } + // TODO: use writer + unimplemented!() + // let request = request.into_inner(); + // if let Some(disk) = self.find_disk(&request.disk).await { + // let opts = match serde_json::from_str::(&request.walk_dir_options) { + // Ok(options) => options, + // Err(_) => { + // return Ok(tonic::Response::new(WalkDirResponse { + // success: false, + // meta_cache_entry: Vec::new(), + // error_info: Some("can not decode DeleteOptions".to_string()), + // })); + // } + // }; + // match disk.walk_dir(opts, &mut ecstore::io::Writer::NotUse).await { + // Ok(entries) => { + // let entries = entries + // .into_iter() + // .filter_map(|entry| serde_json::to_string(&entry).ok()) + // .collect(); + // Ok(tonic::Response::new(WalkDirResponse { + // success: true, + // meta_cache_entry: entries, + // error_info: None, + // })) + // } + // Err(err) => Ok(tonic::Response::new(WalkDirResponse { + // success: false, + // meta_cache_entry: Vec::new(), + // error_info: Some(err.to_string()), + // })), + // } + // } else { + // Ok(tonic::Response::new(WalkDirResponse { + // success: false, + // meta_cache_entry: Vec::new(), + // error_info: Some("can not find disk".to_string()), + // })) + // } } async fn rename_data(&self, request: Request) -> Result, Status> { From 259e0f95daee0dbd10c5d5ca06ee3531728c3a7b Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 22 Dec 2024 11:01:50 +0800 Subject: [PATCH 65/77] todo: rpc walk_dir use writer --- ecstore/src/disk/remote.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 760b53927..5d87fb5e9 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -351,19 +351,18 @@ impl DiskAPI for RemoteDisk { } // FIXME: TODO: use writer - async fn walk_dir(&self, opts: WalkDirOptions, _wr: &mut W) -> Result<()> { + async fn walk_dir(&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) - .await - .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; - let request = Request::new(WalkDirRequest { - disk: self.endpoint.to_string(), - walk_dir_options, - }); - // TODO: use writer unimplemented!() + // let walk_dir_options = serde_json::to_string(&opts)?; + // let mut client = node_service_time_out_client(&self.addr) + // .await + // .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; + // let request = Request::new(WalkDirRequest { + // disk: self.endpoint.to_string(), + // walk_dir_options, + // }); // let response = client.walk_dir(request).await?.into_inner(); From a40c2e29789fa5ad3d688b2839aad24b04a19324 Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 22 Dec 2024 11:27:56 +0800 Subject: [PATCH 66/77] clippy --- ecstore/src/io.rs | 6 +----- ecstore/src/notification_sys.rs | 2 +- ecstore/src/set_disk.rs | 9 +++------ ecstore/src/store_list_objects.rs | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ecstore/src/io.rs b/ecstore/src/io.rs index e1ed0b48d..7c1493455 100644 --- a/ecstore/src/io.rs +++ b/ecstore/src/io.rs @@ -5,10 +5,7 @@ use std::task::{Context, Poll}; use tokio::fs::File; use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf}; -#[derive(Default)] pub enum Reader { - #[default] - NotUse, File(File), Buffer(VecAsyncReader), } @@ -18,7 +15,6 @@ impl AsyncRead for Reader { match self.get_mut() { Reader::File(file) => Pin::new(file).poll_read(cx, buf), Reader::Buffer(buffer) => Pin::new(buffer).poll_read(cx, buf), - Reader::NotUse => Poll::Ready(Ok(())), } } } @@ -203,7 +199,7 @@ impl VecAsyncReader { // Implementing AsyncRead trait for VecAsyncReader impl AsyncRead for VecAsyncReader { - fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf) -> Poll> { + fn poll_read(self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &mut ReadBuf) -> Poll> { let this = self.get_mut(); // Check how many bytes are available to read diff --git a/ecstore/src/notification_sys.rs b/ecstore/src/notification_sys.rs index 063db66b9..c0b2463bd 100644 --- a/ecstore/src/notification_sys.rs +++ b/ecstore/src/notification_sys.rs @@ -46,7 +46,7 @@ pub struct NotificationPeerErr { } impl NotificationSys { - pub fn rest_client_from_hash(&self, s: &str) -> Option { + pub fn rest_client_from_hash(&self, _s: &str) -> Option { None } pub async fn delete_policy(&self) -> Vec { diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index cd170d907..962c9a7c4 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -6,6 +6,7 @@ use std::{ time::Duration, }; +use crate::heal::heal_ops::{HealEntryFn, HealSequence}; use crate::{ bitrot::{bitrot_verify, close_bitrot_writers, new_bitrot_filereader, new_bitrot_filewriter, BitrotFileWriter}, cache_value::metacache_set::{list_path_raw, ListPathRawOptions}, @@ -16,8 +17,8 @@ use crate::{ format::FormatV3, new_disk, BufferReader, BufferWriter, CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskOption, DiskStore, FileInfoVersions, FileReader, FileWriter, MetaCacheEntries, MetaCacheEntry, MetadataResolutionParams, - ReadMultipleReq, ReadMultipleResp, ReadOptions, UpdateMetadataOpts, WalkDirOptions, RUSTFS_META_BUCKET, - RUSTFS_META_MULTIPART_BUCKET, RUSTFS_META_TMP_BUCKET, + ReadMultipleReq, ReadMultipleResp, ReadOptions, UpdateMetadataOpts, RUSTFS_META_BUCKET, RUSTFS_META_MULTIPART_BUCKET, + RUSTFS_META_TMP_BUCKET, }, erasure::Erasure, error::{Error, Result}, @@ -55,10 +56,6 @@ use crate::{ heal::data_scanner::{globalHealConfig, HEAL_DELETE_DANGLING}, store_api::ListObjectVersionsInfo, }; -use crate::{ - heal::heal_ops::{HealEntryFn, HealSequence}, - io::Writer, -}; use futures::future::join_all; use glob::Pattern; use http::HeaderMap; diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 6db2c5cb9..f7b185d84 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -17,7 +17,7 @@ use std::io::ErrorKind; use std::sync::Arc; use tokio::sync::broadcast::{self, Receiver as B_Receiver}; use tokio::sync::mpsc::{self, Receiver, Sender}; -use tracing::{error, warn}; +use tracing::error; const MAX_OBJECT_LIST: i32 = 1000; // const MAX_DELETE_LIST: i32 = 1000; From b46a78fb63bc488e40ee6a5570681ca03cc13eb0 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 23 Dec 2024 15:44:24 +0800 Subject: [PATCH 67/77] fix check file not found use is_err_object_not_found --- ecstore/src/config/error.rs | 4 +++- ecstore/src/disk/remote.rs | 6 +++--- iam/src/manager.rs | 3 ++- iam/src/store/object.rs | 9 +++++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ecstore/src/config/error.rs b/ecstore/src/config/error.rs index 27518aef9..80038c9da 100644 --- a/ecstore/src/config/error.rs +++ b/ecstore/src/config/error.rs @@ -1,4 +1,4 @@ -use crate::{disk, error::Error}; +use crate::{disk, error::Error, store_err::is_err_object_not_found}; #[derive(Debug, thiserror::Error)] pub enum ConfigError { @@ -20,6 +20,8 @@ pub fn is_not_found(err: &Error) -> bool { ConfigError::is_not_found(e) } else if let Some(e) = err.downcast_ref::() { matches!(e, disk::error::DiskError::FileNotFound) + } else if is_err_object_not_found(err) { + return true; } else { false } diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 5d87fb5e9..1e7171635 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -7,7 +7,7 @@ use protos::{ CheckPartsRequest, DeletePathsRequest, DeleteRequest, DeleteVersionRequest, DeleteVersionsRequest, DeleteVolumeRequest, DiskInfoRequest, ListDirRequest, ListVolumesRequest, MakeVolumeRequest, MakeVolumesRequest, NsScannerRequest, ReadAllRequest, ReadMultipleRequest, ReadVersionRequest, ReadXlRequest, RenameDataRequest, RenameFileRequst, - StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WalkDirRequest, WriteAllRequest, WriteMetadataRequest, + StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WriteAllRequest, WriteMetadataRequest, }, }; use tokio::{ @@ -21,8 +21,8 @@ use uuid::Uuid; use super::{ endpoint::Endpoint, CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskOption, - FileInfoVersions, FileReader, FileWriter, MetaCacheEntry, ReadMultipleReq, ReadMultipleResp, ReadOptions, RemoteFileReader, - RemoteFileWriter, RenameDataResp, UpdateMetadataOpts, VolumeInfo, WalkDirOptions, + FileInfoVersions, FileReader, FileWriter, ReadMultipleReq, ReadMultipleResp, ReadOptions, RemoteFileReader, RemoteFileWriter, + RenameDataResp, UpdateMetadataOpts, VolumeInfo, WalkDirOptions, }; use crate::{ disk::error::DiskError, diff --git a/iam/src/manager.rs b/iam/src/manager.rs index a58aa8b15..efe57c779 100644 --- a/iam/src/manager.rs +++ b/iam/src/manager.rs @@ -7,6 +7,7 @@ use std::{ time::Duration, }; +use ecstore::store_err::is_err_object_not_found; use log::debug; use time::OffsetDateTime; use tokio::{ @@ -113,7 +114,7 @@ where async fn save_iam_formatter(self: Arc) -> crate::Result<()> { match self.api.load_iam_config::(Format::PATH).await { Ok((format, _)) if format.version >= 1 => return Ok(()), - Err(Error::EcstoreError(e)) if !ecstore::disk::error::is_err_file_not_found(&e) => { + Err(Error::EcstoreError(e)) if !is_err_object_not_found(&e) => { return Err(Error::EcstoreError(e)); } _ => {} diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index c2b886141..a3ea78b99 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -60,8 +60,13 @@ impl ObjectStore { match items { Ok(items) => Result::<_, crate::Error>::Ok(items.prefixes), - Err(e) if is_not_found(&e) => Result::<_, crate::Error>::Ok(vec![]), - Err(e) => Err(Error::StringError(format!("list {prefix} failed, err: {e:?}"))), + Err(e) => { + if is_not_found(&e) { + Result::<_, crate::Error>::Ok(vec![]) + } else { + Err(Error::StringError(format!("list {prefix} failed, err: {e:?}"))) + } + } } }); } From ab26b7c1cae1bf189d59f62f2d27d228b4d5d669 Mon Sep 17 00:00:00 2001 From: junxiang Mu <1948535941@qq.com> Date: Mon, 23 Dec 2024 15:28:13 +0800 Subject: [PATCH 68/77] refactor walk_dir grpc api Signed-off-by: junxiang Mu <1948535941@qq.com> --- .../generated/flatbuffers_generated/models.rs | 207 +- .../src/generated/proto_gen/node_service.rs | 3847 ++++------------- common/protos/src/node.proto | 4 +- e2e_test/src/reliant/node_interact_test.rs | 46 +- ecstore/src/disk/remote.rs | 51 +- rustfs/src/grpc.rs | 111 +- 6 files changed, 1042 insertions(+), 3224 deletions(-) diff --git a/common/protos/src/generated/flatbuffers_generated/models.rs b/common/protos/src/generated/flatbuffers_generated/models.rs index aa1f6ae2f..e4949fdcf 100644 --- a/common/protos/src/generated/flatbuffers_generated/models.rs +++ b/common/protos/src/generated/flatbuffers_generated/models.rs @@ -1,10 +1,9 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use core::mem; use core::cmp::Ordering; +use core::mem; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -12,112 +11,114 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod models { - use core::mem; - use core::cmp::Ordering; + use core::cmp::Ordering; + use core::mem; - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; -pub enum PingBodyOffset {} -#[derive(Copy, Clone, PartialEq)] + pub enum PingBodyOffset {} + #[derive(Copy, Clone, PartialEq)] -pub struct PingBody<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { - type Inner = PingBody<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PingBody<'a> { - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; - - pub const fn get_fully_qualified_name() -> &'static str { - "models.PingBody" - } - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PingBody { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PingBodyArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PingBodyBuilder::new(_fbb); - if let Some(x) = args.payload { builder.add_payload(x); } - builder.finish() - } - - - #[inline] - pub fn payload(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(PingBody::VT_PAYLOAD, None)} - } -} - -impl flatbuffers::Verifiable for PingBody<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("payload", Self::VT_PAYLOAD, false)? - .finish(); - Ok(()) - } -} -pub struct PingBodyArgs<'a> { - pub payload: Option>>, -} -impl<'a> Default for PingBodyArgs<'a> { - #[inline] - fn default() -> Self { - PingBodyArgs { - payload: None, + pub struct PingBody<'a> { + pub _tab: flatbuffers::Table<'a>, } - } -} -pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PingBody::VT_PAYLOAD, payload); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PingBodyBuilder { - fbb_: _fbb, - start_: start, + impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { + type Inner = PingBody<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} -impl core::fmt::Debug for PingBody<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PingBody"); - ds.field("payload", &self.payload()); - ds.finish() - } -} -} // pub mod models + impl<'a> PingBody<'a> { + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; + pub const fn get_fully_qualified_name() -> &'static str { + "models.PingBody" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PingBody { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PingBodyArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = PingBodyBuilder::new(_fbb); + if let Some(x) = args.payload { + builder.add_payload(x); + } + builder.finish() + } + + #[inline] + pub fn payload(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>(PingBody::VT_PAYLOAD, None) + } + } + } + + impl flatbuffers::Verifiable for PingBody<'_> { + #[inline] + fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>("payload", Self::VT_PAYLOAD, false)? + .finish(); + Ok(()) + } + } + pub struct PingBodyArgs<'a> { + pub payload: Option>>, + } + impl<'a> Default for PingBodyArgs<'a> { + #[inline] + fn default() -> Self { + PingBodyArgs { payload: None } + } + } + + pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { + #[inline] + pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(PingBody::VT_PAYLOAD, payload); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PingBodyBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for PingBody<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PingBody"); + ds.field("payload", &self.payload()); + ds.finish() + } + } +} // pub mod models diff --git a/common/protos/src/generated/proto_gen/node_service.rs b/common/protos/src/generated/proto_gen/node_service.rs index 74e524da1..ca8b919e4 100644 --- a/common/protos/src/generated/proto_gen/node_service.rs +++ b/common/protos/src/generated/proto_gen/node_service.rs @@ -300,8 +300,8 @@ pub struct WalkDirRequest { pub struct WalkDirResponse { #[prost(bool, tag = "1")] pub success: bool, - #[prost(string, repeated, tag = "2")] - pub meta_cache_entry: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag = "2")] + pub meta_cache_entry: ::prost::alloc::string::String, #[prost(string, optional, tag = "3")] pub error_info: ::core::option::Option<::prost::alloc::string::String>, } @@ -615,10 +615,7 @@ pub struct GenerallyLockResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mss { #[prost(map = "string, string", tag = "1")] - pub value: ::std::collections::HashMap< - ::prost::alloc::string::String, - ::prost::alloc::string::String, - >, + pub value: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct LocalStorageInfoRequest { @@ -782,10 +779,7 @@ pub struct DownloadProfileDataResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(map = "string, bytes", tag = "2")] - pub data: ::std::collections::HashMap< - ::prost::alloc::string::String, - ::prost::alloc::vec::Vec, - >, + pub data: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::vec::Vec>, #[prost(string, optional, tag = "3")] pub error_info: ::core::option::Option<::prost::alloc::string::String>, } @@ -1052,15 +1046,9 @@ pub struct LoadTransitionTierConfigResponse { } /// Generated client implementations. pub mod node_service_client { - #![allow( - unused_variables, - dead_code, - missing_docs, - clippy::wildcard_imports, - clippy::let_unit_value, - )] - use tonic::codegen::*; + #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] use tonic::codegen::http::Uri; + use tonic::codegen::*; #[derive(Debug, Clone)] pub struct NodeServiceClient { inner: tonic::client::Grpc, @@ -1091,22 +1079,16 @@ pub mod node_service_client { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> NodeServiceClient> + pub fn with_interceptor(inner: T, interceptor: F) -> NodeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, - Response = http::Response< - >::ResponseBody, - >, + Response = http::Response<>::ResponseBody>, >, - , - >>::Error: Into + std::marker::Send + std::marker::Sync, + >>::Error: + Into + std::marker::Send + std::marker::Sync, { NodeServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -1149,15 +1131,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Ping", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Ping"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Ping")); @@ -1166,22 +1142,13 @@ pub mod node_service_client { pub async fn heal_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/HealBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/HealBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "HealBucket")); @@ -1190,22 +1157,13 @@ pub mod node_service_client { pub async fn list_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ListBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListBucket")); @@ -1214,22 +1172,13 @@ pub mod node_service_client { pub async fn make_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/MakeBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeBucket")); @@ -1238,22 +1187,13 @@ pub mod node_service_client { pub async fn get_bucket_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetBucketInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketInfo")); @@ -1262,22 +1202,13 @@ pub mod node_service_client { pub async fn delete_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteBucket", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucket"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucket")); @@ -1286,22 +1217,13 @@ pub mod node_service_client { pub async fn read_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadAll", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAll"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAll")); @@ -1310,22 +1232,13 @@ pub mod node_service_client { pub async fn write_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WriteAll", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteAll"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteAll")); @@ -1338,15 +1251,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Delete", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Delete"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Delete")); @@ -1355,22 +1262,13 @@ pub mod node_service_client { pub async fn verify_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/VerifyFile", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/VerifyFile"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "VerifyFile")); @@ -1379,22 +1277,13 @@ pub mod node_service_client { pub async fn check_parts( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/CheckParts", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/CheckParts"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "CheckParts")); @@ -1403,22 +1292,13 @@ pub mod node_service_client { pub async fn rename_part( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RenamePart", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenamePart"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenamePart")); @@ -1427,22 +1307,13 @@ pub mod node_service_client { pub async fn rename_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RenameFile", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameFile"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameFile")); @@ -1455,15 +1326,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Write", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Write"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Write")); @@ -1472,22 +1337,13 @@ pub mod node_service_client { pub async fn write_stream( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WriteStream", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteStream"); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteStream")); @@ -1497,22 +1353,13 @@ pub mod node_service_client { pub async fn read_at( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadAt", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAt"); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAt")); @@ -1521,22 +1368,13 @@ pub mod node_service_client { pub async fn list_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ListDir", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListDir"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListDir")); @@ -1545,46 +1383,28 @@ pub mod node_service_client { pub async fn walk_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WalkDir", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WalkDir"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WalkDir")); - self.inner.unary(req, path, codec).await + self.inner.server_streaming(req, path, codec).await } pub async fn rename_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RenameData", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameData"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameData")); @@ -1593,22 +1413,13 @@ pub mod node_service_client { pub async fn make_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/MakeVolumes", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolumes"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolumes")); @@ -1617,22 +1428,13 @@ pub mod node_service_client { pub async fn make_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/MakeVolume", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolume"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolume")); @@ -1641,22 +1443,13 @@ pub mod node_service_client { pub async fn list_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ListVolumes", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListVolumes"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListVolumes")); @@ -1665,22 +1458,13 @@ pub mod node_service_client { pub async fn stat_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/StatVolume", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StatVolume"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StatVolume")); @@ -1689,22 +1473,13 @@ pub mod node_service_client { pub async fn delete_paths( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeletePaths", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePaths"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePaths")); @@ -1713,22 +1488,13 @@ pub mod node_service_client { pub async fn update_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/UpdateMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetadata"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetadata")); @@ -1737,22 +1503,13 @@ pub mod node_service_client { pub async fn write_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/WriteMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteMetadata"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteMetadata")); @@ -1761,22 +1518,13 @@ pub mod node_service_client { pub async fn read_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadVersion", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadVersion"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadVersion")); @@ -1789,15 +1537,9 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadXL", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadXL"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadXL")); @@ -1806,22 +1548,13 @@ pub mod node_service_client { pub async fn delete_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteVersion", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersion"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersion")); @@ -1830,22 +1563,13 @@ pub mod node_service_client { pub async fn delete_versions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteVersions", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersions"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersions")); @@ -1854,22 +1578,13 @@ pub mod node_service_client { pub async fn read_multiple( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReadMultiple", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadMultiple"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadMultiple")); @@ -1878,22 +1593,13 @@ pub mod node_service_client { pub async fn delete_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteVolume", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVolume"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVolume")); @@ -1902,22 +1608,13 @@ pub mod node_service_client { pub async fn disk_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DiskInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DiskInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DiskInfo")); @@ -1926,22 +1623,13 @@ pub mod node_service_client { pub async fn ns_scanner( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { + ) -> std::result::Result>, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/NsScanner", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/NsScanner"); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "NsScanner")); @@ -1950,22 +1638,13 @@ pub mod node_service_client { pub async fn lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Lock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Lock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Lock")); @@ -1974,22 +1653,13 @@ pub mod node_service_client { pub async fn un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/UnLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UnLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UnLock")); @@ -1998,22 +1668,13 @@ pub mod node_service_client { pub async fn r_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RLock")); @@ -2022,22 +1683,13 @@ pub mod node_service_client { pub async fn r_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/RUnLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RUnLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RUnLock")); @@ -2046,22 +1698,13 @@ pub mod node_service_client { pub async fn force_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ForceUnLock", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ForceUnLock"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ForceUnLock")); @@ -2070,22 +1713,13 @@ pub mod node_service_client { pub async fn refresh( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/Refresh", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Refresh"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Refresh")); @@ -2094,22 +1728,13 @@ pub mod node_service_client { pub async fn local_storage_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LocalStorageInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LocalStorageInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LocalStorageInfo")); @@ -2118,22 +1743,13 @@ pub mod node_service_client { pub async fn server_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ServerInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ServerInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ServerInfo")); @@ -2142,22 +1758,13 @@ pub mod node_service_client { pub async fn get_cpus( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetCpus", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetCpus"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetCpus")); @@ -2166,22 +1773,13 @@ pub mod node_service_client { pub async fn get_net_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetNetInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetNetInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetNetInfo")); @@ -2190,22 +1788,13 @@ pub mod node_service_client { pub async fn get_partitions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetPartitions", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetPartitions"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetPartitions")); @@ -2214,22 +1803,13 @@ pub mod node_service_client { pub async fn get_os_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetOsInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetOsInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetOsInfo")); @@ -2238,22 +1818,13 @@ pub mod node_service_client { pub async fn get_se_linux_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSELinuxInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSELinuxInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSELinuxInfo")); @@ -2262,22 +1833,13 @@ pub mod node_service_client { pub async fn get_sys_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSysConfig", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysConfig"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysConfig")); @@ -2286,22 +1848,13 @@ pub mod node_service_client { pub async fn get_sys_errors( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSysErrors", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysErrors"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysErrors")); @@ -2310,22 +1863,13 @@ pub mod node_service_client { pub async fn get_mem_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetMemInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMemInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMemInfo")); @@ -2334,22 +1878,13 @@ pub mod node_service_client { pub async fn get_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetMetrics", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetrics"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMetrics")); @@ -2358,22 +1893,13 @@ pub mod node_service_client { pub async fn get_proc_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetProcInfo", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetProcInfo"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetProcInfo")); @@ -2382,22 +1908,13 @@ pub mod node_service_client { pub async fn start_profiling( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/StartProfiling", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StartProfiling"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StartProfiling")); @@ -2406,48 +1923,28 @@ pub mod node_service_client { pub async fn download_profile_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DownloadProfileData", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DownloadProfileData"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "DownloadProfileData"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "DownloadProfileData")); self.inner.unary(req, path, codec).await } pub async fn get_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetBucketStats", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketStats"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketStats")); @@ -2456,22 +1953,13 @@ pub mod node_service_client { pub async fn get_sr_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetSRMetrics", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSRMetrics"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSRMetrics")); @@ -2480,100 +1968,58 @@ pub mod node_service_client { pub async fn get_all_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetAllBucketStats", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetAllBucketStats"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "GetAllBucketStats"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "GetAllBucketStats")); self.inner.unary(req, path, codec).await } pub async fn load_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadBucketMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadBucketMetadata"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata")); self.inner.unary(req, path, codec).await } pub async fn delete_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteBucketMetadata", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucketMetadata"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata")); self.inner.unary(req, path, codec).await } pub async fn delete_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeletePolicy", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePolicy"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePolicy")); @@ -2582,22 +2028,13 @@ pub mod node_service_client { pub async fn load_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadPolicy", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicy"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicy")); @@ -2606,48 +2043,28 @@ pub mod node_service_client { pub async fn load_policy_mapping( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadPolicyMapping", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicyMapping"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping")); self.inner.unary(req, path, codec).await } pub async fn delete_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteUser", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteUser"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteUser")); @@ -2656,48 +2073,28 @@ pub mod node_service_client { pub async fn delete_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/DeleteServiceAccount", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteServiceAccount"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount")); self.inner.unary(req, path, codec).await } pub async fn load_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadUser", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadUser"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadUser")); @@ -2706,48 +2103,28 @@ pub mod node_service_client { pub async fn load_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadServiceAccount", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadServiceAccount"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadServiceAccount"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadServiceAccount")); self.inner.unary(req, path, codec).await } pub async fn load_group( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadGroup", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadGroup"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadGroup")); @@ -2756,30 +2133,16 @@ pub mod node_service_client { pub async fn reload_site_replication_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReloadSiteReplicationConfig", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadSiteReplicationConfig"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new( - "node_service.NodeService", - "ReloadSiteReplicationConfig", - ), - ); + .insert(GrpcMethod::new("node_service.NodeService", "ReloadSiteReplicationConfig")); self.inner.unary(req, path, codec).await } /// rpc VerifyBinary() returns () {}; @@ -2787,22 +2150,13 @@ pub mod node_service_client { pub async fn signal_service( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/SignalService", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/SignalService"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "SignalService")); @@ -2811,100 +2165,58 @@ pub mod node_service_client { pub async fn background_heal_status( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/BackgroundHealStatus", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/BackgroundHealStatus"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus")); self.inner.unary(req, path, codec).await } pub async fn get_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/GetMetacacheListing", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetacacheListing"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "GetMetacacheListing"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "GetMetacacheListing")); self.inner.unary(req, path, codec).await } pub async fn update_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/UpdateMetacacheListing", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetacacheListing"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing")); self.inner.unary(req, path, codec).await } pub async fn reload_pool_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/ReloadPoolMeta", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadPoolMeta"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReloadPoolMeta")); @@ -2913,22 +2225,13 @@ pub mod node_service_client { pub async fn stop_rebalance( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/StopRebalance", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StopRebalance"); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StopRebalance")); @@ -2937,69 +2240,38 @@ pub mod node_service_client { pub async fn load_rebalance_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadRebalanceMeta", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadRebalanceMeta"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta"), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta")); self.inner.unary(req, path, codec).await } pub async fn load_transition_tier_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await - .map_err(|e| { - tonic::Status::unknown( - format!("Service was not ready: {}", e.into()), - ) - })?; + .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/node_service.NodeService/LoadTransitionTierConfig", - ); + let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadTransitionTierConfig"); let mut req = request.into_request(); req.extensions_mut() - .insert( - GrpcMethod::new( - "node_service.NodeService", - "LoadTransitionTierConfig", - ), - ); + .insert(GrpcMethod::new("node_service.NodeService", "LoadTransitionTierConfig")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod node_service_server { - #![allow( - unused_variables, - dead_code, - missing_docs, - clippy::wildcard_imports, - clippy::let_unit_value, - )] + #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with NodeServiceServer. #[async_trait] @@ -3012,38 +2284,23 @@ pub mod node_service_server { async fn heal_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn list_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn make_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_bucket_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_bucket( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_all( &self, request: tonic::Request, @@ -3051,10 +2308,7 @@ pub mod node_service_server { async fn write_all( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete( &self, request: tonic::Request, @@ -3062,52 +2316,33 @@ pub mod node_service_server { async fn verify_file( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn check_parts( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn rename_part( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn rename_file( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn write( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WriteStream method. - type WriteStreamStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + type WriteStreamStream: tonic::codegen::tokio_stream::Stream> + std::marker::Send + 'static; async fn write_stream( &self, request: tonic::Request>, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the ReadAt method. - type ReadAtStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + type ReadAtStream: tonic::codegen::tokio_stream::Stream> + std::marker::Send + 'static; /// rpc Append(AppendRequest) returns (AppendResponse) {}; @@ -3119,73 +2354,50 @@ pub mod node_service_server { &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; + /// Server streaming response type for the WalkDir method. + type WalkDirStream: tonic::codegen::tokio_stream::Stream> + + std::marker::Send + + 'static; async fn walk_dir( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; async fn rename_data( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn make_volumes( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn make_volume( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn list_volumes( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn stat_volume( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_paths( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn update_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn write_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_version( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_xl( &self, request: tonic::Request, @@ -3193,42 +2405,25 @@ pub mod node_service_server { async fn delete_version( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_versions( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn read_multiple( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_volume( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn disk_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the NsScanner method. - type NsScannerStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > + type NsScannerStream: tonic::codegen::tokio_stream::Stream> + std::marker::Send + 'static; async fn ns_scanner( @@ -3238,59 +2433,35 @@ pub mod node_service_server { async fn lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn un_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn r_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn r_un_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn force_un_lock( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn refresh( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn local_storage_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn server_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_cpus( &self, request: tonic::Request, @@ -3298,236 +2469,137 @@ pub mod node_service_server { async fn get_net_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_partitions( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_os_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_se_linux_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_sys_config( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_sys_errors( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_mem_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_metrics( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_proc_info( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn start_profiling( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn download_profile_data( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_sr_metrics( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_all_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_policy( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_policy( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_policy_mapping( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_user( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn delete_service_account( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_user( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_service_account( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_group( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn reload_site_replication_config( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; /// rpc VerifyBinary() returns () {}; /// rpc CommitBinary() returns () {}; async fn signal_service( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn background_heal_status( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn get_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn update_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn reload_pool_meta( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn stop_rebalance( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_rebalance_meta( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; async fn load_transition_tier_config( &self, request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; + ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct NodeServiceServer { @@ -3550,10 +2622,7 @@ pub mod node_service_server { max_encoding_message_size: None, } } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService where F: tonic::service::Interceptor, { @@ -3597,10 +2666,7 @@ pub mod node_service_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { + fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -3608,21 +2674,12 @@ pub mod node_service_server { "/node_service.NodeService/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl tonic::server::UnaryService - for PingSvc { + impl tonic::server::UnaryService for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::ping(&inner, request).await - }; + let fut = async move { ::ping(&inner, request).await }; Box::pin(fut) } } @@ -3635,14 +2692,8 @@ pub mod node_service_server { let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3651,23 +2702,12 @@ pub mod node_service_server { "/node_service.NodeService/HealBucket" => { #[allow(non_camel_case_types)] struct HealBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for HealBucketSvc { + impl tonic::server::UnaryService for HealBucketSvc { type Response = super::HealBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::heal_bucket(&inner, request).await - }; + let fut = async move { ::heal_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3680,14 +2720,8 @@ pub mod node_service_server { let method = HealBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3696,23 +2730,12 @@ pub mod node_service_server { "/node_service.NodeService/ListBucket" => { #[allow(non_camel_case_types)] struct ListBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ListBucketSvc { + impl tonic::server::UnaryService for ListBucketSvc { type Response = super::ListBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::list_bucket(&inner, request).await - }; + let fut = async move { ::list_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3725,14 +2748,8 @@ pub mod node_service_server { let method = ListBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3741,23 +2758,12 @@ pub mod node_service_server { "/node_service.NodeService/MakeBucket" => { #[allow(non_camel_case_types)] struct MakeBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for MakeBucketSvc { + impl tonic::server::UnaryService for MakeBucketSvc { type Response = super::MakeBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::make_bucket(&inner, request).await - }; + let fut = async move { ::make_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3770,14 +2776,8 @@ pub mod node_service_server { let method = MakeBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3786,23 +2786,12 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketInfo" => { #[allow(non_camel_case_types)] struct GetBucketInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetBucketInfoSvc { + impl tonic::server::UnaryService for GetBucketInfoSvc { type Response = super::GetBucketInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_bucket_info(&inner, request).await - }; + let fut = async move { ::get_bucket_info(&inner, request).await }; Box::pin(fut) } } @@ -3815,14 +2804,8 @@ pub mod node_service_server { let method = GetBucketInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3831,23 +2814,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucket" => { #[allow(non_camel_case_types)] struct DeleteBucketSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteBucketSvc { + impl tonic::server::UnaryService for DeleteBucketSvc { type Response = super::DeleteBucketResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_bucket(&inner, request).await - }; + let fut = async move { ::delete_bucket(&inner, request).await }; Box::pin(fut) } } @@ -3860,14 +2832,8 @@ pub mod node_service_server { let method = DeleteBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3876,23 +2842,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadAll" => { #[allow(non_camel_case_types)] struct ReadAllSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadAllSvc { + impl tonic::server::UnaryService for ReadAllSvc { type Response = super::ReadAllResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_all(&inner, request).await - }; + let fut = async move { ::read_all(&inner, request).await }; Box::pin(fut) } } @@ -3905,14 +2860,8 @@ pub mod node_service_server { let method = ReadAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3921,23 +2870,12 @@ pub mod node_service_server { "/node_service.NodeService/WriteAll" => { #[allow(non_camel_case_types)] struct WriteAllSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for WriteAllSvc { + impl tonic::server::UnaryService for WriteAllSvc { type Response = super::WriteAllResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write_all(&inner, request).await - }; + let fut = async move { ::write_all(&inner, request).await }; Box::pin(fut) } } @@ -3950,14 +2888,8 @@ pub mod node_service_server { let method = WriteAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3966,23 +2898,12 @@ pub mod node_service_server { "/node_service.NodeService/Delete" => { #[allow(non_camel_case_types)] struct DeleteSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteSvc { + impl tonic::server::UnaryService for DeleteSvc { type Response = super::DeleteResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete(&inner, request).await - }; + let fut = async move { ::delete(&inner, request).await }; Box::pin(fut) } } @@ -3995,14 +2916,8 @@ pub mod node_service_server { let method = DeleteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4011,23 +2926,12 @@ pub mod node_service_server { "/node_service.NodeService/VerifyFile" => { #[allow(non_camel_case_types)] struct VerifyFileSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for VerifyFileSvc { + impl tonic::server::UnaryService for VerifyFileSvc { type Response = super::VerifyFileResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::verify_file(&inner, request).await - }; + let fut = async move { ::verify_file(&inner, request).await }; Box::pin(fut) } } @@ -4040,14 +2944,8 @@ pub mod node_service_server { let method = VerifyFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4056,23 +2954,12 @@ pub mod node_service_server { "/node_service.NodeService/CheckParts" => { #[allow(non_camel_case_types)] struct CheckPartsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for CheckPartsSvc { + impl tonic::server::UnaryService for CheckPartsSvc { type Response = super::CheckPartsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::check_parts(&inner, request).await - }; + let fut = async move { ::check_parts(&inner, request).await }; Box::pin(fut) } } @@ -4085,14 +2972,8 @@ pub mod node_service_server { let method = CheckPartsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4101,23 +2982,12 @@ pub mod node_service_server { "/node_service.NodeService/RenamePart" => { #[allow(non_camel_case_types)] struct RenamePartSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RenamePartSvc { + impl tonic::server::UnaryService for RenamePartSvc { type Response = super::RenamePartResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::rename_part(&inner, request).await - }; + let fut = async move { ::rename_part(&inner, request).await }; Box::pin(fut) } } @@ -4130,14 +3000,8 @@ pub mod node_service_server { let method = RenamePartSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4146,23 +3010,12 @@ pub mod node_service_server { "/node_service.NodeService/RenameFile" => { #[allow(non_camel_case_types)] struct RenameFileSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RenameFileSvc { + impl tonic::server::UnaryService for RenameFileSvc { type Response = super::RenameFileResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::rename_file(&inner, request).await - }; + let fut = async move { ::rename_file(&inner, request).await }; Box::pin(fut) } } @@ -4175,14 +3028,8 @@ pub mod node_service_server { let method = RenameFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4191,21 +3038,12 @@ pub mod node_service_server { "/node_service.NodeService/Write" => { #[allow(non_camel_case_types)] struct WriteSvc(pub Arc); - impl tonic::server::UnaryService - for WriteSvc { + impl tonic::server::UnaryService for WriteSvc { type Response = super::WriteResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write(&inner, request).await - }; + let fut = async move { ::write(&inner, request).await }; Box::pin(fut) } } @@ -4218,14 +3056,8 @@ pub mod node_service_server { let method = WriteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4234,26 +3066,13 @@ pub mod node_service_server { "/node_service.NodeService/WriteStream" => { #[allow(non_camel_case_types)] struct WriteStreamSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::StreamingService - for WriteStreamSvc { + impl tonic::server::StreamingService for WriteStreamSvc { type Response = super::WriteResponse; type ResponseStream = T::WriteStreamStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request>) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write_stream(&inner, request).await - }; + let fut = async move { ::write_stream(&inner, request).await }; Box::pin(fut) } } @@ -4266,14 +3085,8 @@ pub mod node_service_server { let method = WriteStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -4282,26 +3095,13 @@ pub mod node_service_server { "/node_service.NodeService/ReadAt" => { #[allow(non_camel_case_types)] struct ReadAtSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::StreamingService - for ReadAtSvc { + impl tonic::server::StreamingService for ReadAtSvc { type Response = super::ReadAtResponse; type ResponseStream = T::ReadAtStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request>) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_at(&inner, request).await - }; + let fut = async move { ::read_at(&inner, request).await }; Box::pin(fut) } } @@ -4314,14 +3114,8 @@ pub mod node_service_server { let method = ReadAtSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -4330,23 +3124,12 @@ pub mod node_service_server { "/node_service.NodeService/ListDir" => { #[allow(non_camel_case_types)] struct ListDirSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ListDirSvc { + impl tonic::server::UnaryService for ListDirSvc { type Response = super::ListDirResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::list_dir(&inner, request).await - }; + let fut = async move { ::list_dir(&inner, request).await }; Box::pin(fut) } } @@ -4359,14 +3142,8 @@ pub mod node_service_server { let method = ListDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4375,23 +3152,13 @@ pub mod node_service_server { "/node_service.NodeService/WalkDir" => { #[allow(non_camel_case_types)] struct WalkDirSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for WalkDirSvc { + impl tonic::server::ServerStreamingService for WalkDirSvc { type Response = super::WalkDirResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type ResponseStream = T::WalkDirStream; + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::walk_dir(&inner, request).await - }; + let fut = async move { ::walk_dir(&inner, request).await }; Box::pin(fut) } } @@ -4404,15 +3171,9 @@ pub mod node_service_server { let method = WalkDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) @@ -4420,23 +3181,12 @@ pub mod node_service_server { "/node_service.NodeService/RenameData" => { #[allow(non_camel_case_types)] struct RenameDataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RenameDataSvc { + impl tonic::server::UnaryService for RenameDataSvc { type Response = super::RenameDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::rename_data(&inner, request).await - }; + let fut = async move { ::rename_data(&inner, request).await }; Box::pin(fut) } } @@ -4449,14 +3199,8 @@ pub mod node_service_server { let method = RenameDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4465,23 +3209,12 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolumes" => { #[allow(non_camel_case_types)] struct MakeVolumesSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for MakeVolumesSvc { + impl tonic::server::UnaryService for MakeVolumesSvc { type Response = super::MakeVolumesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::make_volumes(&inner, request).await - }; + let fut = async move { ::make_volumes(&inner, request).await }; Box::pin(fut) } } @@ -4494,14 +3227,8 @@ pub mod node_service_server { let method = MakeVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4510,23 +3237,12 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolume" => { #[allow(non_camel_case_types)] struct MakeVolumeSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for MakeVolumeSvc { + impl tonic::server::UnaryService for MakeVolumeSvc { type Response = super::MakeVolumeResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::make_volume(&inner, request).await - }; + let fut = async move { ::make_volume(&inner, request).await }; Box::pin(fut) } } @@ -4539,14 +3255,8 @@ pub mod node_service_server { let method = MakeVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4555,23 +3265,12 @@ pub mod node_service_server { "/node_service.NodeService/ListVolumes" => { #[allow(non_camel_case_types)] struct ListVolumesSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ListVolumesSvc { + impl tonic::server::UnaryService for ListVolumesSvc { type Response = super::ListVolumesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::list_volumes(&inner, request).await - }; + let fut = async move { ::list_volumes(&inner, request).await }; Box::pin(fut) } } @@ -4584,14 +3283,8 @@ pub mod node_service_server { let method = ListVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4600,23 +3293,12 @@ pub mod node_service_server { "/node_service.NodeService/StatVolume" => { #[allow(non_camel_case_types)] struct StatVolumeSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for StatVolumeSvc { + impl tonic::server::UnaryService for StatVolumeSvc { type Response = super::StatVolumeResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::stat_volume(&inner, request).await - }; + let fut = async move { ::stat_volume(&inner, request).await }; Box::pin(fut) } } @@ -4629,14 +3311,8 @@ pub mod node_service_server { let method = StatVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4645,23 +3321,12 @@ pub mod node_service_server { "/node_service.NodeService/DeletePaths" => { #[allow(non_camel_case_types)] struct DeletePathsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeletePathsSvc { + impl tonic::server::UnaryService for DeletePathsSvc { type Response = super::DeletePathsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_paths(&inner, request).await - }; + let fut = async move { ::delete_paths(&inner, request).await }; Box::pin(fut) } } @@ -4674,14 +3339,8 @@ pub mod node_service_server { let method = DeletePathsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4690,23 +3349,12 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetadata" => { #[allow(non_camel_case_types)] struct UpdateMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for UpdateMetadataSvc { + impl tonic::server::UnaryService for UpdateMetadataSvc { type Response = super::UpdateMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::update_metadata(&inner, request).await - }; + let fut = async move { ::update_metadata(&inner, request).await }; Box::pin(fut) } } @@ -4719,14 +3367,8 @@ pub mod node_service_server { let method = UpdateMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4735,23 +3377,12 @@ pub mod node_service_server { "/node_service.NodeService/WriteMetadata" => { #[allow(non_camel_case_types)] struct WriteMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for WriteMetadataSvc { + impl tonic::server::UnaryService for WriteMetadataSvc { type Response = super::WriteMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::write_metadata(&inner, request).await - }; + let fut = async move { ::write_metadata(&inner, request).await }; Box::pin(fut) } } @@ -4764,14 +3395,8 @@ pub mod node_service_server { let method = WriteMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4780,23 +3405,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadVersion" => { #[allow(non_camel_case_types)] struct ReadVersionSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadVersionSvc { + impl tonic::server::UnaryService for ReadVersionSvc { type Response = super::ReadVersionResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_version(&inner, request).await - }; + let fut = async move { ::read_version(&inner, request).await }; Box::pin(fut) } } @@ -4809,14 +3423,8 @@ pub mod node_service_server { let method = ReadVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4825,23 +3433,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadXL" => { #[allow(non_camel_case_types)] struct ReadXLSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadXLSvc { + impl tonic::server::UnaryService for ReadXLSvc { type Response = super::ReadXlResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_xl(&inner, request).await - }; + let fut = async move { ::read_xl(&inner, request).await }; Box::pin(fut) } } @@ -4854,14 +3451,8 @@ pub mod node_service_server { let method = ReadXLSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4870,23 +3461,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersion" => { #[allow(non_camel_case_types)] struct DeleteVersionSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteVersionSvc { + impl tonic::server::UnaryService for DeleteVersionSvc { type Response = super::DeleteVersionResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_version(&inner, request).await - }; + let fut = async move { ::delete_version(&inner, request).await }; Box::pin(fut) } } @@ -4899,14 +3479,8 @@ pub mod node_service_server { let method = DeleteVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4915,23 +3489,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersions" => { #[allow(non_camel_case_types)] struct DeleteVersionsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteVersionsSvc { + impl tonic::server::UnaryService for DeleteVersionsSvc { type Response = super::DeleteVersionsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_versions(&inner, request).await - }; + let fut = async move { ::delete_versions(&inner, request).await }; Box::pin(fut) } } @@ -4944,14 +3507,8 @@ pub mod node_service_server { let method = DeleteVersionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4960,23 +3517,12 @@ pub mod node_service_server { "/node_service.NodeService/ReadMultiple" => { #[allow(non_camel_case_types)] struct ReadMultipleSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReadMultipleSvc { + impl tonic::server::UnaryService for ReadMultipleSvc { type Response = super::ReadMultipleResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::read_multiple(&inner, request).await - }; + let fut = async move { ::read_multiple(&inner, request).await }; Box::pin(fut) } } @@ -4989,14 +3535,8 @@ pub mod node_service_server { let method = ReadMultipleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5005,23 +3545,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVolume" => { #[allow(non_camel_case_types)] struct DeleteVolumeSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteVolumeSvc { + impl tonic::server::UnaryService for DeleteVolumeSvc { type Response = super::DeleteVolumeResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_volume(&inner, request).await - }; + let fut = async move { ::delete_volume(&inner, request).await }; Box::pin(fut) } } @@ -5034,14 +3563,8 @@ pub mod node_service_server { let method = DeleteVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5050,23 +3573,12 @@ pub mod node_service_server { "/node_service.NodeService/DiskInfo" => { #[allow(non_camel_case_types)] struct DiskInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DiskInfoSvc { + impl tonic::server::UnaryService for DiskInfoSvc { type Response = super::DiskInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::disk_info(&inner, request).await - }; + let fut = async move { ::disk_info(&inner, request).await }; Box::pin(fut) } } @@ -5079,14 +3591,8 @@ pub mod node_service_server { let method = DiskInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5095,26 +3601,13 @@ pub mod node_service_server { "/node_service.NodeService/NsScanner" => { #[allow(non_camel_case_types)] struct NsScannerSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::StreamingService - for NsScannerSvc { + impl tonic::server::StreamingService for NsScannerSvc { type Response = super::NsScannerResponse; type ResponseStream = T::NsScannerStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request>) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::ns_scanner(&inner, request).await - }; + let fut = async move { ::ns_scanner(&inner, request).await }; Box::pin(fut) } } @@ -5127,14 +3620,8 @@ pub mod node_service_server { let method = NsScannerSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -5143,23 +3630,12 @@ pub mod node_service_server { "/node_service.NodeService/Lock" => { #[allow(non_camel_case_types)] struct LockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LockSvc { + impl tonic::server::UnaryService for LockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::lock(&inner, request).await - }; + let fut = async move { ::lock(&inner, request).await }; Box::pin(fut) } } @@ -5172,14 +3648,8 @@ pub mod node_service_server { let method = LockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5188,23 +3658,12 @@ pub mod node_service_server { "/node_service.NodeService/UnLock" => { #[allow(non_camel_case_types)] struct UnLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for UnLockSvc { + impl tonic::server::UnaryService for UnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::un_lock(&inner, request).await - }; + let fut = async move { ::un_lock(&inner, request).await }; Box::pin(fut) } } @@ -5217,14 +3676,8 @@ pub mod node_service_server { let method = UnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5233,23 +3686,12 @@ pub mod node_service_server { "/node_service.NodeService/RLock" => { #[allow(non_camel_case_types)] struct RLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RLockSvc { + impl tonic::server::UnaryService for RLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::r_lock(&inner, request).await - }; + let fut = async move { ::r_lock(&inner, request).await }; Box::pin(fut) } } @@ -5262,14 +3704,8 @@ pub mod node_service_server { let method = RLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5278,23 +3714,12 @@ pub mod node_service_server { "/node_service.NodeService/RUnLock" => { #[allow(non_camel_case_types)] struct RUnLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RUnLockSvc { + impl tonic::server::UnaryService for RUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::r_un_lock(&inner, request).await - }; + let fut = async move { ::r_un_lock(&inner, request).await }; Box::pin(fut) } } @@ -5307,14 +3732,8 @@ pub mod node_service_server { let method = RUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5323,23 +3742,12 @@ pub mod node_service_server { "/node_service.NodeService/ForceUnLock" => { #[allow(non_camel_case_types)] struct ForceUnLockSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ForceUnLockSvc { + impl tonic::server::UnaryService for ForceUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::force_un_lock(&inner, request).await - }; + let fut = async move { ::force_un_lock(&inner, request).await }; Box::pin(fut) } } @@ -5352,14 +3760,8 @@ pub mod node_service_server { let method = ForceUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5368,23 +3770,12 @@ pub mod node_service_server { "/node_service.NodeService/Refresh" => { #[allow(non_camel_case_types)] struct RefreshSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for RefreshSvc { + impl tonic::server::UnaryService for RefreshSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::refresh(&inner, request).await - }; + let fut = async move { ::refresh(&inner, request).await }; Box::pin(fut) } } @@ -5397,14 +3788,8 @@ pub mod node_service_server { let method = RefreshSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5413,24 +3798,12 @@ pub mod node_service_server { "/node_service.NodeService/LocalStorageInfo" => { #[allow(non_camel_case_types)] struct LocalStorageInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LocalStorageInfoSvc { + impl tonic::server::UnaryService for LocalStorageInfoSvc { type Response = super::LocalStorageInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::local_storage_info(&inner, request) - .await - }; + let fut = async move { ::local_storage_info(&inner, request).await }; Box::pin(fut) } } @@ -5443,14 +3816,8 @@ pub mod node_service_server { let method = LocalStorageInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5459,23 +3826,12 @@ pub mod node_service_server { "/node_service.NodeService/ServerInfo" => { #[allow(non_camel_case_types)] struct ServerInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ServerInfoSvc { + impl tonic::server::UnaryService for ServerInfoSvc { type Response = super::ServerInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::server_info(&inner, request).await - }; + let fut = async move { ::server_info(&inner, request).await }; Box::pin(fut) } } @@ -5488,14 +3844,8 @@ pub mod node_service_server { let method = ServerInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5504,23 +3854,12 @@ pub mod node_service_server { "/node_service.NodeService/GetCpus" => { #[allow(non_camel_case_types)] struct GetCpusSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetCpusSvc { + impl tonic::server::UnaryService for GetCpusSvc { type Response = super::GetCpusResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_cpus(&inner, request).await - }; + let fut = async move { ::get_cpus(&inner, request).await }; Box::pin(fut) } } @@ -5533,14 +3872,8 @@ pub mod node_service_server { let method = GetCpusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5549,23 +3882,12 @@ pub mod node_service_server { "/node_service.NodeService/GetNetInfo" => { #[allow(non_camel_case_types)] struct GetNetInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetNetInfoSvc { + impl tonic::server::UnaryService for GetNetInfoSvc { type Response = super::GetNetInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_net_info(&inner, request).await - }; + let fut = async move { ::get_net_info(&inner, request).await }; Box::pin(fut) } } @@ -5578,14 +3900,8 @@ pub mod node_service_server { let method = GetNetInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5594,23 +3910,12 @@ pub mod node_service_server { "/node_service.NodeService/GetPartitions" => { #[allow(non_camel_case_types)] struct GetPartitionsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetPartitionsSvc { + impl tonic::server::UnaryService for GetPartitionsSvc { type Response = super::GetPartitionsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_partitions(&inner, request).await - }; + let fut = async move { ::get_partitions(&inner, request).await }; Box::pin(fut) } } @@ -5623,14 +3928,8 @@ pub mod node_service_server { let method = GetPartitionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5639,23 +3938,12 @@ pub mod node_service_server { "/node_service.NodeService/GetOsInfo" => { #[allow(non_camel_case_types)] struct GetOsInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetOsInfoSvc { + impl tonic::server::UnaryService for GetOsInfoSvc { type Response = super::GetOsInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_os_info(&inner, request).await - }; + let fut = async move { ::get_os_info(&inner, request).await }; Box::pin(fut) } } @@ -5668,14 +3956,8 @@ pub mod node_service_server { let method = GetOsInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5684,23 +3966,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSELinuxInfo" => { #[allow(non_camel_case_types)] struct GetSELinuxInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSELinuxInfoSvc { + impl tonic::server::UnaryService for GetSELinuxInfoSvc { type Response = super::GetSeLinuxInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_se_linux_info(&inner, request).await - }; + let fut = async move { ::get_se_linux_info(&inner, request).await }; Box::pin(fut) } } @@ -5713,14 +3984,8 @@ pub mod node_service_server { let method = GetSELinuxInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5729,23 +3994,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSysConfig" => { #[allow(non_camel_case_types)] struct GetSysConfigSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSysConfigSvc { + impl tonic::server::UnaryService for GetSysConfigSvc { type Response = super::GetSysConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_sys_config(&inner, request).await - }; + let fut = async move { ::get_sys_config(&inner, request).await }; Box::pin(fut) } } @@ -5758,14 +4012,8 @@ pub mod node_service_server { let method = GetSysConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5774,23 +4022,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSysErrors" => { #[allow(non_camel_case_types)] struct GetSysErrorsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSysErrorsSvc { + impl tonic::server::UnaryService for GetSysErrorsSvc { type Response = super::GetSysErrorsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_sys_errors(&inner, request).await - }; + let fut = async move { ::get_sys_errors(&inner, request).await }; Box::pin(fut) } } @@ -5803,14 +4040,8 @@ pub mod node_service_server { let method = GetSysErrorsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5819,23 +4050,12 @@ pub mod node_service_server { "/node_service.NodeService/GetMemInfo" => { #[allow(non_camel_case_types)] struct GetMemInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetMemInfoSvc { + impl tonic::server::UnaryService for GetMemInfoSvc { type Response = super::GetMemInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_mem_info(&inner, request).await - }; + let fut = async move { ::get_mem_info(&inner, request).await }; Box::pin(fut) } } @@ -5848,14 +4068,8 @@ pub mod node_service_server { let method = GetMemInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5864,23 +4078,12 @@ pub mod node_service_server { "/node_service.NodeService/GetMetrics" => { #[allow(non_camel_case_types)] struct GetMetricsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetMetricsSvc { + impl tonic::server::UnaryService for GetMetricsSvc { type Response = super::GetMetricsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_metrics(&inner, request).await - }; + let fut = async move { ::get_metrics(&inner, request).await }; Box::pin(fut) } } @@ -5893,14 +4096,8 @@ pub mod node_service_server { let method = GetMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5909,23 +4106,12 @@ pub mod node_service_server { "/node_service.NodeService/GetProcInfo" => { #[allow(non_camel_case_types)] struct GetProcInfoSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetProcInfoSvc { + impl tonic::server::UnaryService for GetProcInfoSvc { type Response = super::GetProcInfoResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_proc_info(&inner, request).await - }; + let fut = async move { ::get_proc_info(&inner, request).await }; Box::pin(fut) } } @@ -5938,14 +4124,8 @@ pub mod node_service_server { let method = GetProcInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5954,23 +4134,12 @@ pub mod node_service_server { "/node_service.NodeService/StartProfiling" => { #[allow(non_camel_case_types)] struct StartProfilingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for StartProfilingSvc { + impl tonic::server::UnaryService for StartProfilingSvc { type Response = super::StartProfilingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::start_profiling(&inner, request).await - }; + let fut = async move { ::start_profiling(&inner, request).await }; Box::pin(fut) } } @@ -5983,14 +4152,8 @@ pub mod node_service_server { let method = StartProfilingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -5999,24 +4162,12 @@ pub mod node_service_server { "/node_service.NodeService/DownloadProfileData" => { #[allow(non_camel_case_types)] struct DownloadProfileDataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DownloadProfileDataSvc { + impl tonic::server::UnaryService for DownloadProfileDataSvc { type Response = super::DownloadProfileDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::download_profile_data(&inner, request) - .await - }; + let fut = async move { ::download_profile_data(&inner, request).await }; Box::pin(fut) } } @@ -6029,14 +4180,8 @@ pub mod node_service_server { let method = DownloadProfileDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6045,23 +4190,12 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketStats" => { #[allow(non_camel_case_types)] struct GetBucketStatsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetBucketStatsSvc { + impl tonic::server::UnaryService for GetBucketStatsSvc { type Response = super::GetBucketStatsDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_bucket_stats(&inner, request).await - }; + let fut = async move { ::get_bucket_stats(&inner, request).await }; Box::pin(fut) } } @@ -6074,14 +4208,8 @@ pub mod node_service_server { let method = GetBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6090,23 +4218,12 @@ pub mod node_service_server { "/node_service.NodeService/GetSRMetrics" => { #[allow(non_camel_case_types)] struct GetSRMetricsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetSRMetricsSvc { + impl tonic::server::UnaryService for GetSRMetricsSvc { type Response = super::GetSrMetricsDataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_sr_metrics(&inner, request).await - }; + let fut = async move { ::get_sr_metrics(&inner, request).await }; Box::pin(fut) } } @@ -6119,14 +4236,8 @@ pub mod node_service_server { let method = GetSRMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6135,24 +4246,12 @@ pub mod node_service_server { "/node_service.NodeService/GetAllBucketStats" => { #[allow(non_camel_case_types)] struct GetAllBucketStatsSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetAllBucketStatsSvc { + impl tonic::server::UnaryService for GetAllBucketStatsSvc { type Response = super::GetAllBucketStatsResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_all_bucket_stats(&inner, request) - .await - }; + let fut = async move { ::get_all_bucket_stats(&inner, request).await }; Box::pin(fut) } } @@ -6165,14 +4264,8 @@ pub mod node_service_server { let method = GetAllBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6181,24 +4274,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadBucketMetadata" => { #[allow(non_camel_case_types)] struct LoadBucketMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadBucketMetadataSvc { + impl tonic::server::UnaryService for LoadBucketMetadataSvc { type Response = super::LoadBucketMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_bucket_metadata(&inner, request) - .await - }; + let fut = async move { ::load_bucket_metadata(&inner, request).await }; Box::pin(fut) } } @@ -6211,14 +4292,8 @@ pub mod node_service_server { let method = LoadBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6227,24 +4302,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucketMetadata" => { #[allow(non_camel_case_types)] struct DeleteBucketMetadataSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteBucketMetadataSvc { + impl tonic::server::UnaryService for DeleteBucketMetadataSvc { type Response = super::DeleteBucketMetadataResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_bucket_metadata(&inner, request) - .await - }; + let fut = async move { ::delete_bucket_metadata(&inner, request).await }; Box::pin(fut) } } @@ -6257,14 +4320,8 @@ pub mod node_service_server { let method = DeleteBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6273,23 +4330,12 @@ pub mod node_service_server { "/node_service.NodeService/DeletePolicy" => { #[allow(non_camel_case_types)] struct DeletePolicySvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeletePolicySvc { + impl tonic::server::UnaryService for DeletePolicySvc { type Response = super::DeletePolicyResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_policy(&inner, request).await - }; + let fut = async move { ::delete_policy(&inner, request).await }; Box::pin(fut) } } @@ -6302,14 +4348,8 @@ pub mod node_service_server { let method = DeletePolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6318,23 +4358,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicy" => { #[allow(non_camel_case_types)] struct LoadPolicySvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadPolicySvc { + impl tonic::server::UnaryService for LoadPolicySvc { type Response = super::LoadPolicyResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_policy(&inner, request).await - }; + let fut = async move { ::load_policy(&inner, request).await }; Box::pin(fut) } } @@ -6347,14 +4376,8 @@ pub mod node_service_server { let method = LoadPolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6363,24 +4386,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicyMapping" => { #[allow(non_camel_case_types)] struct LoadPolicyMappingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadPolicyMappingSvc { + impl tonic::server::UnaryService for LoadPolicyMappingSvc { type Response = super::LoadPolicyMappingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_policy_mapping(&inner, request) - .await - }; + let fut = async move { ::load_policy_mapping(&inner, request).await }; Box::pin(fut) } } @@ -6393,14 +4404,8 @@ pub mod node_service_server { let method = LoadPolicyMappingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6409,23 +4414,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteUser" => { #[allow(non_camel_case_types)] struct DeleteUserSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteUserSvc { + impl tonic::server::UnaryService for DeleteUserSvc { type Response = super::DeleteUserResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_user(&inner, request).await - }; + let fut = async move { ::delete_user(&inner, request).await }; Box::pin(fut) } } @@ -6438,14 +4432,8 @@ pub mod node_service_server { let method = DeleteUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6454,24 +4442,12 @@ pub mod node_service_server { "/node_service.NodeService/DeleteServiceAccount" => { #[allow(non_camel_case_types)] struct DeleteServiceAccountSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for DeleteServiceAccountSvc { + impl tonic::server::UnaryService for DeleteServiceAccountSvc { type Response = super::DeleteServiceAccountResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::delete_service_account(&inner, request) - .await - }; + let fut = async move { ::delete_service_account(&inner, request).await }; Box::pin(fut) } } @@ -6484,14 +4460,8 @@ pub mod node_service_server { let method = DeleteServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6500,23 +4470,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadUser" => { #[allow(non_camel_case_types)] struct LoadUserSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadUserSvc { + impl tonic::server::UnaryService for LoadUserSvc { type Response = super::LoadUserResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_user(&inner, request).await - }; + let fut = async move { ::load_user(&inner, request).await }; Box::pin(fut) } } @@ -6529,14 +4488,8 @@ pub mod node_service_server { let method = LoadUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6545,24 +4498,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadServiceAccount" => { #[allow(non_camel_case_types)] struct LoadServiceAccountSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadServiceAccountSvc { + impl tonic::server::UnaryService for LoadServiceAccountSvc { type Response = super::LoadServiceAccountResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_service_account(&inner, request) - .await - }; + let fut = async move { ::load_service_account(&inner, request).await }; Box::pin(fut) } } @@ -6575,14 +4516,8 @@ pub mod node_service_server { let method = LoadServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6591,23 +4526,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadGroup" => { #[allow(non_camel_case_types)] struct LoadGroupSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadGroupSvc { + impl tonic::server::UnaryService for LoadGroupSvc { type Response = super::LoadGroupResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_group(&inner, request).await - }; + let fut = async move { ::load_group(&inner, request).await }; Box::pin(fut) } } @@ -6620,14 +4544,8 @@ pub mod node_service_server { let method = LoadGroupSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6636,30 +4554,14 @@ pub mod node_service_server { "/node_service.NodeService/ReloadSiteReplicationConfig" => { #[allow(non_camel_case_types)] struct ReloadSiteReplicationConfigSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService< - super::ReloadSiteReplicationConfigRequest, - > for ReloadSiteReplicationConfigSvc { + impl tonic::server::UnaryService + for ReloadSiteReplicationConfigSvc + { type Response = super::ReloadSiteReplicationConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::ReloadSiteReplicationConfigRequest, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::reload_site_replication_config( - &inner, - request, - ) - .await - }; + let fut = async move { ::reload_site_replication_config(&inner, request).await }; Box::pin(fut) } } @@ -6672,14 +4574,8 @@ pub mod node_service_server { let method = ReloadSiteReplicationConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6688,23 +4584,12 @@ pub mod node_service_server { "/node_service.NodeService/SignalService" => { #[allow(non_camel_case_types)] struct SignalServiceSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for SignalServiceSvc { + impl tonic::server::UnaryService for SignalServiceSvc { type Response = super::SignalServiceResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::signal_service(&inner, request).await - }; + let fut = async move { ::signal_service(&inner, request).await }; Box::pin(fut) } } @@ -6717,14 +4602,8 @@ pub mod node_service_server { let method = SignalServiceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6733,24 +4612,12 @@ pub mod node_service_server { "/node_service.NodeService/BackgroundHealStatus" => { #[allow(non_camel_case_types)] struct BackgroundHealStatusSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for BackgroundHealStatusSvc { + impl tonic::server::UnaryService for BackgroundHealStatusSvc { type Response = super::BackgroundHealStatusResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::background_heal_status(&inner, request) - .await - }; + let fut = async move { ::background_heal_status(&inner, request).await }; Box::pin(fut) } } @@ -6763,14 +4630,8 @@ pub mod node_service_server { let method = BackgroundHealStatusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6779,24 +4640,12 @@ pub mod node_service_server { "/node_service.NodeService/GetMetacacheListing" => { #[allow(non_camel_case_types)] struct GetMetacacheListingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for GetMetacacheListingSvc { + impl tonic::server::UnaryService for GetMetacacheListingSvc { type Response = super::GetMetacacheListingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::get_metacache_listing(&inner, request) - .await - }; + let fut = async move { ::get_metacache_listing(&inner, request).await }; Box::pin(fut) } } @@ -6809,14 +4658,8 @@ pub mod node_service_server { let method = GetMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6825,27 +4668,12 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetacacheListing" => { #[allow(non_camel_case_types)] struct UpdateMetacacheListingSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for UpdateMetacacheListingSvc { + impl tonic::server::UnaryService for UpdateMetacacheListingSvc { type Response = super::UpdateMetacacheListingResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::update_metacache_listing( - &inner, - request, - ) - .await - }; + let fut = async move { ::update_metacache_listing(&inner, request).await }; Box::pin(fut) } } @@ -6858,14 +4686,8 @@ pub mod node_service_server { let method = UpdateMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6874,23 +4696,12 @@ pub mod node_service_server { "/node_service.NodeService/ReloadPoolMeta" => { #[allow(non_camel_case_types)] struct ReloadPoolMetaSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for ReloadPoolMetaSvc { + impl tonic::server::UnaryService for ReloadPoolMetaSvc { type Response = super::ReloadPoolMetaResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::reload_pool_meta(&inner, request).await - }; + let fut = async move { ::reload_pool_meta(&inner, request).await }; Box::pin(fut) } } @@ -6903,14 +4714,8 @@ pub mod node_service_server { let method = ReloadPoolMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6919,23 +4724,12 @@ pub mod node_service_server { "/node_service.NodeService/StopRebalance" => { #[allow(non_camel_case_types)] struct StopRebalanceSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for StopRebalanceSvc { + impl tonic::server::UnaryService for StopRebalanceSvc { type Response = super::StopRebalanceResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::stop_rebalance(&inner, request).await - }; + let fut = async move { ::stop_rebalance(&inner, request).await }; Box::pin(fut) } } @@ -6948,14 +4742,8 @@ pub mod node_service_server { let method = StopRebalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -6964,24 +4752,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadRebalanceMeta" => { #[allow(non_camel_case_types)] struct LoadRebalanceMetaSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadRebalanceMetaSvc { + impl tonic::server::UnaryService for LoadRebalanceMetaSvc { type Response = super::LoadRebalanceMetaResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_rebalance_meta(&inner, request) - .await - }; + let fut = async move { ::load_rebalance_meta(&inner, request).await }; Box::pin(fut) } } @@ -6994,14 +4770,8 @@ pub mod node_service_server { let method = LoadRebalanceMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; @@ -7010,29 +4780,12 @@ pub mod node_service_server { "/node_service.NodeService/LoadTransitionTierConfig" => { #[allow(non_camel_case_types)] struct LoadTransitionTierConfigSvc(pub Arc); - impl< - T: NodeService, - > tonic::server::UnaryService - for LoadTransitionTierConfigSvc { + impl tonic::server::UnaryService for LoadTransitionTierConfigSvc { type Response = super::LoadTransitionTierConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::LoadTransitionTierConfigRequest, - >, - ) -> Self::Future { + type Future = BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { - ::load_transition_tier_config( - &inner, - request, - ) - .await - }; + let fut = async move { ::load_transition_tier_config(&inner, request).await }; Box::pin(fut) } } @@ -7045,36 +4798,20 @@ pub mod node_service_server { let method = LoadTransitionTierConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); + .apply_compression_config(accept_compression_encodings, send_compression_encodings) + .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } - _ => { - Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers - .insert( - tonic::Status::GRPC_STATUS, - (tonic::Code::Unimplemented as i32).into(), - ); - headers - .insert( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ); - Ok(response) - }) - } + _ => Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers.insert(tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into()); + headers.insert(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE); + Ok(response) + }), } } } diff --git a/common/protos/src/node.proto b/common/protos/src/node.proto index 924f4695e..4ca0f6c95 100644 --- a/common/protos/src/node.proto +++ b/common/protos/src/node.proto @@ -209,7 +209,7 @@ message WalkDirRequest { message WalkDirResponse { bool success = 1; - repeated string meta_cache_entry = 2; + string meta_cache_entry = 2; optional string error_info = 3; } @@ -757,7 +757,7 @@ service NodeService { // rpc Append(AppendRequest) returns (AppendResponse) {}; rpc ReadAt(stream ReadAtRequest) returns (stream ReadAtResponse) {}; rpc ListDir(ListDirRequest) returns (ListDirResponse) {}; - rpc WalkDir(WalkDirRequest) returns (WalkDirResponse) {}; + rpc WalkDir(WalkDirRequest) returns (stream WalkDirResponse) {}; rpc RenameData(RenameDataRequest) returns (RenameDataResponse) {}; rpc MakeVolumes(MakeVolumesRequest) returns (MakeVolumesResponse) {}; rpc MakeVolume(MakeVolumeRequest) returns (MakeVolumeResponse) {}; diff --git a/e2e_test/src/reliant/node_interact_test.rs b/e2e_test/src/reliant/node_interact_test.rs index 16b333a3b..7f9128701 100644 --- a/e2e_test/src/reliant/node_interact_test.rs +++ b/e2e_test/src/reliant/node_interact_test.rs @@ -1,6 +1,8 @@ #![cfg(test)] -use ecstore::disk::VolumeInfo; +use ecstore::disk::{MetaCacheEntry, VolumeInfo, WalkDirOptions}; +use ecstore::metacache::writer::MetacacheWriter; +use protos::proto_gen::node_service::WalkDirRequest; use protos::{ models::{PingBody, PingBodyBuilder}, node_service_time_out_client, @@ -11,6 +13,10 @@ use protos::{ use rmp_serde::Deserializer; use serde::Deserialize; use std::{error::Error, io::Cursor}; +use tokio::io::AsyncWrite; +use tokio::sync::mpsc; +use tonic::codegen::tokio_stream::wrappers::ReceiverStream; +use tonic::codegen::tokio_stream::StreamExt; use tonic::Request; const CLUSTER_ADDR: &str = "http://localhost:9000"; @@ -88,6 +94,44 @@ async fn list_volumes() -> Result<(), Box> { Ok(()) } +#[tokio::test] +async fn walk_dir() -> Result<(), Box> { + println!("walk_dir"); + // TODO: use writer + let opts = WalkDirOptions { + bucket: "dandan".to_owned(), + base_dir: "".to_owned(), + recursive: true, + ..Default::default() + }; + let (rd, mut wr) = tokio::io::duplex(1024); + let mut out = MetacacheWriter::new(&mut wr); + let walk_dir_options = serde_json::to_string(&opts)?; + let mut client = node_service_time_out_client(&CLUSTER_ADDR.to_string()).await?; + let request = Request::new(WalkDirRequest { + disk: "data".to_string(), + walk_dir_options, + }); + let mut response = client.walk_dir(request).await?.into_inner(); + + loop { + match response.next().await { + Some(Ok(resp)) => { + if !resp.success { + println!("{}", resp.error_info.unwrap_or("".to_string())); + } + let entry = serde_json::from_str::(&resp.meta_cache_entry) + .map_err(|e| Err(ecstore::error::Error::from_string(format!("Unexpected response: {:?}", response))))?; + out.write_obj(&entry)?; + } + None => break, + _ => println!("Unexpected response: {:?}", response), + } + } + + Ok(()) +} + #[tokio::test] async fn read_all() -> Result<(), Box> { let mut client = node_service_time_out_client(&CLUSTER_ADDR.to_string()).await?; diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 1e7171635..67caf5a1a 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -24,6 +24,7 @@ use super::{ FileInfoVersions, FileReader, FileWriter, ReadMultipleReq, ReadMultipleResp, ReadOptions, RemoteFileReader, RemoteFileWriter, RenameDataResp, UpdateMetadataOpts, VolumeInfo, WalkDirOptions, }; +use crate::metacache::writer::MetacacheWriter; use crate::{ disk::error::DiskError, error::{Error, Result}, @@ -351,32 +352,36 @@ impl DiskAPI for RemoteDisk { } // FIXME: TODO: use writer - async fn walk_dir(&self, _opts: WalkDirOptions, _wr: &mut W) -> Result<()> { + async fn walk_dir(&self, opts: WalkDirOptions, wr: &mut W) -> Result<()> { info!("walk_dir"); - // TODO: use writer - unimplemented!() - // let walk_dir_options = serde_json::to_string(&opts)?; - // let mut client = node_service_time_out_client(&self.addr) - // .await - // .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; - // let request = Request::new(WalkDirRequest { - // disk: self.endpoint.to_string(), - // walk_dir_options, - // }); + let mut wr = wr; + let mut out = MetacacheWriter::new(&mut wr); + let walk_dir_options = serde_json::to_string(&opts)?; + let mut client = node_service_time_out_client(&self.addr) + .await + .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; + let request = Request::new(WalkDirRequest { + disk: self.endpoint.to_string(), + walk_dir_options, + }); + let mut response = client.walk_dir(request).await?.into_inner(); - // let response = client.walk_dir(request).await?.into_inner(); + loop { + match response.next().await { + Some(Ok(resp)) => { + if !resp.success { + return Err(Error::from_string(resp.error_info.unwrap_or("".to_string()))); + } + let entry = serde_json::from_str::(&resp.meta_cache_entry) + .map_err(|e| Error::from_string(format!("Unexpected response: {:?}", response)))?; + out.write_obj(&entry).await?; + } + None => break, + _ => return Err(Error::from_string(format!("Unexpected response: {:?}", response))), + } + } - // if !response.success { - // return Err(Error::from_string(response.error_info.unwrap_or("".to_string()))); - // } - - // let entries = response - // .meta_cache_entry - // .into_iter() - // .filter_map(|json_str| serde_json::from_str::(&json_str).ok()) - // .collect(); - - // Ok(entries) + Ok(()) } async fn rename_data( diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index d29ace0a4..63ae2489c 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -24,9 +24,12 @@ use ecstore::{ store_api::{BucketOptions, DeleteBucketOptions, FileInfo, MakeBucketOptions, StorageAPI}, }; use futures::{Stream, StreamExt}; +use futures_util::future::join_all; use lock::{lock_args::LockArgs, Locker, GLOBAL_LOCAL_SERVER}; use common::globals::GLOBAL_Local_Node_Name; +use ecstore::disk::error::is_err_eof; +use ecstore::metacache::writer::MetacacheReader; use madmin::health::{ get_cpus, get_mem_info, get_os_info, get_partitions, get_proc_info, get_sys_config, get_sys_errors, get_sys_services, }; @@ -37,6 +40,7 @@ use protos::{ }; use rmp_serde::{Deserializer, Serializer}; use serde::{Deserialize, Serialize}; +use tokio::spawn; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; use tonic::{Request, Response, Status, Streaming}; @@ -730,46 +734,73 @@ impl Node for NodeService { } } - async fn walk_dir(&self, request: Request) -> Result, Status> { - // TODO: use writer - unimplemented!() - // let request = request.into_inner(); - // if let Some(disk) = self.find_disk(&request.disk).await { - // let opts = match serde_json::from_str::(&request.walk_dir_options) { - // Ok(options) => options, - // Err(_) => { - // return Ok(tonic::Response::new(WalkDirResponse { - // success: false, - // meta_cache_entry: Vec::new(), - // error_info: Some("can not decode DeleteOptions".to_string()), - // })); - // } - // }; - // match disk.walk_dir(opts, &mut ecstore::io::Writer::NotUse).await { - // Ok(entries) => { - // let entries = entries - // .into_iter() - // .filter_map(|entry| serde_json::to_string(&entry).ok()) - // .collect(); - // Ok(tonic::Response::new(WalkDirResponse { - // success: true, - // meta_cache_entry: entries, - // error_info: None, - // })) - // } - // Err(err) => Ok(tonic::Response::new(WalkDirResponse { - // success: false, - // meta_cache_entry: Vec::new(), - // error_info: Some(err.to_string()), - // })), - // } - // } else { - // Ok(tonic::Response::new(WalkDirResponse { - // success: false, - // meta_cache_entry: Vec::new(), - // error_info: Some("can not find disk".to_string()), - // })) - // } + type WalkDirStream = ResponseStream; + async fn walk_dir(&self, request: Request) -> Result, Status> { + info!("walk_dir"); + let request = request.into_inner(); + let (tx, rx) = mpsc::channel(128); + if let Some(disk) = self.find_disk(&request.disk).await { + let opts = match serde_json::from_str::(&request.walk_dir_options) { + Ok(options) => options, + Err(_) => { + return Err(Status::invalid_argument("invalid WalkDirOptions")); + } + }; + spawn(async { + let (rd, mut wr) = tokio::io::duplex(64); + let job1 = spawn(async move { + if let Err(err) = disk.walk_dir(opts, &mut wr).await { + println!("walk_dir err {:?}", err); + } + }); + let job2 = spawn(async move { + let mut reader = MetacacheReader::new(rd); + + loop { + match reader.peek().await { + Ok(res) => { + if let Some(info) = res { + match serde_json::to_string(&info) { + Ok(meta_cache_entry) => tx + .send(Ok(WalkDirResponse { + success: true, + meta_cache_entry, + error_info: None, + })) + .await + .expect("working rx"), + Err(e) => tx + .send(Ok(WalkDirResponse { + success: false, + meta_cache_entry: "".to_string(), + error_info: Some(e.to_string()), + })) + .await + .expect("working rx"), + } + } else { + break; + } + } + Err(err) => { + if is_err_eof(&err) { + break; + } + + println!("get err {:?}", err); + break; + } + } + } + }); + join_all(vec![job1, job2]).await; + }); + } else { + return Err(Status::invalid_argument("invalid disk")); + } + + let out_stream = ReceiverStream::new(rx); + Ok(tonic::Response::new(Box::pin(out_stream))) } async fn rename_data(&self, request: Request) -> Result, Status> { From c078a4e04cd46275a7604d7bcc6678c63e7ef352 Mon Sep 17 00:00:00 2001 From: junxiang Mu <1948535941@qq.com> Date: Mon, 23 Dec 2024 16:21:27 +0800 Subject: [PATCH 69/77] add test case Signed-off-by: junxiang Mu <1948535941@qq.com> --- Cargo.lock | 1 + e2e_test/Cargo.toml | 1 + e2e_test/src/reliant/node_interact_test.rs | 49 +++++++++++++++------- ecstore/src/disk/remote.rs | 2 +- rustfs/src/grpc.rs | 2 +- 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d8a9643e..5b1f4da8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -762,6 +762,7 @@ version = "0.0.1" dependencies = [ "ecstore", "flatbuffers", + "futures", "lazy_static", "lock", "madmin", diff --git a/e2e_test/Cargo.toml b/e2e_test/Cargo.toml index 58974bad4..0a8d98d5f 100644 --- a/e2e_test/Cargo.toml +++ b/e2e_test/Cargo.toml @@ -14,6 +14,7 @@ workspace = true [dependencies] ecstore.workspace = true flatbuffers.workspace = true +futures.workspace = true lazy_static.workspace = true lock.workspace = true protos.workspace = true diff --git a/e2e_test/src/reliant/node_interact_test.rs b/e2e_test/src/reliant/node_interact_test.rs index 7f9128701..cc81204dd 100644 --- a/e2e_test/src/reliant/node_interact_test.rs +++ b/e2e_test/src/reliant/node_interact_test.rs @@ -1,7 +1,8 @@ #![cfg(test)] use ecstore::disk::{MetaCacheEntry, VolumeInfo, WalkDirOptions}; -use ecstore::metacache::writer::MetacacheWriter; +use ecstore::metacache::writer::{MetacacheReader, MetacacheWriter}; +use futures::future::join_all; use protos::proto_gen::node_service::WalkDirRequest; use protos::{ models::{PingBody, PingBodyBuilder}, @@ -14,6 +15,7 @@ use rmp_serde::Deserializer; use serde::Deserialize; use std::{error::Error, io::Cursor}; use tokio::io::AsyncWrite; +use tokio::spawn; use tokio::sync::mpsc; use tonic::codegen::tokio_stream::wrappers::ReceiverStream; use tonic::codegen::tokio_stream::StreamExt; @@ -95,7 +97,7 @@ async fn list_volumes() -> Result<(), Box> { } #[tokio::test] -async fn walk_dir() -> Result<(), Box> { +async fn walk_dir() -> Result<(), Box> { println!("walk_dir"); // TODO: use writer let opts = WalkDirOptions { @@ -105,30 +107,47 @@ async fn walk_dir() -> Result<(), Box> ..Default::default() }; let (rd, mut wr) = tokio::io::duplex(1024); - let mut out = MetacacheWriter::new(&mut wr); let walk_dir_options = serde_json::to_string(&opts)?; let mut client = node_service_time_out_client(&CLUSTER_ADDR.to_string()).await?; let request = Request::new(WalkDirRequest { - disk: "data".to_string(), + disk: "/home/dandan/code/rust/s3-rustfs/target/debug/data".to_string(), walk_dir_options, }); let mut response = client.walk_dir(request).await?.into_inner(); - loop { - match response.next().await { - Some(Ok(resp)) => { - if !resp.success { - println!("{}", resp.error_info.unwrap_or("".to_string())); + let job1 = spawn(async move { + let mut out = MetacacheWriter::new(&mut wr); + loop { + match response.next().await { + Some(Ok(resp)) => { + if !resp.success { + println!("{}", resp.error_info.unwrap_or("".to_string())); + } + let entry = serde_json::from_str::(&resp.meta_cache_entry) + .map_err(|e| ecstore::error::Error::from_string(format!("Unexpected response: {:?}", response))) + .unwrap(); + out.write_obj(&entry).await.unwrap(); + } + None => { + let _ = out.close().await; + break; + } + _ => { + println!("Unexpected response: {:?}", response); + let _ = out.close().await; + break; } - let entry = serde_json::from_str::(&resp.meta_cache_entry) - .map_err(|e| Err(ecstore::error::Error::from_string(format!("Unexpected response: {:?}", response))))?; - out.write_obj(&entry)?; } - None => break, - _ => println!("Unexpected response: {:?}", response), } - } + }); + let job2 = spawn(async move { + let mut reader = MetacacheReader::new(rd); + while let Ok(Some(entry)) = reader.peek().await { + println!("{:?}", entry); + } + }); + join_all(vec![job1, job2]).await; Ok(()) } diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 67caf5a1a..1d3693e9b 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -373,7 +373,7 @@ impl DiskAPI for RemoteDisk { return Err(Error::from_string(resp.error_info.unwrap_or("".to_string()))); } let entry = serde_json::from_str::(&resp.meta_cache_entry) - .map_err(|e| Error::from_string(format!("Unexpected response: {:?}", response)))?; + .map_err(|_| Error::from_string(format!("Unexpected response: {:?}", response)))?; out.write_obj(&entry).await?; } None => break, diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index 63ae2489c..bae37e145 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -796,7 +796,7 @@ impl Node for NodeService { join_all(vec![job1, job2]).await; }); } else { - return Err(Status::invalid_argument("invalid disk")); + return Err(Status::invalid_argument(format!("invalid disk, all disk: {:?}", self.all_disk().await))); } let out_stream = ReceiverStream::new(rx); From d4c58cb41fe52ecbdd2e409739787de3fe8dde1b Mon Sep 17 00:00:00 2001 From: junxiang Mu <1948535941@qq.com> Date: Mon, 23 Dec 2024 17:11:38 +0800 Subject: [PATCH 70/77] fix unimport err Signed-off-by: junxiang Mu <1948535941@qq.com> --- ecstore/src/disk/remote.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 1d3693e9b..5a4e7c3ee 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -7,7 +7,7 @@ use protos::{ CheckPartsRequest, DeletePathsRequest, DeleteRequest, DeleteVersionRequest, DeleteVersionsRequest, DeleteVolumeRequest, DiskInfoRequest, ListDirRequest, ListVolumesRequest, MakeVolumeRequest, MakeVolumesRequest, NsScannerRequest, ReadAllRequest, ReadMultipleRequest, ReadVersionRequest, ReadXlRequest, RenameDataRequest, RenameFileRequst, - StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WriteAllRequest, WriteMetadataRequest, + StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WalkDirRequest, WriteAllRequest, WriteMetadataRequest, }, }; use tokio::{ @@ -24,7 +24,6 @@ use super::{ FileInfoVersions, FileReader, FileWriter, ReadMultipleReq, ReadMultipleResp, ReadOptions, RemoteFileReader, RemoteFileWriter, RenameDataResp, UpdateMetadataOpts, VolumeInfo, WalkDirOptions, }; -use crate::metacache::writer::MetacacheWriter; use crate::{ disk::error::DiskError, error::{Error, Result}, @@ -35,6 +34,7 @@ use crate::{ }, store_api::{FileInfo, RawFileInfo}, }; +use crate::{disk::MetaCacheEntry, metacache::writer::MetacacheWriter}; use protos::proto_gen::node_service::RenamePartRequst; #[derive(Debug)] From 9dec7b1f662e4c77c51c5826799068281a7b6ea3 Mon Sep 17 00:00:00 2001 From: junxiang Mu <1948535941@qq.com> Date: Mon, 23 Dec 2024 17:46:39 +0800 Subject: [PATCH 71/77] rewrite decode Signed-off-by: junxiang Mu <1948535941@qq.com> --- common/protos/src/generated/proto_gen/node_service.rs | 4 ++-- common/protos/src/node.proto | 2 +- e2e_test/src/reliant/node_interact_test.rs | 9 +++++---- ecstore/src/disk/remote.rs | 7 +++++-- rustfs/src/grpc.rs | 3 ++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/common/protos/src/generated/proto_gen/node_service.rs b/common/protos/src/generated/proto_gen/node_service.rs index ca8b919e4..bf09da6de 100644 --- a/common/protos/src/generated/proto_gen/node_service.rs +++ b/common/protos/src/generated/proto_gen/node_service.rs @@ -293,8 +293,8 @@ pub struct WalkDirRequest { /// indicate which one in the disks #[prost(string, tag = "1")] pub disk: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub walk_dir_options: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub walk_dir_options: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct WalkDirResponse { diff --git a/common/protos/src/node.proto b/common/protos/src/node.proto index 4ca0f6c95..a921bd4a3 100644 --- a/common/protos/src/node.proto +++ b/common/protos/src/node.proto @@ -204,7 +204,7 @@ message ListDirResponse { message WalkDirRequest { string disk = 1; // indicate which one in the disks - string walk_dir_options = 2; + bytes walk_dir_options = 2; } message WalkDirResponse { diff --git a/e2e_test/src/reliant/node_interact_test.rs b/e2e_test/src/reliant/node_interact_test.rs index cc81204dd..fb96b0b5b 100644 --- a/e2e_test/src/reliant/node_interact_test.rs +++ b/e2e_test/src/reliant/node_interact_test.rs @@ -11,8 +11,8 @@ use protos::{ ListVolumesRequest, LocalStorageInfoRequest, MakeVolumeRequest, PingRequest, PingResponse, ReadAllRequest, }, }; -use rmp_serde::Deserializer; -use serde::Deserialize; +use rmp_serde::{Deserializer, Serializer}; +use serde::{Deserialize, Serialize}; use std::{error::Error, io::Cursor}; use tokio::io::AsyncWrite; use tokio::spawn; @@ -107,11 +107,12 @@ async fn walk_dir() -> Result<(), Box> { ..Default::default() }; let (rd, mut wr) = tokio::io::duplex(1024); - let walk_dir_options = serde_json::to_string(&opts)?; + let mut buf = Vec::new(); + opts.serialize(&mut Serializer::new(&mut buf))?; let mut client = node_service_time_out_client(&CLUSTER_ADDR.to_string()).await?; let request = Request::new(WalkDirRequest { disk: "/home/dandan/code/rust/s3-rustfs/target/debug/data".to_string(), - walk_dir_options, + walk_dir_options: buf, }); let mut response = client.walk_dir(request).await?.into_inner(); diff --git a/ecstore/src/disk/remote.rs b/ecstore/src/disk/remote.rs index 5a4e7c3ee..682408dd9 100644 --- a/ecstore/src/disk/remote.rs +++ b/ecstore/src/disk/remote.rs @@ -10,6 +10,8 @@ use protos::{ StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WalkDirRequest, WriteAllRequest, WriteMetadataRequest, }, }; +use rmp_serde::Serializer; +use serde::Serialize; use tokio::{ io::AsyncWrite, sync::mpsc::{self, Sender}, @@ -356,13 +358,14 @@ impl DiskAPI for RemoteDisk { info!("walk_dir"); let mut wr = wr; let mut out = MetacacheWriter::new(&mut wr); - let walk_dir_options = serde_json::to_string(&opts)?; + let mut buf = Vec::new(); + opts.serialize(&mut Serializer::new(&mut buf))?; let mut client = node_service_time_out_client(&self.addr) .await .map_err(|err| Error::from_string(format!("can not get client, err: {}", err)))?; let request = Request::new(WalkDirRequest { disk: self.endpoint.to_string(), - walk_dir_options, + walk_dir_options: buf, }); let mut response = client.walk_dir(request).await?.into_inner(); diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index bae37e145..f2c1df3cd 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -740,7 +740,8 @@ impl Node for NodeService { let request = request.into_inner(); let (tx, rx) = mpsc::channel(128); if let Some(disk) = self.find_disk(&request.disk).await { - let opts = match serde_json::from_str::(&request.walk_dir_options) { + let mut buf = Deserializer::new(Cursor::new(request.walk_dir_options)); + let opts = match Deserialize::deserialize(&mut buf) { Ok(options) => options, Err(_) => { return Err(Status::invalid_argument("invalid WalkDirOptions")); From bfd58e5749434ea738a6196cfa44b9e63644d963 Mon Sep 17 00:00:00 2001 From: weisd Date: Mon, 23 Dec 2024 23:24:11 +0800 Subject: [PATCH 72/77] fix:#175 add list_object_versions --- ecstore/src/disk/mod.rs | 118 ++++++++++++++++++++++++++++-- ecstore/src/set_disk.rs | 2 +- ecstore/src/sets.rs | 2 +- ecstore/src/store.rs | 36 ++------- ecstore/src/store_api.rs | 6 +- ecstore/src/store_list_objects.rs | 100 ++++++++++++++++++++++++- rustfs/src/storage/ecfs.rs | 73 +++++++++++++++++- 7 files changed, 292 insertions(+), 45 deletions(-) diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index c5f4fd9a9..254a2c9ff 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -558,6 +558,20 @@ pub struct FileInfoVersions { pub free_versions: Vec, } +impl FileInfoVersions { + pub fn find_version_index(&self, v: &str) -> Option { + if v.is_empty() { + return None; + } + + let vid = Uuid::parse_str(v).unwrap_or(Uuid::nil()); + + for ver in self.versions.iter() {} + + self.versions.iter().position(|v| v.version_id == Some(vid)) + } +} + #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct WalkDirOptions { // Bucket to scanner @@ -663,31 +677,31 @@ impl MetaCacheEntry { } #[tracing::instrument(level = "debug", skip(self))] - pub fn to_fileinfo(&self, bucket: &str) -> Result> { + pub fn to_fileinfo(&self, bucket: &str) -> Result { if self.is_dir() { - return Ok(Some(FileInfo { + return Ok(FileInfo { volume: bucket.to_owned(), name: self.name.clone(), ..Default::default() - })); + }); } if self.cached.is_some() { let fm = self.cached.as_ref().unwrap(); if fm.versions.is_empty() { - return Ok(Some(FileInfo { + return Ok(FileInfo { volume: bucket.to_owned(), name: self.name.clone(), deleted: true, is_latest: true, mod_time: Some(OffsetDateTime::UNIX_EPOCH), ..Default::default() - })); + }); } let fi = fm.into_fileinfo(bucket, self.name.as_str(), "", false, false)?; - return Ok(Some(fi)); + return Ok(fi); } let mut fm = FileMeta::new(); @@ -695,7 +709,7 @@ impl MetaCacheEntry { let fi = fm.into_fileinfo(bucket, self.name.as_str(), "", false, false)?; - return Ok(Some(fi)); + return Ok(fi); } pub fn file_info_versions(&self, bucket: &str) -> Result { @@ -962,7 +976,7 @@ impl MetaCacheEntriesSorted { } } - if let Ok(Some(fi)) = entry.to_fileinfo(bucket) { + if let Ok(fi) = entry.to_fileinfo(bucket) { // TODO:VersionPurgeStatus let versioned = vcfg.clone().map(|v| v.0.versioned(&entry.name)).unwrap_or_default(); objects.push(fi.to_object_info(bucket, &entry.name, versioned)); @@ -997,6 +1011,94 @@ impl MetaCacheEntriesSorted { objects } + + pub async fn file_info_versions(&self, bucket: &str, prefix: &str, delimiter: &str, after_v: &str) -> Vec { + let vcfg = get_versioning_config(bucket).await.ok(); + let mut objects = Vec::with_capacity(self.o.as_ref().len()); + let mut prev_prefix = ""; + let mut after_v = after_v; + for entry in self.o.as_ref().iter().flatten() { + if entry.is_object() { + if !delimiter.is_empty() { + if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { + let idx = prefix.len() + idx + delimiter.len(); + if let Some(curr_prefix) = entry.name.get(0..idx) { + if curr_prefix == prev_prefix { + continue; + } + + prev_prefix = curr_prefix; + + objects.push(ObjectInfo { + is_dir: true, + bucket: bucket.to_owned(), + name: curr_prefix.to_owned(), + ..Default::default() + }); + } + continue; + } + } + + let mut fiv = match entry.file_info_versions(bucket) { + Ok(res) => res, + Err(_err) => { + // + continue; + } + }; + + let fi_versions = 'c: { + if !after_v.is_empty() { + if let Some(idx) = fiv.find_version_index(after_v) { + after_v = ""; + break 'c fiv.versions.split_off(idx + 1); + } + + after_v = ""; + break 'c fiv.versions; + } else { + break 'c fiv.versions; + } + }; + + for fi in fi_versions.into_iter() { + // VersionPurgeStatus + + let versioned = vcfg.clone().map(|v| v.0.versioned(&entry.name)).unwrap_or_default(); + objects.push(fi.to_object_info(bucket, &entry.name, versioned)); + } + + continue; + } + + if entry.is_dir() { + if delimiter.is_empty() { + continue; + } + + if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { + let idx = prefix.len() + idx + delimiter.len(); + if let Some(curr_prefix) = entry.name.get(0..idx) { + if curr_prefix == prev_prefix { + continue; + } + + prev_prefix = curr_prefix; + + objects.push(ObjectInfo { + is_dir: true, + bucket: bucket.to_owned(), + name: curr_prefix.to_owned(), + ..Default::default() + }); + } + } + } + } + + objects + } } #[derive(Clone, Debug, Default)] diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 962c9a7c4..59c77eaf8 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -3844,7 +3844,7 @@ impl StorageAPI for SetDisks { unimplemented!() } async fn list_object_versions( - &self, + self: Arc, _bucket: &str, _prefix: &str, _marker: &str, diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index ae095d2cc..8955ef4c2 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -463,7 +463,7 @@ impl StorageAPI for Sets { unimplemented!() } async fn list_object_versions( - &self, + self: Arc, _bucket: &str, _prefix: &str, _marker: &str, diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 1b41b247d..0aa548832 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -23,6 +23,7 @@ use crate::store_err::{ to_object_err, StorageError, }; use crate::store_init::ec_drives_no_config; +use crate::store_list_objects::{max_keys_plus_one, ListPathOptions}; use crate::utils::crypto::base64_decode; use crate::utils::path::{decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; use crate::utils::xml; @@ -1546,37 +1547,16 @@ impl StorageAPI for ECStore { // Ok(v2) } async fn list_object_versions( - &self, - _bucket: &str, - _prefix: &str, + self: Arc, + bucket: &str, + prefix: &str, marker: &str, version_marker: &str, - _delimiter: &str, - _max_keys: i32, + delimiter: &str, + max_keys: i32, ) -> Result { - if marker.is_empty() && !version_marker.is_empty() { - return Err(Error::new(StorageError::NotImplemented)); - } - - // let opts = ListPathOptions { - // bucket: bucket.to_owned(), - // marker: marker.to_owned(), - // prefix: prefix.to_owned(), - // limit: max_keys, - // ..Default::default() - // }; - - // let list = self - // .list_path(&opts, delimiter) - // .await - // .map_err(|e| to_object_err(e, vec![bucket]))?; - - // for info in list.objects.iter() { - // // - // } - - // FIXME: - unimplemented!() + self.inner_list_object_versions(bucket, prefix, marker, version_marker, delimiter, max_keys) + .await } async fn get_object_info(&self, bucket: &str, object: &str, opts: &ObjectOptions) -> Result { check_object_args(bucket, object)?; diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index 7dbd881ab..1cbcc487f 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -805,8 +805,8 @@ pub struct DeletedObject { pub struct ListObjectVersionsInfo { pub is_truncated: bool, - pub next_marker: String, - pub next_version_idmarker: String, + pub next_marker: Option, + pub next_version_idmarker: Option, pub objects: Vec, pub prefixes: Vec, } @@ -854,7 +854,7 @@ pub trait StorageAPI: ObjectIO { ) -> Result; // ListObjectVersions TODO: FIXME: async fn list_object_versions( - &self, + self: Arc, bucket: &str, prefix: &str, marker: &str, diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index f7b185d84..02c3e2ed8 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -6,7 +6,8 @@ use crate::file_meta::merge_file_meta_versions; use crate::peer::is_reserved_or_invalid_bucket; use crate::set_disk::SetDisks; use crate::store::check_list_objs_args; -use crate::store_api::{ListObjectsInfo, ObjectInfo}; +use crate::store_api::{ListObjectVersionsInfo, ListObjectsInfo, ObjectInfo}; +use crate::store_err::StorageError; use crate::utils::path::{self, base_dir_from_prefix, SLASH_SEPARATOR}; use crate::{store::ECStore, store_api::ListObjectsV2Info}; use futures::future::join_all; @@ -26,7 +27,7 @@ const MAX_OBJECT_LIST: i32 = 1000; const METACACHE_SHARE_PREFIX: bool = false; -fn max_keys_plus_one(max_keys: i32, add_one: bool) -> i32 { +pub fn max_keys_plus_one(max_keys: i32, add_one: bool) -> i32 { let mut max_keys = max_keys; if max_keys > MAX_OBJECT_LIST { max_keys = MAX_OBJECT_LIST; @@ -227,6 +228,101 @@ impl ECStore { }) } + pub async fn inner_list_object_versions( + self: Arc, + bucket: &str, + prefix: &str, + marker: &str, + version_marker: &str, + delimiter: &str, + max_keys: i32, + ) -> Result { + if marker.is_empty() && !version_marker.is_empty() { + return Err(Error::new(StorageError::NotImplemented)); + } + + let opts = ListPathOptions { + bucket: bucket.to_owned(), + prefix: prefix.to_owned(), + separator: delimiter.to_owned(), + limit: max_keys_plus_one(max_keys, !marker.is_empty()), + marker: marker.to_owned(), + incl_deleted: true, + ask_disks: "strict".to_owned(), + versioned: true, + ..Default::default() + }; + + let mut err_eof = false; + let has_merged = match self.list_path(&opts).await { + Ok(res) => Some(res), + Err(err) => { + if !is_err_eof(&err) { + return Err(err); + } + + err_eof = true; + None + } + }; + + let mut get_objects = if let Some(merged) = has_merged { + merged.file_info_versions(bucket, prefix, delimiter, version_marker).await + } else { + Vec::new() + }; + + let is_truncated = { + if max_keys > 0 && get_objects.len() > max_keys as usize { + get_objects.truncate(max_keys as usize); + true + } else { + !err_eof && !get_objects.is_empty() + } + }; + + let mut prefixes: Vec = Vec::new(); + + let mut objects = Vec::with_capacity(get_objects.len()); + for obj in get_objects.into_iter() { + if obj.is_dir && obj.mod_time.is_none() && !delimiter.is_empty() { + let mut found = false; + if delimiter != SLASH_SEPARATOR { + for p in prefixes.iter() { + if found { + break; + } + found = p == &obj.name; + } + } + if !found { + prefixes.push(obj.name.clone()); + } + } else { + objects.push(obj); + } + } + + let (next_marker, next_version_idmarker) = { + if is_truncated { + objects + .last() + .map(|last| (Some(last.name.clone()), last.version_id.map(|v| v.to_string()))) + .unwrap_or_default() + } else { + (None, None) + } + }; + + Ok(ListObjectVersionsInfo { + is_truncated, + next_marker, + next_version_idmarker, + objects, + prefixes, + }) + } + pub async fn list_path(self: Arc, o: &ListPathOptions) -> Result { check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?; // if opts.prefix.ends_with(SLASH_SEPARATOR) { diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index 2f808ef9a..da9eb186e 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -503,6 +503,7 @@ impl S3 for FS { key: Some(v.name.to_owned()), last_modified: v.mod_time.map(Timestamp::from), size: Some(v.size as i64), + e_tag: v.etag.clone(), ..Default::default() }; @@ -541,9 +542,77 @@ impl S3 for FS { async fn list_object_versions( &self, - _req: S3Request, + req: S3Request, ) -> S3Result> { - Err(s3_error!(NotImplemented, "ListObjectVersions is not implemented yet")) + let ListObjectVersionsInput { + bucket, + delimiter, + key_marker, + version_id_marker, + max_keys, + prefix, + .. + } = req.input; + + let prefix = prefix.unwrap_or_default(); + let delimiter = delimiter.unwrap_or_default(); + let max_keys = max_keys.unwrap_or(1000); + + let Some(store) = new_object_layer_fn() else { + return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string())); + }; + + let object_infos = store + .list_object_versions( + &bucket, + &prefix, + &key_marker.unwrap_or_default(), + &version_id_marker.unwrap_or_default(), + &delimiter, + max_keys, + ) + .await + .map_err(to_s3_error)?; + + let objects: Vec = object_infos + .objects + .iter() + .filter(|v| !v.name.is_empty()) + .map(|v| { + let obj = ObjectVersion { + key: Some(v.name.to_owned()), + last_modified: v.mod_time.map(Timestamp::from), + size: Some(v.size as i64), + version_id: v.version_id.map(|v| v.to_string()), + is_latest: Some(v.is_latest), + e_tag: v.etag.clone(), + ..Default::default() // TODO: another fields + }; + + obj + }) + .collect(); + + let key_count = objects.len() as i32; + + let common_prefixes = object_infos + .prefixes + .into_iter() + .map(|v| CommonPrefix { prefix: Some(v) }) + .collect(); + + let output = ListObjectVersionsOutput { + // is_truncated: Some(object_infos.is_truncated), + max_keys: Some(key_count), + delimiter: Some(delimiter), + name: Some(bucket), + prefix: Some(prefix), + common_prefixes: Some(common_prefixes), + versions: Some(objects), + ..Default::default() + }; + + Ok(S3Response::new(output)) } #[tracing::instrument(level = "debug", skip(self, req))] From 938df62167303432da6da6d996003f431f2fb7ef Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 24 Dec 2024 17:01:37 +0800 Subject: [PATCH 73/77] review list_objects --- ecstore/src/store.rs | 26 +------ ecstore/src/store_err.rs | 11 +++ ecstore/src/store_list_objects.rs | 125 +++++++++++++++++++++--------- rustfs/src/storage/error.rs | 3 + 4 files changed, 107 insertions(+), 58 deletions(-) diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 0aa548832..1d84e39c0 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -1511,7 +1511,10 @@ impl StorageAPI for ECStore { Err(Error::new(StorageError::ObjectNotFound(bucket.to_owned(), object.to_owned()))) } - // TODO: review + // @continuation_token marker + // @start_after as marker when continuation_token empty + // @delimiter default="/", empty when recursive + // @max_keys limit async fn list_objects_v2( self: Arc, bucket: &str, @@ -1524,27 +1527,6 @@ impl StorageAPI for ECStore { ) -> Result { self.inner_list_objects_v2(bucket, prefix, continuation_token, delimiter, max_keys, fetch_owner, start_after) .await - - // let opts = ListPathOptions { - // bucket: bucket.to_string(), - // limit: max_keys, - // prefix: prefix.to_owned(), - // ..Default::default() - // }; - - // let info = self.list_path(&opts, delimiter).await?; - - // // warn!("list_objects_v2 info {:?}", info); - - // let v2 = ListObjectsV2Info { - // is_truncated: info.is_truncated, - // continuation_token: continuation_token.to_owned(), - // next_continuation_token: info.next_marker, - // objects: info.objects, - // prefixes: info.prefixes, - // }; - - // Ok(v2) } async fn list_object_versions( self: Arc, diff --git a/ecstore/src/store_err.rs b/ecstore/src/store_err.rs index e0dabb870..a0fc12cc4 100644 --- a/ecstore/src/store_err.rs +++ b/ecstore/src/store_err.rs @@ -52,6 +52,9 @@ pub enum StorageError { #[error("Object not found: {0}/{1}")] ObjectNotFound(String, String), + #[error("volume not found: {0}")] + VolumeNotFound(String), + #[error("Version not found: {0}/{1}-{2}")] VersionNotFound(String, String, String), @@ -193,6 +196,14 @@ pub fn is_err_bucket_exists(err: &Error) -> bool { } } +pub fn is_err_bucket_not_found(err: &Error) -> bool { + if let Some(e) = err.downcast_ref::() { + matches!(e, StorageError::VolumeNotFound(_)) || matches!(e, StorageError::BucketNotFound(_)) + } else { + false + } +} + pub fn is_err_object_not_found(err: &Error) -> bool { if is_err_file_not_found(err) { return true; diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 02c3e2ed8..95c2dd9d5 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -6,9 +6,10 @@ use crate::file_meta::merge_file_meta_versions; use crate::peer::is_reserved_or_invalid_bucket; use crate::set_disk::SetDisks; use crate::store::check_list_objs_args; -use crate::store_api::{ListObjectVersionsInfo, ListObjectsInfo, ObjectInfo}; -use crate::store_err::StorageError; +use crate::store_api::{ListObjectVersionsInfo, ListObjectsInfo, ObjectInfo, ObjectOptions}; +use crate::store_err::{is_err_bucket_exists, is_err_bucket_not_found, StorageError}; use crate::utils::path::{self, base_dir_from_prefix, SLASH_SEPARATOR}; +use crate::StorageAPI; use crate::{store::ECStore, store_api::ListObjectsV2Info}; use futures::future::join_all; use rand::seq::SliceRandom; @@ -29,7 +30,7 @@ const METACACHE_SHARE_PREFIX: bool = false; pub fn max_keys_plus_one(max_keys: i32, add_one: bool) -> i32 { let mut max_keys = max_keys; - if max_keys > MAX_OBJECT_LIST { + if !(0..=MAX_OBJECT_LIST).contains(&max_keys) { max_keys = MAX_OBJECT_LIST; } if add_one { @@ -115,6 +116,10 @@ impl ListPathOptions { impl ECStore { #[allow(clippy::too_many_arguments)] + // @continuation_token marker + // @start_after as marker when continuation_token empty + // @delimiter default="/", empty when recursive + // @max_keys limit pub async fn inner_list_objects_v2( self: Arc, bucket: &str, @@ -162,6 +167,33 @@ impl ECStore { ..Default::default() }; + // use get + if !opts.prefix.is_empty() && opts.limit == 1 && opts.marker.is_empty() { + match self + .get_object_info( + &opts.bucket, + &opts.prefix, + &ObjectOptions { + no_lock: true, + ..Default::default() + }, + ) + .await + { + Ok(res) => { + return Ok(ListObjectsInfo { + objects: vec![res], + ..Default::default() + }); + } + Err(err) => { + if is_err_bucket_not_found(&err) { + return Err(err); + } + } + }; + }; + let mut err_eof = false; let has_merged = match self.list_path(&opts).await { Ok(res) => Some(res), @@ -367,44 +399,60 @@ impl ECStore { o.create = false; } - // FIXME:TODO: - let (tx, rx) = broadcast::channel(1); + // cancel channel + let (cancel_tx, cancel_rx) = broadcast::channel(1); + let (err_tx, mut err_rx) = broadcast::channel::(1); - let (sender, mut recv) = mpsc::channel(o.limit as usize); + let (sender, recv) = mpsc::channel(o.limit as usize); let store = self.clone(); let opts = o.clone(); - let rx1 = rx.resubscribe(); - tokio::spawn(async move { - if let Err(err) = store.list_merged(rx1, opts, sender).await { + let cancel_rx1 = cancel_rx.resubscribe(); + let err_tx1 = err_tx.clone(); + let job1 = tokio::spawn(async move { + let mut opts = opts; + opts.stop_disk_at_limit = true; + if let Err(err) = store.list_merged(cancel_rx1, opts, sender).await { error!("list_merged err {:?}", err); + let _ = err_tx1.send(err); } }); - let rx2 = rx.resubscribe(); - let res = gather_results(rx2, &o, &mut recv).await?; + let cancel_rx2 = cancel_rx.resubscribe(); - tx.send(true)?; + let (result_tx, mut result_rx) = mpsc::channel(1); - // TODO: recv list_merged err + let job2 = tokio::spawn(gather_results(cancel_rx2, o, recv, result_tx)); - Ok(MetaCacheEntriesSorted { - o: MetaCacheEntries(res.into_iter().map(Some).collect()), - }) + let result = { + // receiver result + tokio::select! { + res = err_rx.recv() =>{ - // let mut opts = opts.clone(); + match res{ + Ok(o) => { + error!("list_path err_rx.recv() ok {:?}", &o); + Err(o) + }, + Err(err) => { + error!("list_path err_rx.recv() err {:?}", &err); + Err(Error::new(err)) + }, + } + }, + Some(result) = result_rx.recv()=>{ + result + } + } + }; - // if opts.base_dir.is_empty() { - // opts.base_dir = base_dir_from_prefix(&opts.prefix); - // } + // cancel call exit spawns + cancel_tx.send(true)?; - // let objects = self.list_merged(&opts).await?; + // wait spawns exit + join_all(vec![job1, job2]).await; - // let info = ListObjectsInfo { - // objects, - // ..Default::default() - // }; - // Ok(info) + result } // 读所有 @@ -486,16 +534,21 @@ impl ECStore { } } -// TODO: FIXME: 异步 async fn gather_results( _rx: B_Receiver, - opts: &ListPathOptions, - recv: &mut Receiver, -) -> Result> { + opts: ListPathOptions, + recv: Receiver, + results_tx: Sender>, +) { let mut returned = false; - let mut results = Vec::new(); + let mut results = MetaCacheEntriesSorted { + o: MetaCacheEntries(Vec::new()), + }; + + let mut recv = recv; + // let mut entrys = Vec::new(); while let Some(mut entry) = recv.recv().await { - // warn!("gather_results entry {}", &entry.name); + // warn!("gather_entrys entry {}", &entry.name); if returned { continue; } @@ -514,16 +567,16 @@ async fn gather_results( } // TODO: other - if opts.limit > 0 && results.len() >= opts.limit as usize { + if opts.limit > 0 && results.o.0.len() >= opts.limit as usize { returned = true; continue; } - results.push(entry); + results.o.0.push(Some(entry)); + // entrys.push(entry); } - // warn!("gather_results results {:?}", &results); - Ok(results) + results_tx.send(Ok(results)).await; } async fn select_from( diff --git a/rustfs/src/storage/error.rs b/rustfs/src/storage/error.rs index 53aad658c..72873dd6f 100644 --- a/rustfs/src/storage/error.rs +++ b/rustfs/src/storage/error.rs @@ -62,6 +62,9 @@ pub fn to_s3_error(err: Error) -> S3Error { s3_error!(SlowDown, "Storage resources are insufficient for the write operation") } StorageError::DecommissionNotStarted => s3_error!(InvalidArgument, "Decommission Not Started"), + StorageError::VolumeNotFound(bucket) => { + s3_error!(NoSuchBucket, "bucket not found {}", bucket) + } }; } From 2e0ee441cf6e8948620936f5f15c433646a0075d Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 24 Dec 2024 20:04:40 +0800 Subject: [PATCH 74/77] clippy --- .../generated/flatbuffers_generated/models.rs | 207 +- .../src/generated/proto_gen/node_service.rs | 3836 +++++++++++++---- scripts/test.sh | 2 +- 3 files changed, 3157 insertions(+), 888 deletions(-) diff --git a/common/protos/src/generated/flatbuffers_generated/models.rs b/common/protos/src/generated/flatbuffers_generated/models.rs index e4949fdcf..aa1f6ae2f 100644 --- a/common/protos/src/generated/flatbuffers_generated/models.rs +++ b/common/protos/src/generated/flatbuffers_generated/models.rs @@ -1,9 +1,10 @@ // automatically generated by the FlatBuffers compiler, do not modify + // @generated -use core::cmp::Ordering; use core::mem; +use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -11,114 +12,112 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod models { - use core::cmp::Ordering; - use core::mem; + use core::mem; + use core::cmp::Ordering; - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; - pub enum PingBodyOffset {} - #[derive(Copy, Clone, PartialEq)] +pub enum PingBodyOffset {} +#[derive(Copy, Clone, PartialEq)] - pub struct PingBody<'a> { - pub _tab: flatbuffers::Table<'a>, +pub struct PingBody<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { + type Inner = PingBody<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> PingBody<'a> { + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; + + pub const fn get_fully_qualified_name() -> &'static str { + "models.PingBody" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PingBody { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PingBodyArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = PingBodyBuilder::new(_fbb); + if let Some(x) = args.payload { builder.add_payload(x); } + builder.finish() + } + + + #[inline] + pub fn payload(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(PingBody::VT_PAYLOAD, None)} + } +} + +impl flatbuffers::Verifiable for PingBody<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>("payload", Self::VT_PAYLOAD, false)? + .finish(); + Ok(()) + } +} +pub struct PingBodyArgs<'a> { + pub payload: Option>>, +} +impl<'a> Default for PingBodyArgs<'a> { + #[inline] + fn default() -> Self { + PingBodyArgs { + payload: None, } + } +} - impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { - type Inner = PingBody<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { - _tab: flatbuffers::Table::new(buf, loc), - } - } +pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { + #[inline] + pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(PingBody::VT_PAYLOAD, payload); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PingBodyBuilder { + fbb_: _fbb, + start_: start, } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} - impl<'a> PingBody<'a> { - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; +impl core::fmt::Debug for PingBody<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PingBody"); + ds.field("payload", &self.payload()); + ds.finish() + } +} +} // pub mod models - pub const fn get_fully_qualified_name() -> &'static str { - "models.PingBody" - } - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PingBody { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PingBodyArgs<'args>, - ) -> flatbuffers::WIPOffset> { - let mut builder = PingBodyBuilder::new(_fbb); - if let Some(x) = args.payload { - builder.add_payload(x); - } - builder.finish() - } - - #[inline] - pub fn payload(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { - self._tab - .get::>>(PingBody::VT_PAYLOAD, None) - } - } - } - - impl flatbuffers::Verifiable for PingBody<'_> { - #[inline] - fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("payload", Self::VT_PAYLOAD, false)? - .finish(); - Ok(()) - } - } - pub struct PingBodyArgs<'a> { - pub payload: Option>>, - } - impl<'a> Default for PingBodyArgs<'a> { - #[inline] - fn default() -> Self { - PingBodyArgs { payload: None } - } - } - - pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, - } - impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_ - .push_slot_always::>(PingBody::VT_PAYLOAD, payload); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PingBodyBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } - } - - impl core::fmt::Debug for PingBody<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PingBody"); - ds.field("payload", &self.payload()); - ds.finish() - } - } -} // pub mod models diff --git a/common/protos/src/generated/proto_gen/node_service.rs b/common/protos/src/generated/proto_gen/node_service.rs index bf09da6de..c73b6e4cc 100644 --- a/common/protos/src/generated/proto_gen/node_service.rs +++ b/common/protos/src/generated/proto_gen/node_service.rs @@ -615,7 +615,10 @@ pub struct GenerallyLockResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mss { #[prost(map = "string, string", tag = "1")] - pub value: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + pub value: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct LocalStorageInfoRequest { @@ -779,7 +782,10 @@ pub struct DownloadProfileDataResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(map = "string, bytes", tag = "2")] - pub data: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::vec::Vec>, + pub data: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, #[prost(string, optional, tag = "3")] pub error_info: ::core::option::Option<::prost::alloc::string::String>, } @@ -1046,9 +1052,15 @@ pub struct LoadTransitionTierConfigResponse { } /// Generated client implementations. pub mod node_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] - use tonic::codegen::http::Uri; + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct NodeServiceClient { inner: tonic::client::Grpc, @@ -1079,16 +1091,22 @@ pub mod node_service_client { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } - pub fn with_interceptor(inner: T, interceptor: F) -> NodeServiceClient> + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> NodeServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, - Response = http::Response<>::ResponseBody>, + Response = http::Response< + >::ResponseBody, + >, >, - >>::Error: - Into + std::marker::Send + std::marker::Sync, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, { NodeServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -1131,9 +1149,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Ping"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Ping", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Ping")); @@ -1142,13 +1166,22 @@ pub mod node_service_client { pub async fn heal_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/HealBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/HealBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "HealBucket")); @@ -1157,13 +1190,22 @@ pub mod node_service_client { pub async fn list_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListBucket")); @@ -1172,13 +1214,22 @@ pub mod node_service_client { pub async fn make_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeBucket")); @@ -1187,13 +1238,22 @@ pub mod node_service_client { pub async fn get_bucket_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetBucketInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketInfo")); @@ -1202,13 +1262,22 @@ pub mod node_service_client { pub async fn delete_bucket( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucket"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteBucket", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucket")); @@ -1217,13 +1286,22 @@ pub mod node_service_client { pub async fn read_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAll"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadAll", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAll")); @@ -1232,13 +1310,22 @@ pub mod node_service_client { pub async fn write_all( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteAll"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteAll", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteAll")); @@ -1251,9 +1338,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Delete"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Delete", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Delete")); @@ -1262,13 +1355,22 @@ pub mod node_service_client { pub async fn verify_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/VerifyFile"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/VerifyFile", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "VerifyFile")); @@ -1277,13 +1379,22 @@ pub mod node_service_client { pub async fn check_parts( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/CheckParts"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/CheckParts", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "CheckParts")); @@ -1292,13 +1403,22 @@ pub mod node_service_client { pub async fn rename_part( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenamePart"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenamePart", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenamePart")); @@ -1307,13 +1427,22 @@ pub mod node_service_client { pub async fn rename_file( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameFile"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenameFile", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameFile")); @@ -1326,9 +1455,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Write"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Write", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Write")); @@ -1337,13 +1472,22 @@ pub mod node_service_client { pub async fn write_stream( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteStream"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteStream", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteStream")); @@ -1353,13 +1497,22 @@ pub mod node_service_client { pub async fn read_at( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadAt"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadAt", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadAt")); @@ -1368,13 +1521,22 @@ pub mod node_service_client { pub async fn list_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListDir"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListDir", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListDir")); @@ -1383,13 +1545,22 @@ pub mod node_service_client { pub async fn walk_dir( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WalkDir"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WalkDir", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WalkDir")); @@ -1398,13 +1569,22 @@ pub mod node_service_client { pub async fn rename_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RenameData"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RenameData", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RenameData")); @@ -1413,13 +1593,22 @@ pub mod node_service_client { pub async fn make_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolumes"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeVolumes", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolumes")); @@ -1428,13 +1617,22 @@ pub mod node_service_client { pub async fn make_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/MakeVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/MakeVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "MakeVolume")); @@ -1443,13 +1641,22 @@ pub mod node_service_client { pub async fn list_volumes( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ListVolumes"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ListVolumes", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ListVolumes")); @@ -1458,13 +1665,22 @@ pub mod node_service_client { pub async fn stat_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StatVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StatVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StatVolume")); @@ -1473,13 +1689,22 @@ pub mod node_service_client { pub async fn delete_paths( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePaths"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeletePaths", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePaths")); @@ -1488,13 +1713,22 @@ pub mod node_service_client { pub async fn update_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UpdateMetadata", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetadata")); @@ -1503,13 +1737,22 @@ pub mod node_service_client { pub async fn write_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/WriteMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/WriteMetadata", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "WriteMetadata")); @@ -1518,13 +1761,22 @@ pub mod node_service_client { pub async fn read_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadVersion"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadVersion", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadVersion")); @@ -1537,9 +1789,15 @@ pub mod node_service_client { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadXL"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadXL", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadXL")); @@ -1548,13 +1806,22 @@ pub mod node_service_client { pub async fn delete_version( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersion"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVersion", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersion")); @@ -1563,13 +1830,22 @@ pub mod node_service_client { pub async fn delete_versions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVersions"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVersions", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVersions")); @@ -1578,13 +1854,22 @@ pub mod node_service_client { pub async fn read_multiple( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReadMultiple"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReadMultiple", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReadMultiple")); @@ -1593,13 +1878,22 @@ pub mod node_service_client { pub async fn delete_volume( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteVolume"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteVolume", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteVolume")); @@ -1608,13 +1902,22 @@ pub mod node_service_client { pub async fn disk_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DiskInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DiskInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DiskInfo")); @@ -1623,13 +1926,22 @@ pub mod node_service_client { pub async fn ns_scanner( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> std::result::Result>, tonic::Status> { + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/NsScanner"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/NsScanner", + ); let mut req = request.into_streaming_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "NsScanner")); @@ -1638,13 +1950,22 @@ pub mod node_service_client { pub async fn lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Lock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Lock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Lock")); @@ -1653,13 +1974,22 @@ pub mod node_service_client { pub async fn un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "UnLock")); @@ -1668,13 +1998,22 @@ pub mod node_service_client { pub async fn r_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RLock")); @@ -1683,13 +2022,22 @@ pub mod node_service_client { pub async fn r_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/RUnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/RUnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "RUnLock")); @@ -1698,13 +2046,22 @@ pub mod node_service_client { pub async fn force_un_lock( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ForceUnLock"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ForceUnLock", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ForceUnLock")); @@ -1713,13 +2070,22 @@ pub mod node_service_client { pub async fn refresh( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/Refresh"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/Refresh", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "Refresh")); @@ -1728,13 +2094,22 @@ pub mod node_service_client { pub async fn local_storage_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LocalStorageInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LocalStorageInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LocalStorageInfo")); @@ -1743,13 +2118,22 @@ pub mod node_service_client { pub async fn server_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ServerInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ServerInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ServerInfo")); @@ -1758,13 +2142,22 @@ pub mod node_service_client { pub async fn get_cpus( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetCpus"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetCpus", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetCpus")); @@ -1773,13 +2166,22 @@ pub mod node_service_client { pub async fn get_net_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetNetInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetNetInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetNetInfo")); @@ -1788,13 +2190,22 @@ pub mod node_service_client { pub async fn get_partitions( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetPartitions"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetPartitions", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetPartitions")); @@ -1803,13 +2214,22 @@ pub mod node_service_client { pub async fn get_os_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetOsInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetOsInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetOsInfo")); @@ -1818,13 +2238,22 @@ pub mod node_service_client { pub async fn get_se_linux_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSELinuxInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSELinuxInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSELinuxInfo")); @@ -1833,13 +2262,22 @@ pub mod node_service_client { pub async fn get_sys_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSysConfig", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysConfig")); @@ -1848,13 +2286,22 @@ pub mod node_service_client { pub async fn get_sys_errors( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSysErrors"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSysErrors", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSysErrors")); @@ -1863,13 +2310,22 @@ pub mod node_service_client { pub async fn get_mem_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMemInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMemInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMemInfo")); @@ -1878,13 +2334,22 @@ pub mod node_service_client { pub async fn get_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetrics"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMetrics", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetMetrics")); @@ -1893,13 +2358,22 @@ pub mod node_service_client { pub async fn get_proc_info( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetProcInfo"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetProcInfo", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetProcInfo")); @@ -1908,13 +2382,22 @@ pub mod node_service_client { pub async fn start_profiling( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StartProfiling"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StartProfiling", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StartProfiling")); @@ -1923,28 +2406,48 @@ pub mod node_service_client { pub async fn download_profile_data( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DownloadProfileData"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DownloadProfileData", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DownloadProfileData")); + .insert( + GrpcMethod::new("node_service.NodeService", "DownloadProfileData"), + ); self.inner.unary(req, path, codec).await } pub async fn get_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetBucketStats"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetBucketStats", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetBucketStats")); @@ -1953,13 +2456,22 @@ pub mod node_service_client { pub async fn get_sr_metrics( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetSRMetrics"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetSRMetrics", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "GetSRMetrics")); @@ -1968,58 +2480,100 @@ pub mod node_service_client { pub async fn get_all_bucket_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetAllBucketStats"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetAllBucketStats", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "GetAllBucketStats")); + .insert( + GrpcMethod::new("node_service.NodeService", "GetAllBucketStats"), + ); self.inner.unary(req, path, codec).await } pub async fn load_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadBucketMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadBucketMetadata", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadBucketMetadata"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_bucket_metadata( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteBucketMetadata"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteBucketMetadata", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata")); + .insert( + GrpcMethod::new("node_service.NodeService", "DeleteBucketMetadata"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeletePolicy"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeletePolicy", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeletePolicy")); @@ -2028,13 +2582,22 @@ pub mod node_service_client { pub async fn load_policy( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicy"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadPolicy", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicy")); @@ -2043,28 +2606,48 @@ pub mod node_service_client { pub async fn load_policy_mapping( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadPolicyMapping"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadPolicyMapping", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadPolicyMapping"), + ); self.inner.unary(req, path, codec).await } pub async fn delete_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteUser"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteUser", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "DeleteUser")); @@ -2073,28 +2656,48 @@ pub mod node_service_client { pub async fn delete_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/DeleteServiceAccount"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/DeleteServiceAccount", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount")); + .insert( + GrpcMethod::new("node_service.NodeService", "DeleteServiceAccount"), + ); self.inner.unary(req, path, codec).await } pub async fn load_user( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadUser"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadUser", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadUser")); @@ -2103,28 +2706,48 @@ pub mod node_service_client { pub async fn load_service_account( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadServiceAccount"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadServiceAccount", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadServiceAccount")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadServiceAccount"), + ); self.inner.unary(req, path, codec).await } pub async fn load_group( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadGroup"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadGroup", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "LoadGroup")); @@ -2133,16 +2756,30 @@ pub mod node_service_client { pub async fn reload_site_replication_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadSiteReplicationConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReloadSiteReplicationConfig", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "ReloadSiteReplicationConfig")); + .insert( + GrpcMethod::new( + "node_service.NodeService", + "ReloadSiteReplicationConfig", + ), + ); self.inner.unary(req, path, codec).await } /// rpc VerifyBinary() returns () {}; @@ -2150,13 +2787,22 @@ pub mod node_service_client { pub async fn signal_service( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/SignalService"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/SignalService", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "SignalService")); @@ -2165,58 +2811,100 @@ pub mod node_service_client { pub async fn background_heal_status( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/BackgroundHealStatus"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/BackgroundHealStatus", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus")); + .insert( + GrpcMethod::new("node_service.NodeService", "BackgroundHealStatus"), + ); self.inner.unary(req, path, codec).await } pub async fn get_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/GetMetacacheListing"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/GetMetacacheListing", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "GetMetacacheListing")); + .insert( + GrpcMethod::new("node_service.NodeService", "GetMetacacheListing"), + ); self.inner.unary(req, path, codec).await } pub async fn update_metacache_listing( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/UpdateMetacacheListing"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/UpdateMetacacheListing", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing")); + .insert( + GrpcMethod::new("node_service.NodeService", "UpdateMetacacheListing"), + ); self.inner.unary(req, path, codec).await } pub async fn reload_pool_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/ReloadPoolMeta"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/ReloadPoolMeta", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "ReloadPoolMeta")); @@ -2225,13 +2913,22 @@ pub mod node_service_client { pub async fn stop_rebalance( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/StopRebalance"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/StopRebalance", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("node_service.NodeService", "StopRebalance")); @@ -2240,38 +2937,69 @@ pub mod node_service_client { pub async fn load_rebalance_meta( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadRebalanceMeta"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadRebalanceMeta", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta")); + .insert( + GrpcMethod::new("node_service.NodeService", "LoadRebalanceMeta"), + ); self.inner.unary(req, path, codec).await } pub async fn load_transition_tier_config( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await - .map_err(|e| tonic::Status::unknown(format!("Service was not ready: {}", e.into())))?; + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/node_service.NodeService/LoadTransitionTierConfig"); + let path = http::uri::PathAndQuery::from_static( + "/node_service.NodeService/LoadTransitionTierConfig", + ); let mut req = request.into_request(); req.extensions_mut() - .insert(GrpcMethod::new("node_service.NodeService", "LoadTransitionTierConfig")); + .insert( + GrpcMethod::new( + "node_service.NodeService", + "LoadTransitionTierConfig", + ), + ); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod node_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with NodeServiceServer. #[async_trait] @@ -2284,23 +3012,38 @@ pub mod node_service_server { async fn heal_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn list_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_bucket_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_bucket( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_all( &self, request: tonic::Request, @@ -2308,7 +3051,10 @@ pub mod node_service_server { async fn write_all( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete( &self, request: tonic::Request, @@ -2316,33 +3062,52 @@ pub mod node_service_server { async fn verify_file( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn check_parts( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn rename_part( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn rename_file( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn write( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WriteStream method. - type WriteStreamStream: tonic::codegen::tokio_stream::Stream> + type WriteStreamStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn write_stream( &self, request: tonic::Request>, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the ReadAt method. - type ReadAtStream: tonic::codegen::tokio_stream::Stream> + type ReadAtStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; /// rpc Append(AppendRequest) returns (AppendResponse) {}; @@ -2355,7 +3120,9 @@ pub mod node_service_server { request: tonic::Request, ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WalkDir method. - type WalkDirStream: tonic::codegen::tokio_stream::Stream> + type WalkDirStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn walk_dir( @@ -2365,39 +3132,66 @@ pub mod node_service_server { async fn rename_data( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_volumes( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn make_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn list_volumes( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn stat_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_paths( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn write_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_version( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_xl( &self, request: tonic::Request, @@ -2405,25 +3199,42 @@ pub mod node_service_server { async fn delete_version( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_versions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn read_multiple( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_volume( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn disk_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Server streaming response type for the NsScanner method. - type NsScannerStream: tonic::codegen::tokio_stream::Stream> + type NsScannerStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + std::marker::Send + 'static; async fn ns_scanner( @@ -2433,35 +3244,59 @@ pub mod node_service_server { async fn lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn r_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn r_un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn force_un_lock( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn refresh( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn local_storage_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn server_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_cpus( &self, request: tonic::Request, @@ -2469,137 +3304,236 @@ pub mod node_service_server { async fn get_net_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_partitions( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_os_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_se_linux_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sys_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sys_errors( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_mem_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_metrics( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_proc_info( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn start_profiling( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn download_profile_data( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_sr_metrics( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_all_bucket_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_bucket_metadata( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_policy( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_policy( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_policy_mapping( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_user( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn delete_service_account( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_user( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_service_account( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_group( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn reload_site_replication_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// rpc VerifyBinary() returns () {}; /// rpc CommitBinary() returns () {}; async fn signal_service( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn background_heal_status( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn get_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn update_metacache_listing( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn reload_pool_meta( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn stop_rebalance( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_rebalance_meta( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; async fn load_transition_tier_config( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } #[derive(Debug)] pub struct NodeServiceServer { @@ -2622,7 +3556,10 @@ pub mod node_service_server { max_encoding_message_size: None, } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -2666,7 +3603,10 @@ pub mod node_service_server { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -2674,12 +3614,21 @@ pub mod node_service_server { "/node_service.NodeService/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); - impl tonic::server::UnaryService for PingSvc { + impl tonic::server::UnaryService + for PingSvc { type Response = super::PingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::ping(&inner, request).await }; + let fut = async move { + ::ping(&inner, request).await + }; Box::pin(fut) } } @@ -2692,8 +3641,14 @@ pub mod node_service_server { let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2702,12 +3657,23 @@ pub mod node_service_server { "/node_service.NodeService/HealBucket" => { #[allow(non_camel_case_types)] struct HealBucketSvc(pub Arc); - impl tonic::server::UnaryService for HealBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for HealBucketSvc { type Response = super::HealBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::heal_bucket(&inner, request).await }; + let fut = async move { + ::heal_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2720,8 +3686,14 @@ pub mod node_service_server { let method = HealBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2730,12 +3702,23 @@ pub mod node_service_server { "/node_service.NodeService/ListBucket" => { #[allow(non_camel_case_types)] struct ListBucketSvc(pub Arc); - impl tonic::server::UnaryService for ListBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListBucketSvc { type Response = super::ListBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_bucket(&inner, request).await }; + let fut = async move { + ::list_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2748,8 +3731,14 @@ pub mod node_service_server { let method = ListBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2758,12 +3747,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeBucket" => { #[allow(non_camel_case_types)] struct MakeBucketSvc(pub Arc); - impl tonic::server::UnaryService for MakeBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeBucketSvc { type Response = super::MakeBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_bucket(&inner, request).await }; + let fut = async move { + ::make_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2776,8 +3776,14 @@ pub mod node_service_server { let method = MakeBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2786,12 +3792,23 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketInfo" => { #[allow(non_camel_case_types)] struct GetBucketInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetBucketInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetBucketInfoSvc { type Response = super::GetBucketInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_bucket_info(&inner, request).await }; + let fut = async move { + ::get_bucket_info(&inner, request).await + }; Box::pin(fut) } } @@ -2804,8 +3821,14 @@ pub mod node_service_server { let method = GetBucketInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2814,12 +3837,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucket" => { #[allow(non_camel_case_types)] struct DeleteBucketSvc(pub Arc); - impl tonic::server::UnaryService for DeleteBucketSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteBucketSvc { type Response = super::DeleteBucketResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_bucket(&inner, request).await }; + let fut = async move { + ::delete_bucket(&inner, request).await + }; Box::pin(fut) } } @@ -2832,8 +3866,14 @@ pub mod node_service_server { let method = DeleteBucketSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2842,12 +3882,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadAll" => { #[allow(non_camel_case_types)] struct ReadAllSvc(pub Arc); - impl tonic::server::UnaryService for ReadAllSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadAllSvc { type Response = super::ReadAllResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_all(&inner, request).await }; + let fut = async move { + ::read_all(&inner, request).await + }; Box::pin(fut) } } @@ -2860,8 +3911,14 @@ pub mod node_service_server { let method = ReadAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2870,12 +3927,23 @@ pub mod node_service_server { "/node_service.NodeService/WriteAll" => { #[allow(non_camel_case_types)] struct WriteAllSvc(pub Arc); - impl tonic::server::UnaryService for WriteAllSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WriteAllSvc { type Response = super::WriteAllResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_all(&inner, request).await }; + let fut = async move { + ::write_all(&inner, request).await + }; Box::pin(fut) } } @@ -2888,8 +3956,14 @@ pub mod node_service_server { let method = WriteAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2898,12 +3972,23 @@ pub mod node_service_server { "/node_service.NodeService/Delete" => { #[allow(non_camel_case_types)] struct DeleteSvc(pub Arc); - impl tonic::server::UnaryService for DeleteSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteSvc { type Response = super::DeleteResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete(&inner, request).await }; + let fut = async move { + ::delete(&inner, request).await + }; Box::pin(fut) } } @@ -2916,8 +4001,14 @@ pub mod node_service_server { let method = DeleteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2926,12 +4017,23 @@ pub mod node_service_server { "/node_service.NodeService/VerifyFile" => { #[allow(non_camel_case_types)] struct VerifyFileSvc(pub Arc); - impl tonic::server::UnaryService for VerifyFileSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for VerifyFileSvc { type Response = super::VerifyFileResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::verify_file(&inner, request).await }; + let fut = async move { + ::verify_file(&inner, request).await + }; Box::pin(fut) } } @@ -2944,8 +4046,14 @@ pub mod node_service_server { let method = VerifyFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2954,12 +4062,23 @@ pub mod node_service_server { "/node_service.NodeService/CheckParts" => { #[allow(non_camel_case_types)] struct CheckPartsSvc(pub Arc); - impl tonic::server::UnaryService for CheckPartsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for CheckPartsSvc { type Response = super::CheckPartsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::check_parts(&inner, request).await }; + let fut = async move { + ::check_parts(&inner, request).await + }; Box::pin(fut) } } @@ -2972,8 +4091,14 @@ pub mod node_service_server { let method = CheckPartsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -2982,12 +4107,23 @@ pub mod node_service_server { "/node_service.NodeService/RenamePart" => { #[allow(non_camel_case_types)] struct RenamePartSvc(pub Arc); - impl tonic::server::UnaryService for RenamePartSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenamePartSvc { type Response = super::RenamePartResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_part(&inner, request).await }; + let fut = async move { + ::rename_part(&inner, request).await + }; Box::pin(fut) } } @@ -3000,8 +4136,14 @@ pub mod node_service_server { let method = RenamePartSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3010,12 +4152,23 @@ pub mod node_service_server { "/node_service.NodeService/RenameFile" => { #[allow(non_camel_case_types)] struct RenameFileSvc(pub Arc); - impl tonic::server::UnaryService for RenameFileSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenameFileSvc { type Response = super::RenameFileResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_file(&inner, request).await }; + let fut = async move { + ::rename_file(&inner, request).await + }; Box::pin(fut) } } @@ -3028,8 +4181,14 @@ pub mod node_service_server { let method = RenameFileSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3038,12 +4197,21 @@ pub mod node_service_server { "/node_service.NodeService/Write" => { #[allow(non_camel_case_types)] struct WriteSvc(pub Arc); - impl tonic::server::UnaryService for WriteSvc { + impl tonic::server::UnaryService + for WriteSvc { type Response = super::WriteResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write(&inner, request).await }; + let fut = async move { + ::write(&inner, request).await + }; Box::pin(fut) } } @@ -3056,8 +4224,14 @@ pub mod node_service_server { let method = WriteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3066,13 +4240,26 @@ pub mod node_service_server { "/node_service.NodeService/WriteStream" => { #[allow(non_camel_case_types)] struct WriteStreamSvc(pub Arc); - impl tonic::server::StreamingService for WriteStreamSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for WriteStreamSvc { type Response = super::WriteResponse; type ResponseStream = T::WriteStreamStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_stream(&inner, request).await }; + let fut = async move { + ::write_stream(&inner, request).await + }; Box::pin(fut) } } @@ -3085,8 +4272,14 @@ pub mod node_service_server { let method = WriteStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3095,13 +4288,26 @@ pub mod node_service_server { "/node_service.NodeService/ReadAt" => { #[allow(non_camel_case_types)] struct ReadAtSvc(pub Arc); - impl tonic::server::StreamingService for ReadAtSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for ReadAtSvc { type Response = super::ReadAtResponse; type ResponseStream = T::ReadAtStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_at(&inner, request).await }; + let fut = async move { + ::read_at(&inner, request).await + }; Box::pin(fut) } } @@ -3114,8 +4320,14 @@ pub mod node_service_server { let method = ReadAtSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3124,12 +4336,23 @@ pub mod node_service_server { "/node_service.NodeService/ListDir" => { #[allow(non_camel_case_types)] struct ListDirSvc(pub Arc); - impl tonic::server::UnaryService for ListDirSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListDirSvc { type Response = super::ListDirResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_dir(&inner, request).await }; + let fut = async move { + ::list_dir(&inner, request).await + }; Box::pin(fut) } } @@ -3142,8 +4365,14 @@ pub mod node_service_server { let method = ListDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3152,13 +4381,24 @@ pub mod node_service_server { "/node_service.NodeService/WalkDir" => { #[allow(non_camel_case_types)] struct WalkDirSvc(pub Arc); - impl tonic::server::ServerStreamingService for WalkDirSvc { + impl< + T: NodeService, + > tonic::server::ServerStreamingService + for WalkDirSvc { type Response = super::WalkDirResponse; type ResponseStream = T::WalkDirStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::walk_dir(&inner, request).await }; + let fut = async move { + ::walk_dir(&inner, request).await + }; Box::pin(fut) } } @@ -3171,8 +4411,14 @@ pub mod node_service_server { let method = WalkDirSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.server_streaming(method, req).await; Ok(res) }; @@ -3181,12 +4427,23 @@ pub mod node_service_server { "/node_service.NodeService/RenameData" => { #[allow(non_camel_case_types)] struct RenameDataSvc(pub Arc); - impl tonic::server::UnaryService for RenameDataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RenameDataSvc { type Response = super::RenameDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::rename_data(&inner, request).await }; + let fut = async move { + ::rename_data(&inner, request).await + }; Box::pin(fut) } } @@ -3199,8 +4456,14 @@ pub mod node_service_server { let method = RenameDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3209,12 +4472,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolumes" => { #[allow(non_camel_case_types)] struct MakeVolumesSvc(pub Arc); - impl tonic::server::UnaryService for MakeVolumesSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeVolumesSvc { type Response = super::MakeVolumesResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_volumes(&inner, request).await }; + let fut = async move { + ::make_volumes(&inner, request).await + }; Box::pin(fut) } } @@ -3227,8 +4501,14 @@ pub mod node_service_server { let method = MakeVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3237,12 +4517,23 @@ pub mod node_service_server { "/node_service.NodeService/MakeVolume" => { #[allow(non_camel_case_types)] struct MakeVolumeSvc(pub Arc); - impl tonic::server::UnaryService for MakeVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for MakeVolumeSvc { type Response = super::MakeVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::make_volume(&inner, request).await }; + let fut = async move { + ::make_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3255,8 +4546,14 @@ pub mod node_service_server { let method = MakeVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3265,12 +4562,23 @@ pub mod node_service_server { "/node_service.NodeService/ListVolumes" => { #[allow(non_camel_case_types)] struct ListVolumesSvc(pub Arc); - impl tonic::server::UnaryService for ListVolumesSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ListVolumesSvc { type Response = super::ListVolumesResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::list_volumes(&inner, request).await }; + let fut = async move { + ::list_volumes(&inner, request).await + }; Box::pin(fut) } } @@ -3283,8 +4591,14 @@ pub mod node_service_server { let method = ListVolumesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3293,12 +4607,23 @@ pub mod node_service_server { "/node_service.NodeService/StatVolume" => { #[allow(non_camel_case_types)] struct StatVolumeSvc(pub Arc); - impl tonic::server::UnaryService for StatVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StatVolumeSvc { type Response = super::StatVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::stat_volume(&inner, request).await }; + let fut = async move { + ::stat_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3311,8 +4636,14 @@ pub mod node_service_server { let method = StatVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3321,12 +4652,23 @@ pub mod node_service_server { "/node_service.NodeService/DeletePaths" => { #[allow(non_camel_case_types)] struct DeletePathsSvc(pub Arc); - impl tonic::server::UnaryService for DeletePathsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeletePathsSvc { type Response = super::DeletePathsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_paths(&inner, request).await }; + let fut = async move { + ::delete_paths(&inner, request).await + }; Box::pin(fut) } } @@ -3339,8 +4681,14 @@ pub mod node_service_server { let method = DeletePathsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3349,12 +4697,23 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetadata" => { #[allow(non_camel_case_types)] struct UpdateMetadataSvc(pub Arc); - impl tonic::server::UnaryService for UpdateMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UpdateMetadataSvc { type Response = super::UpdateMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::update_metadata(&inner, request).await }; + let fut = async move { + ::update_metadata(&inner, request).await + }; Box::pin(fut) } } @@ -3367,8 +4726,14 @@ pub mod node_service_server { let method = UpdateMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3377,12 +4742,23 @@ pub mod node_service_server { "/node_service.NodeService/WriteMetadata" => { #[allow(non_camel_case_types)] struct WriteMetadataSvc(pub Arc); - impl tonic::server::UnaryService for WriteMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for WriteMetadataSvc { type Response = super::WriteMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::write_metadata(&inner, request).await }; + let fut = async move { + ::write_metadata(&inner, request).await + }; Box::pin(fut) } } @@ -3395,8 +4771,14 @@ pub mod node_service_server { let method = WriteMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3405,12 +4787,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadVersion" => { #[allow(non_camel_case_types)] struct ReadVersionSvc(pub Arc); - impl tonic::server::UnaryService for ReadVersionSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadVersionSvc { type Response = super::ReadVersionResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_version(&inner, request).await }; + let fut = async move { + ::read_version(&inner, request).await + }; Box::pin(fut) } } @@ -3423,8 +4816,14 @@ pub mod node_service_server { let method = ReadVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3433,12 +4832,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadXL" => { #[allow(non_camel_case_types)] struct ReadXLSvc(pub Arc); - impl tonic::server::UnaryService for ReadXLSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadXLSvc { type Response = super::ReadXlResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_xl(&inner, request).await }; + let fut = async move { + ::read_xl(&inner, request).await + }; Box::pin(fut) } } @@ -3451,8 +4861,14 @@ pub mod node_service_server { let method = ReadXLSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3461,12 +4877,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersion" => { #[allow(non_camel_case_types)] struct DeleteVersionSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVersionSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVersionSvc { type Response = super::DeleteVersionResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_version(&inner, request).await }; + let fut = async move { + ::delete_version(&inner, request).await + }; Box::pin(fut) } } @@ -3479,8 +4906,14 @@ pub mod node_service_server { let method = DeleteVersionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3489,12 +4922,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVersions" => { #[allow(non_camel_case_types)] struct DeleteVersionsSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVersionsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVersionsSvc { type Response = super::DeleteVersionsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_versions(&inner, request).await }; + let fut = async move { + ::delete_versions(&inner, request).await + }; Box::pin(fut) } } @@ -3507,8 +4951,14 @@ pub mod node_service_server { let method = DeleteVersionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3517,12 +4967,23 @@ pub mod node_service_server { "/node_service.NodeService/ReadMultiple" => { #[allow(non_camel_case_types)] struct ReadMultipleSvc(pub Arc); - impl tonic::server::UnaryService for ReadMultipleSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReadMultipleSvc { type Response = super::ReadMultipleResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::read_multiple(&inner, request).await }; + let fut = async move { + ::read_multiple(&inner, request).await + }; Box::pin(fut) } } @@ -3535,8 +4996,14 @@ pub mod node_service_server { let method = ReadMultipleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3545,12 +5012,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteVolume" => { #[allow(non_camel_case_types)] struct DeleteVolumeSvc(pub Arc); - impl tonic::server::UnaryService for DeleteVolumeSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteVolumeSvc { type Response = super::DeleteVolumeResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_volume(&inner, request).await }; + let fut = async move { + ::delete_volume(&inner, request).await + }; Box::pin(fut) } } @@ -3563,8 +5041,14 @@ pub mod node_service_server { let method = DeleteVolumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3573,12 +5057,23 @@ pub mod node_service_server { "/node_service.NodeService/DiskInfo" => { #[allow(non_camel_case_types)] struct DiskInfoSvc(pub Arc); - impl tonic::server::UnaryService for DiskInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DiskInfoSvc { type Response = super::DiskInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::disk_info(&inner, request).await }; + let fut = async move { + ::disk_info(&inner, request).await + }; Box::pin(fut) } } @@ -3591,8 +5086,14 @@ pub mod node_service_server { let method = DiskInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3601,13 +5102,26 @@ pub mod node_service_server { "/node_service.NodeService/NsScanner" => { #[allow(non_camel_case_types)] struct NsScannerSvc(pub Arc); - impl tonic::server::StreamingService for NsScannerSvc { + impl< + T: NodeService, + > tonic::server::StreamingService + for NsScannerSvc { type Response = super::NsScannerResponse; type ResponseStream = T::NsScannerStream; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request>) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::ns_scanner(&inner, request).await }; + let fut = async move { + ::ns_scanner(&inner, request).await + }; Box::pin(fut) } } @@ -3620,8 +5134,14 @@ pub mod node_service_server { let method = NsScannerSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.streaming(method, req).await; Ok(res) }; @@ -3630,12 +5150,23 @@ pub mod node_service_server { "/node_service.NodeService/Lock" => { #[allow(non_camel_case_types)] struct LockSvc(pub Arc); - impl tonic::server::UnaryService for LockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::lock(&inner, request).await }; + let fut = async move { + ::lock(&inner, request).await + }; Box::pin(fut) } } @@ -3648,8 +5179,14 @@ pub mod node_service_server { let method = LockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3658,12 +5195,23 @@ pub mod node_service_server { "/node_service.NodeService/UnLock" => { #[allow(non_camel_case_types)] struct UnLockSvc(pub Arc); - impl tonic::server::UnaryService for UnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::un_lock(&inner, request).await }; + let fut = async move { + ::un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3676,8 +5224,14 @@ pub mod node_service_server { let method = UnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3686,12 +5240,23 @@ pub mod node_service_server { "/node_service.NodeService/RLock" => { #[allow(non_camel_case_types)] struct RLockSvc(pub Arc); - impl tonic::server::UnaryService for RLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::r_lock(&inner, request).await }; + let fut = async move { + ::r_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3704,8 +5269,14 @@ pub mod node_service_server { let method = RLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3714,12 +5285,23 @@ pub mod node_service_server { "/node_service.NodeService/RUnLock" => { #[allow(non_camel_case_types)] struct RUnLockSvc(pub Arc); - impl tonic::server::UnaryService for RUnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::r_un_lock(&inner, request).await }; + let fut = async move { + ::r_un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3732,8 +5314,14 @@ pub mod node_service_server { let method = RUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3742,12 +5330,23 @@ pub mod node_service_server { "/node_service.NodeService/ForceUnLock" => { #[allow(non_camel_case_types)] struct ForceUnLockSvc(pub Arc); - impl tonic::server::UnaryService for ForceUnLockSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ForceUnLockSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::force_un_lock(&inner, request).await }; + let fut = async move { + ::force_un_lock(&inner, request).await + }; Box::pin(fut) } } @@ -3760,8 +5359,14 @@ pub mod node_service_server { let method = ForceUnLockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3770,12 +5375,23 @@ pub mod node_service_server { "/node_service.NodeService/Refresh" => { #[allow(non_camel_case_types)] struct RefreshSvc(pub Arc); - impl tonic::server::UnaryService for RefreshSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for RefreshSvc { type Response = super::GenerallyLockResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::refresh(&inner, request).await }; + let fut = async move { + ::refresh(&inner, request).await + }; Box::pin(fut) } } @@ -3788,8 +5404,14 @@ pub mod node_service_server { let method = RefreshSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3798,12 +5420,24 @@ pub mod node_service_server { "/node_service.NodeService/LocalStorageInfo" => { #[allow(non_camel_case_types)] struct LocalStorageInfoSvc(pub Arc); - impl tonic::server::UnaryService for LocalStorageInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LocalStorageInfoSvc { type Response = super::LocalStorageInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::local_storage_info(&inner, request).await }; + let fut = async move { + ::local_storage_info(&inner, request) + .await + }; Box::pin(fut) } } @@ -3816,8 +5450,14 @@ pub mod node_service_server { let method = LocalStorageInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3826,12 +5466,23 @@ pub mod node_service_server { "/node_service.NodeService/ServerInfo" => { #[allow(non_camel_case_types)] struct ServerInfoSvc(pub Arc); - impl tonic::server::UnaryService for ServerInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ServerInfoSvc { type Response = super::ServerInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::server_info(&inner, request).await }; + let fut = async move { + ::server_info(&inner, request).await + }; Box::pin(fut) } } @@ -3844,8 +5495,14 @@ pub mod node_service_server { let method = ServerInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3854,12 +5511,23 @@ pub mod node_service_server { "/node_service.NodeService/GetCpus" => { #[allow(non_camel_case_types)] struct GetCpusSvc(pub Arc); - impl tonic::server::UnaryService for GetCpusSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetCpusSvc { type Response = super::GetCpusResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_cpus(&inner, request).await }; + let fut = async move { + ::get_cpus(&inner, request).await + }; Box::pin(fut) } } @@ -3872,8 +5540,14 @@ pub mod node_service_server { let method = GetCpusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3882,12 +5556,23 @@ pub mod node_service_server { "/node_service.NodeService/GetNetInfo" => { #[allow(non_camel_case_types)] struct GetNetInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetNetInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetNetInfoSvc { type Response = super::GetNetInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_net_info(&inner, request).await }; + let fut = async move { + ::get_net_info(&inner, request).await + }; Box::pin(fut) } } @@ -3900,8 +5585,14 @@ pub mod node_service_server { let method = GetNetInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3910,12 +5601,23 @@ pub mod node_service_server { "/node_service.NodeService/GetPartitions" => { #[allow(non_camel_case_types)] struct GetPartitionsSvc(pub Arc); - impl tonic::server::UnaryService for GetPartitionsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetPartitionsSvc { type Response = super::GetPartitionsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_partitions(&inner, request).await }; + let fut = async move { + ::get_partitions(&inner, request).await + }; Box::pin(fut) } } @@ -3928,8 +5630,14 @@ pub mod node_service_server { let method = GetPartitionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3938,12 +5646,23 @@ pub mod node_service_server { "/node_service.NodeService/GetOsInfo" => { #[allow(non_camel_case_types)] struct GetOsInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetOsInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetOsInfoSvc { type Response = super::GetOsInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_os_info(&inner, request).await }; + let fut = async move { + ::get_os_info(&inner, request).await + }; Box::pin(fut) } } @@ -3956,8 +5675,14 @@ pub mod node_service_server { let method = GetOsInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3966,12 +5691,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSELinuxInfo" => { #[allow(non_camel_case_types)] struct GetSELinuxInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetSELinuxInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSELinuxInfoSvc { type Response = super::GetSeLinuxInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_se_linux_info(&inner, request).await }; + let fut = async move { + ::get_se_linux_info(&inner, request).await + }; Box::pin(fut) } } @@ -3984,8 +5720,14 @@ pub mod node_service_server { let method = GetSELinuxInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -3994,12 +5736,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSysConfig" => { #[allow(non_camel_case_types)] struct GetSysConfigSvc(pub Arc); - impl tonic::server::UnaryService for GetSysConfigSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSysConfigSvc { type Response = super::GetSysConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sys_config(&inner, request).await }; + let fut = async move { + ::get_sys_config(&inner, request).await + }; Box::pin(fut) } } @@ -4012,8 +5765,14 @@ pub mod node_service_server { let method = GetSysConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4022,12 +5781,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSysErrors" => { #[allow(non_camel_case_types)] struct GetSysErrorsSvc(pub Arc); - impl tonic::server::UnaryService for GetSysErrorsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSysErrorsSvc { type Response = super::GetSysErrorsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sys_errors(&inner, request).await }; + let fut = async move { + ::get_sys_errors(&inner, request).await + }; Box::pin(fut) } } @@ -4040,8 +5810,14 @@ pub mod node_service_server { let method = GetSysErrorsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4050,12 +5826,23 @@ pub mod node_service_server { "/node_service.NodeService/GetMemInfo" => { #[allow(non_camel_case_types)] struct GetMemInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetMemInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMemInfoSvc { type Response = super::GetMemInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_mem_info(&inner, request).await }; + let fut = async move { + ::get_mem_info(&inner, request).await + }; Box::pin(fut) } } @@ -4068,8 +5855,14 @@ pub mod node_service_server { let method = GetMemInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4078,12 +5871,23 @@ pub mod node_service_server { "/node_service.NodeService/GetMetrics" => { #[allow(non_camel_case_types)] struct GetMetricsSvc(pub Arc); - impl tonic::server::UnaryService for GetMetricsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMetricsSvc { type Response = super::GetMetricsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_metrics(&inner, request).await }; + let fut = async move { + ::get_metrics(&inner, request).await + }; Box::pin(fut) } } @@ -4096,8 +5900,14 @@ pub mod node_service_server { let method = GetMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4106,12 +5916,23 @@ pub mod node_service_server { "/node_service.NodeService/GetProcInfo" => { #[allow(non_camel_case_types)] struct GetProcInfoSvc(pub Arc); - impl tonic::server::UnaryService for GetProcInfoSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetProcInfoSvc { type Response = super::GetProcInfoResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_proc_info(&inner, request).await }; + let fut = async move { + ::get_proc_info(&inner, request).await + }; Box::pin(fut) } } @@ -4124,8 +5945,14 @@ pub mod node_service_server { let method = GetProcInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4134,12 +5961,23 @@ pub mod node_service_server { "/node_service.NodeService/StartProfiling" => { #[allow(non_camel_case_types)] struct StartProfilingSvc(pub Arc); - impl tonic::server::UnaryService for StartProfilingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StartProfilingSvc { type Response = super::StartProfilingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::start_profiling(&inner, request).await }; + let fut = async move { + ::start_profiling(&inner, request).await + }; Box::pin(fut) } } @@ -4152,8 +5990,14 @@ pub mod node_service_server { let method = StartProfilingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4162,12 +6006,24 @@ pub mod node_service_server { "/node_service.NodeService/DownloadProfileData" => { #[allow(non_camel_case_types)] struct DownloadProfileDataSvc(pub Arc); - impl tonic::server::UnaryService for DownloadProfileDataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DownloadProfileDataSvc { type Response = super::DownloadProfileDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::download_profile_data(&inner, request).await }; + let fut = async move { + ::download_profile_data(&inner, request) + .await + }; Box::pin(fut) } } @@ -4180,8 +6036,14 @@ pub mod node_service_server { let method = DownloadProfileDataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4190,12 +6052,23 @@ pub mod node_service_server { "/node_service.NodeService/GetBucketStats" => { #[allow(non_camel_case_types)] struct GetBucketStatsSvc(pub Arc); - impl tonic::server::UnaryService for GetBucketStatsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetBucketStatsSvc { type Response = super::GetBucketStatsDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_bucket_stats(&inner, request).await }; + let fut = async move { + ::get_bucket_stats(&inner, request).await + }; Box::pin(fut) } } @@ -4208,8 +6081,14 @@ pub mod node_service_server { let method = GetBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4218,12 +6097,23 @@ pub mod node_service_server { "/node_service.NodeService/GetSRMetrics" => { #[allow(non_camel_case_types)] struct GetSRMetricsSvc(pub Arc); - impl tonic::server::UnaryService for GetSRMetricsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetSRMetricsSvc { type Response = super::GetSrMetricsDataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_sr_metrics(&inner, request).await }; + let fut = async move { + ::get_sr_metrics(&inner, request).await + }; Box::pin(fut) } } @@ -4236,8 +6126,14 @@ pub mod node_service_server { let method = GetSRMetricsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4246,12 +6142,24 @@ pub mod node_service_server { "/node_service.NodeService/GetAllBucketStats" => { #[allow(non_camel_case_types)] struct GetAllBucketStatsSvc(pub Arc); - impl tonic::server::UnaryService for GetAllBucketStatsSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetAllBucketStatsSvc { type Response = super::GetAllBucketStatsResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_all_bucket_stats(&inner, request).await }; + let fut = async move { + ::get_all_bucket_stats(&inner, request) + .await + }; Box::pin(fut) } } @@ -4264,8 +6172,14 @@ pub mod node_service_server { let method = GetAllBucketStatsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4274,12 +6188,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadBucketMetadata" => { #[allow(non_camel_case_types)] struct LoadBucketMetadataSvc(pub Arc); - impl tonic::server::UnaryService for LoadBucketMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadBucketMetadataSvc { type Response = super::LoadBucketMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_bucket_metadata(&inner, request).await }; + let fut = async move { + ::load_bucket_metadata(&inner, request) + .await + }; Box::pin(fut) } } @@ -4292,8 +6218,14 @@ pub mod node_service_server { let method = LoadBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4302,12 +6234,24 @@ pub mod node_service_server { "/node_service.NodeService/DeleteBucketMetadata" => { #[allow(non_camel_case_types)] struct DeleteBucketMetadataSvc(pub Arc); - impl tonic::server::UnaryService for DeleteBucketMetadataSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteBucketMetadataSvc { type Response = super::DeleteBucketMetadataResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_bucket_metadata(&inner, request).await }; + let fut = async move { + ::delete_bucket_metadata(&inner, request) + .await + }; Box::pin(fut) } } @@ -4320,8 +6264,14 @@ pub mod node_service_server { let method = DeleteBucketMetadataSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4330,12 +6280,23 @@ pub mod node_service_server { "/node_service.NodeService/DeletePolicy" => { #[allow(non_camel_case_types)] struct DeletePolicySvc(pub Arc); - impl tonic::server::UnaryService for DeletePolicySvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeletePolicySvc { type Response = super::DeletePolicyResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_policy(&inner, request).await }; + let fut = async move { + ::delete_policy(&inner, request).await + }; Box::pin(fut) } } @@ -4348,8 +6309,14 @@ pub mod node_service_server { let method = DeletePolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4358,12 +6325,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicy" => { #[allow(non_camel_case_types)] struct LoadPolicySvc(pub Arc); - impl tonic::server::UnaryService for LoadPolicySvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadPolicySvc { type Response = super::LoadPolicyResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_policy(&inner, request).await }; + let fut = async move { + ::load_policy(&inner, request).await + }; Box::pin(fut) } } @@ -4376,8 +6354,14 @@ pub mod node_service_server { let method = LoadPolicySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4386,12 +6370,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadPolicyMapping" => { #[allow(non_camel_case_types)] struct LoadPolicyMappingSvc(pub Arc); - impl tonic::server::UnaryService for LoadPolicyMappingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadPolicyMappingSvc { type Response = super::LoadPolicyMappingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_policy_mapping(&inner, request).await }; + let fut = async move { + ::load_policy_mapping(&inner, request) + .await + }; Box::pin(fut) } } @@ -4404,8 +6400,14 @@ pub mod node_service_server { let method = LoadPolicyMappingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4414,12 +6416,23 @@ pub mod node_service_server { "/node_service.NodeService/DeleteUser" => { #[allow(non_camel_case_types)] struct DeleteUserSvc(pub Arc); - impl tonic::server::UnaryService for DeleteUserSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteUserSvc { type Response = super::DeleteUserResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_user(&inner, request).await }; + let fut = async move { + ::delete_user(&inner, request).await + }; Box::pin(fut) } } @@ -4432,8 +6445,14 @@ pub mod node_service_server { let method = DeleteUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4442,12 +6461,24 @@ pub mod node_service_server { "/node_service.NodeService/DeleteServiceAccount" => { #[allow(non_camel_case_types)] struct DeleteServiceAccountSvc(pub Arc); - impl tonic::server::UnaryService for DeleteServiceAccountSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for DeleteServiceAccountSvc { type Response = super::DeleteServiceAccountResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::delete_service_account(&inner, request).await }; + let fut = async move { + ::delete_service_account(&inner, request) + .await + }; Box::pin(fut) } } @@ -4460,8 +6491,14 @@ pub mod node_service_server { let method = DeleteServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4470,12 +6507,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadUser" => { #[allow(non_camel_case_types)] struct LoadUserSvc(pub Arc); - impl tonic::server::UnaryService for LoadUserSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadUserSvc { type Response = super::LoadUserResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_user(&inner, request).await }; + let fut = async move { + ::load_user(&inner, request).await + }; Box::pin(fut) } } @@ -4488,8 +6536,14 @@ pub mod node_service_server { let method = LoadUserSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4498,12 +6552,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadServiceAccount" => { #[allow(non_camel_case_types)] struct LoadServiceAccountSvc(pub Arc); - impl tonic::server::UnaryService for LoadServiceAccountSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadServiceAccountSvc { type Response = super::LoadServiceAccountResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_service_account(&inner, request).await }; + let fut = async move { + ::load_service_account(&inner, request) + .await + }; Box::pin(fut) } } @@ -4516,8 +6582,14 @@ pub mod node_service_server { let method = LoadServiceAccountSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4526,12 +6598,23 @@ pub mod node_service_server { "/node_service.NodeService/LoadGroup" => { #[allow(non_camel_case_types)] struct LoadGroupSvc(pub Arc); - impl tonic::server::UnaryService for LoadGroupSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadGroupSvc { type Response = super::LoadGroupResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_group(&inner, request).await }; + let fut = async move { + ::load_group(&inner, request).await + }; Box::pin(fut) } } @@ -4544,8 +6627,14 @@ pub mod node_service_server { let method = LoadGroupSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4554,14 +6643,30 @@ pub mod node_service_server { "/node_service.NodeService/ReloadSiteReplicationConfig" => { #[allow(non_camel_case_types)] struct ReloadSiteReplicationConfigSvc(pub Arc); - impl tonic::server::UnaryService - for ReloadSiteReplicationConfigSvc - { + impl< + T: NodeService, + > tonic::server::UnaryService< + super::ReloadSiteReplicationConfigRequest, + > for ReloadSiteReplicationConfigSvc { type Response = super::ReloadSiteReplicationConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::ReloadSiteReplicationConfigRequest, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::reload_site_replication_config(&inner, request).await }; + let fut = async move { + ::reload_site_replication_config( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4574,8 +6679,14 @@ pub mod node_service_server { let method = ReloadSiteReplicationConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4584,12 +6695,23 @@ pub mod node_service_server { "/node_service.NodeService/SignalService" => { #[allow(non_camel_case_types)] struct SignalServiceSvc(pub Arc); - impl tonic::server::UnaryService for SignalServiceSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for SignalServiceSvc { type Response = super::SignalServiceResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::signal_service(&inner, request).await }; + let fut = async move { + ::signal_service(&inner, request).await + }; Box::pin(fut) } } @@ -4602,8 +6724,14 @@ pub mod node_service_server { let method = SignalServiceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4612,12 +6740,24 @@ pub mod node_service_server { "/node_service.NodeService/BackgroundHealStatus" => { #[allow(non_camel_case_types)] struct BackgroundHealStatusSvc(pub Arc); - impl tonic::server::UnaryService for BackgroundHealStatusSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for BackgroundHealStatusSvc { type Response = super::BackgroundHealStatusResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::background_heal_status(&inner, request).await }; + let fut = async move { + ::background_heal_status(&inner, request) + .await + }; Box::pin(fut) } } @@ -4630,8 +6770,14 @@ pub mod node_service_server { let method = BackgroundHealStatusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4640,12 +6786,24 @@ pub mod node_service_server { "/node_service.NodeService/GetMetacacheListing" => { #[allow(non_camel_case_types)] struct GetMetacacheListingSvc(pub Arc); - impl tonic::server::UnaryService for GetMetacacheListingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for GetMetacacheListingSvc { type Response = super::GetMetacacheListingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::get_metacache_listing(&inner, request).await }; + let fut = async move { + ::get_metacache_listing(&inner, request) + .await + }; Box::pin(fut) } } @@ -4658,8 +6816,14 @@ pub mod node_service_server { let method = GetMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4668,12 +6832,27 @@ pub mod node_service_server { "/node_service.NodeService/UpdateMetacacheListing" => { #[allow(non_camel_case_types)] struct UpdateMetacacheListingSvc(pub Arc); - impl tonic::server::UnaryService for UpdateMetacacheListingSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for UpdateMetacacheListingSvc { type Response = super::UpdateMetacacheListingResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::update_metacache_listing(&inner, request).await }; + let fut = async move { + ::update_metacache_listing( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4686,8 +6865,14 @@ pub mod node_service_server { let method = UpdateMetacacheListingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4696,12 +6881,23 @@ pub mod node_service_server { "/node_service.NodeService/ReloadPoolMeta" => { #[allow(non_camel_case_types)] struct ReloadPoolMetaSvc(pub Arc); - impl tonic::server::UnaryService for ReloadPoolMetaSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for ReloadPoolMetaSvc { type Response = super::ReloadPoolMetaResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::reload_pool_meta(&inner, request).await }; + let fut = async move { + ::reload_pool_meta(&inner, request).await + }; Box::pin(fut) } } @@ -4714,8 +6910,14 @@ pub mod node_service_server { let method = ReloadPoolMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4724,12 +6926,23 @@ pub mod node_service_server { "/node_service.NodeService/StopRebalance" => { #[allow(non_camel_case_types)] struct StopRebalanceSvc(pub Arc); - impl tonic::server::UnaryService for StopRebalanceSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for StopRebalanceSvc { type Response = super::StopRebalanceResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::stop_rebalance(&inner, request).await }; + let fut = async move { + ::stop_rebalance(&inner, request).await + }; Box::pin(fut) } } @@ -4742,8 +6955,14 @@ pub mod node_service_server { let method = StopRebalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4752,12 +6971,24 @@ pub mod node_service_server { "/node_service.NodeService/LoadRebalanceMeta" => { #[allow(non_camel_case_types)] struct LoadRebalanceMetaSvc(pub Arc); - impl tonic::server::UnaryService for LoadRebalanceMetaSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadRebalanceMetaSvc { type Response = super::LoadRebalanceMetaResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_rebalance_meta(&inner, request).await }; + let fut = async move { + ::load_rebalance_meta(&inner, request) + .await + }; Box::pin(fut) } } @@ -4770,8 +7001,14 @@ pub mod node_service_server { let method = LoadRebalanceMetaSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; @@ -4780,12 +7017,29 @@ pub mod node_service_server { "/node_service.NodeService/LoadTransitionTierConfig" => { #[allow(non_camel_case_types)] struct LoadTransitionTierConfigSvc(pub Arc); - impl tonic::server::UnaryService for LoadTransitionTierConfigSvc { + impl< + T: NodeService, + > tonic::server::UnaryService + for LoadTransitionTierConfigSvc { type Response = super::LoadTransitionTierConfigResponse; - type Future = BoxFuture, tonic::Status>; - fn call(&mut self, request: tonic::Request) -> Self::Future { + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::LoadTransitionTierConfigRequest, + >, + ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { ::load_transition_tier_config(&inner, request).await }; + let fut = async move { + ::load_transition_tier_config( + &inner, + request, + ) + .await + }; Box::pin(fut) } } @@ -4798,20 +7052,36 @@ pub mod node_service_server { let method = LoadTransitionTierConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config(accept_compression_encodings, send_compression_encodings) - .apply_max_message_size_config(max_decoding_message_size, max_encoding_message_size); + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } - _ => Box::pin(async move { - let mut response = http::Response::new(empty_body()); - let headers = response.headers_mut(); - headers.insert(tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into()); - headers.insert(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE); - Ok(response) - }), + _ => { + Box::pin(async move { + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } } } } diff --git a/scripts/test.sh b/scripts/test.sh index 1120e2e47..1a3c8ecd5 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -48,7 +48,7 @@ mc rm rustfs/dada/test2.txt mc ls rustfs/dada -dd if=/dev/urandom of=50M.file bs=1M count=50 +dd if=/dev/urandom of=50M.file bs=1m count=50 mc cp 50M.file rustfs/dada From ff23706b1066314b7161464f5ecb331e45696bec Mon Sep 17 00:00:00 2001 From: weisd Date: Tue, 24 Dec 2024 17:15:20 +0800 Subject: [PATCH 75/77] marker done, need test --- ecstore/src/cache_value/metacache_set.rs | 4 +- ecstore/src/disk/local.rs | 47 ++- ecstore/src/disk/mod.rs | 150 +++++--- ecstore/src/set_disk.rs | 44 ++- ecstore/src/sets.rs | 18 +- ecstore/src/store.rs | 58 +-- ecstore/src/store_api.rs | 34 +- ecstore/src/store_list_objects.rs | 440 ++++++++++++++++------- iam/src/store/object.rs | 2 +- rustfs/src/grpc.rs | 2 +- rustfs/src/storage/ecfs.rs | 41 +-- 11 files changed, 545 insertions(+), 295 deletions(-) diff --git a/ecstore/src/cache_value/metacache_set.rs b/ecstore/src/cache_value/metacache_set.rs index 6409bd78d..5e1ff84d6 100644 --- a/ecstore/src/cache_value/metacache_set.rs +++ b/ecstore/src/cache_value/metacache_set.rs @@ -27,8 +27,8 @@ pub struct ListPathRawOptions { pub bucket: String, pub path: String, pub recursice: bool, - pub filter_prefix: String, - pub forward_to: String, + pub filter_prefix: Option, + pub forward_to: Option, pub min_disks: usize, pub report_not_found: bool, pub per_disk_limit: i32, diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 0b6da5aff..d4082592f 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -729,16 +729,29 @@ impl LocalDisk { objs_returned: &mut i32, ) -> Result<()> { let forward = { - if !opts.forward_to.is_empty() && opts.forward_to.starts_with(&*current) { - let forward = opts.forward_to.trim_start_matches(&*current); + opts.forward_to.as_ref().filter(|v| v.starts_with(&*current)).map(|v| { + let forward = v.trim_start_matches(&*current); if let Some(idx) = forward.find('/') { - &forward[..idx] + forward[..idx].to_owned() } else { - forward + forward.to_owned() } - } else { - "" - } + }) + // if let Some(forward_to) = &opts.forward_to { + + // } else { + // None + // } + // if !opts.forward_to.is_empty() && opts.forward_to.starts_with(&*current) { + // let forward = opts.forward_to.trim_start_matches(&*current); + // if let Some(idx) = forward.find('/') { + // &forward[..idx] + // } else { + // forward + // } + // } else { + // "" + // } }; if opts.limit > 0 && *objs_returned >= opts.limit { @@ -781,14 +794,18 @@ impl LocalDisk { return Ok(()); } // check prefix - if !opts.filter_prefix.is_empty() && !entry.starts_with(&opts.filter_prefix) { - *item = "".to_owned(); - continue; + if let Some(filter_prefix) = &opts.filter_prefix { + if !entry.starts_with(filter_prefix) { + *item = "".to_owned(); + continue; + } } - if !forward.is_empty() && entry.as_str() < forward { - *item = "".to_owned(); - continue; + if let Some(forward) = &forward { + if &entry < forward { + *item = "".to_owned(); + continue; + } } if entry.ends_with(SLASH_SEPARATOR) { @@ -828,9 +845,9 @@ impl LocalDisk { entries.sort(); let mut entries = entries.as_slice(); - if !forward.is_empty() { + if let Some(forward) = &forward { for (i, entry) in entries.iter().enumerate() { - if entry.as_str() >= forward || forward.starts_with(entry.as_str()) { + if entry >= forward || forward.starts_with(entry.as_str()) { entries = &entries[i..]; break; } diff --git a/ecstore/src/disk/mod.rs b/ecstore/src/disk/mod.rs index 254a2c9ff..dc6333b89 100644 --- a/ecstore/src/disk/mod.rs +++ b/ecstore/src/disk/mod.rs @@ -25,6 +25,7 @@ use crate::{ heal_commands::{HealScanMode, HealingTracker}, }, store_api::{FileInfo, ObjectInfo, RawFileInfo}, + utils::path::SLASH_SEPARATOR, }; use endpoint::Endpoint; use error::DiskError; @@ -566,8 +567,6 @@ impl FileInfoVersions { let vid = Uuid::parse_str(v).unwrap_or(Uuid::nil()); - for ver in self.versions.iter() {} - self.versions.iter().position(|v| v.version_id == Some(vid)) } } @@ -586,10 +585,10 @@ pub struct WalkDirOptions { // FilterPrefix will only return results with given prefix within folder. // Should never contain a slash. - pub filter_prefix: String, + pub filter_prefix: Option, // ForwardTo will forward to the given object path. - pub forward_to: String, + pub forward_to: Option, // Limit the number of returned objects if > 0. pub limit: i32, @@ -639,10 +638,29 @@ impl MetaCacheEntry { pub fn is_dir(&self) -> bool { self.metadata.is_empty() && self.name.ends_with('/') } + pub fn is_in_dir(&self, dir: &str, separator: &str) -> bool { + if dir.is_empty() { + let idx = self.name.find(separator); + return idx.is_none() || idx.unwrap() == self.name.len() - separator.len(); + } + + let ext = self.name.trim_start_matches(dir); + + if ext.len() != self.name.len() { + let idx = ext.find(separator); + return idx.is_none() || idx.unwrap() == ext.len() - separator.len(); + } + + false + } pub fn is_object(&self) -> bool { !self.metadata.is_empty() } + pub fn is_object_dir(&self) -> bool { + !self.metadata.is_empty() && self.name.ends_with(SLASH_SEPARATOR) + } + pub fn is_latest_deletemarker(&mut self) -> bool { if let Some(cached) = &self.cached { if cached.versions.is_empty() { @@ -838,7 +856,7 @@ impl MetaCacheEntry { } } -#[derive(Debug)] +#[derive(Debug, Default)] pub struct MetaCacheEntries(pub Vec>); impl MetaCacheEntries { @@ -936,26 +954,50 @@ impl MetaCacheEntries { } } -#[derive(Debug)] +#[derive(Debug, Default)] +pub struct MetaCacheEntriesSortedResult { + pub entries: Option, + pub err: Option, +} + +// impl MetaCacheEntriesSortedResult { +// pub fn entriy_list(&self) -> Vec<&MetaCacheEntry> { +// if let Some(entries) = &self.entries { +// entries.entries() +// } else { +// Vec::new() +// } +// } +// } + +#[derive(Debug, Default)] pub struct MetaCacheEntriesSorted { pub o: MetaCacheEntries, - // pub list_id: String, - // pub reuse: bool, - // pub lastSkippedEntry: String, + pub list_id: Option, + pub reuse: bool, + pub last_skipped_entry: Option, } impl MetaCacheEntriesSorted { - pub fn entries(&self) -> Vec { - let entries: Vec = self.o.0.iter().flatten().cloned().collect(); + pub fn entries(&self) -> Vec<&MetaCacheEntry> { + let entries: Vec<&MetaCacheEntry> = self.o.0.iter().flatten().collect(); entries } - pub async fn file_infos(&self, bucket: &str, prefix: &str, delimiter: &str) -> Vec { + pub fn forward_past(&mut self, marker: Option) { + if let Some(val) = marker { + // TODO: reuse + if let Some(idx) = self.o.0.iter().flatten().position(|v| v.name > val) { + self.o.0 = self.o.0.split_off(idx); + } + } + } + pub async fn file_infos(&self, bucket: &str, prefix: &str, delimiter: Option) -> Vec { let vcfg = get_versioning_config(bucket).await.ok(); let mut objects = Vec::with_capacity(self.o.as_ref().len()); let mut prev_prefix = ""; for entry in self.o.as_ref().iter().flatten() { if entry.is_object() { - if !delimiter.is_empty() { + if let Some(delimiter) = &delimiter { if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { let idx = prefix.len() + idx + delimiter.len(); if let Some(curr_prefix) = entry.name.get(0..idx) { @@ -985,25 +1027,23 @@ impl MetaCacheEntriesSorted { } if entry.is_dir() { - if delimiter.is_empty() { - continue; - } + if let Some(delimiter) = &delimiter { + if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { + let idx = prefix.len() + idx + delimiter.len(); + if let Some(curr_prefix) = entry.name.get(0..idx) { + if curr_prefix == prev_prefix { + continue; + } - if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { - let idx = prefix.len() + idx + delimiter.len(); - if let Some(curr_prefix) = entry.name.get(0..idx) { - if curr_prefix == prev_prefix { - continue; + prev_prefix = curr_prefix; + + objects.push(ObjectInfo { + is_dir: true, + bucket: bucket.to_owned(), + name: curr_prefix.to_owned(), + ..Default::default() + }); } - - prev_prefix = curr_prefix; - - objects.push(ObjectInfo { - is_dir: true, - bucket: bucket.to_owned(), - name: curr_prefix.to_owned(), - ..Default::default() - }); } } } @@ -1012,14 +1052,20 @@ impl MetaCacheEntriesSorted { objects } - pub async fn file_info_versions(&self, bucket: &str, prefix: &str, delimiter: &str, after_v: &str) -> Vec { + pub async fn file_info_versions( + &self, + bucket: &str, + prefix: &str, + delimiter: Option, + after_v: Option, + ) -> Vec { let vcfg = get_versioning_config(bucket).await.ok(); let mut objects = Vec::with_capacity(self.o.as_ref().len()); let mut prev_prefix = ""; let mut after_v = after_v; for entry in self.o.as_ref().iter().flatten() { if entry.is_object() { - if !delimiter.is_empty() { + if let Some(delimiter) = &delimiter { if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { let idx = prefix.len() + idx + delimiter.len(); if let Some(curr_prefix) = entry.name.get(0..idx) { @@ -1049,13 +1095,13 @@ impl MetaCacheEntriesSorted { }; let fi_versions = 'c: { - if !after_v.is_empty() { - if let Some(idx) = fiv.find_version_index(after_v) { - after_v = ""; + if let Some(after_val) = &after_v { + if let Some(idx) = fiv.find_version_index(after_val) { + after_v = None; break 'c fiv.versions.split_off(idx + 1); } - after_v = ""; + after_v = None; break 'c fiv.versions; } else { break 'c fiv.versions; @@ -1073,25 +1119,23 @@ impl MetaCacheEntriesSorted { } if entry.is_dir() { - if delimiter.is_empty() { - continue; - } + if let Some(delimiter) = &delimiter { + if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { + let idx = prefix.len() + idx + delimiter.len(); + if let Some(curr_prefix) = entry.name.get(0..idx) { + if curr_prefix == prev_prefix { + continue; + } - if let Some(idx) = entry.name.trim_start_matches(prefix).find(delimiter) { - let idx = prefix.len() + idx + delimiter.len(); - if let Some(curr_prefix) = entry.name.get(0..idx) { - if curr_prefix == prev_prefix { - continue; + prev_prefix = curr_prefix; + + objects.push(ObjectInfo { + is_dir: true, + bucket: bucket.to_owned(), + name: curr_prefix.to_owned(), + ..Default::default() + }); } - - prev_prefix = curr_prefix; - - objects.push(ObjectInfo { - is_dir: true, - bucket: bucket.to_owned(), - name: curr_prefix.to_owned(), - ..Default::default() - }); } } } diff --git a/ecstore/src/set_disk.rs b/ecstore/src/set_disk.rs index 59c77eaf8..6883736b5 100644 --- a/ecstore/src/set_disk.rs +++ b/ecstore/src/set_disk.rs @@ -1907,9 +1907,15 @@ impl SetDisks { fallback_disks: fallback_disks.to_vec(), bucket: bucket.to_string(), path: path.to_string(), - filter_prefix: filter_prefix.to_string(), + filter_prefix: { + if filter_prefix.is_empty() { + None + } else { + Some(filter_prefix.to_string()) + } + }, recursice: true, - forward_to: "".to_string(), + forward_to: None, min_disks: 1, report_not_found: false, per_disk_limit: 0, @@ -3067,10 +3073,10 @@ impl SetDisks { continue; } - let mut forward_to = "".to_string(); + let mut forward_to = None; let b = tracker.read().await.get_bucket().await; if b == *bucket { - forward_to = tracker.read().await.get_object().await; + forward_to = Some(tracker.read().await.get_object().await); } if !b.is_empty() { @@ -3835,11 +3841,11 @@ impl StorageAPI for SetDisks { self: Arc, _bucket: &str, _prefix: &str, - _continuation_token: &str, - _delimiter: &str, + _continuation_token: Option, + _delimiter: Option, _max_keys: i32, _fetch_owner: bool, - _start_after: &str, + _start_after: Option, ) -> Result { unimplemented!() } @@ -3847,9 +3853,9 @@ impl StorageAPI for SetDisks { self: Arc, _bucket: &str, _prefix: &str, - _marker: &str, - _version_marker: &str, - _delimiter: &str, + _marker: Option, + _version_marker: Option, + _delimiter: Option, _max_keys: i32, ) -> Result { unimplemented!() @@ -4113,9 +4119,9 @@ impl StorageAPI for SetDisks { &self, bucket: &str, object: &str, - key_marker: &str, - upload_id_marker: &str, - delimiter: &str, + key_marker: Option, + upload_id_marker: Option, + delimiter: Option, max_uploads: usize, ) -> Result { let disks = { @@ -4209,14 +4215,14 @@ impl StorageAPI for SetDisks { uploads.sort_by(|a, b| a.initiated.cmp(&b.initiated)); let mut upload_idx = 0; - if !upload_id_marker.is_empty() { + if let Some(upload_id_marker) = &upload_id_marker { while upload_idx < uploads.len() { - if uploads[upload_idx].upload_id != upload_id_marker { + if &uploads[upload_idx].upload_id != upload_id_marker { upload_idx += 1; continue; } - if uploads[upload_idx].upload_id == upload_id_marker { + if &uploads[upload_idx].upload_id == upload_id_marker { upload_idx += 1; break; } @@ -4226,10 +4232,10 @@ impl StorageAPI for SetDisks { } let mut ret_uploads = Vec::new(); - let mut next_upload_id_marker = String::new(); + let mut next_upload_id_marker = None; while upload_idx < uploads.len() { ret_uploads.push(uploads[upload_idx].clone()); - next_upload_id_marker = uploads[upload_idx].upload_id.clone(); + next_upload_id_marker = Some(uploads[upload_idx].upload_id.clone()); upload_idx += 1; if ret_uploads.len() > max_uploads { @@ -4240,7 +4246,7 @@ impl StorageAPI for SetDisks { let is_truncated = ret_uploads.len() < uploads.len(); if !is_truncated { - next_upload_id_marker = "".to_owned(); + next_upload_id_marker = None; } Ok(ListMultipartsInfo { diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index 8955ef4c2..f15b6c91c 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -454,11 +454,11 @@ impl StorageAPI for Sets { self: Arc, _bucket: &str, _prefix: &str, - _continuation_token: &str, - _delimiter: &str, + _continuation_token: Option, + _delimiter: Option, _max_keys: i32, _fetch_owner: bool, - _start_after: &str, + _start_after: Option, ) -> Result { unimplemented!() } @@ -466,9 +466,9 @@ impl StorageAPI for Sets { self: Arc, _bucket: &str, _prefix: &str, - _marker: &str, - _version_marker: &str, - _delimiter: &str, + _marker: Option, + _version_marker: Option, + _delimiter: Option, _max_keys: i32, ) -> Result { unimplemented!() @@ -527,9 +527,9 @@ impl StorageAPI for Sets { &self, bucket: &str, prefix: &str, - key_marker: &str, - upload_id_marker: &str, - delimiter: &str, + key_marker: Option, + upload_id_marker: Option, + delimiter: Option, max_uploads: usize, ) -> Result { self.get_disks_by_key(prefix) diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 1d84e39c0..c9d52e6fd 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -23,7 +23,6 @@ use crate::store_err::{ to_object_err, StorageError, }; use crate::store_init::ec_drives_no_config; -use crate::store_list_objects::{max_keys_plus_one, ListPathOptions}; use crate::utils::crypto::base64_decode; use crate::utils::path::{decode_dir_object, encode_dir_object, SLASH_SEPARATOR}; use crate::utils::xml; @@ -1519,11 +1518,11 @@ impl StorageAPI for ECStore { self: Arc, bucket: &str, prefix: &str, - continuation_token: &str, - delimiter: &str, + continuation_token: Option, + delimiter: Option, max_keys: i32, fetch_owner: bool, - start_after: &str, + start_after: Option, ) -> Result { self.inner_list_objects_v2(bucket, prefix, continuation_token, delimiter, max_keys, fetch_owner, start_after) .await @@ -1532,9 +1531,9 @@ impl StorageAPI for ECStore { self: Arc, bucket: &str, prefix: &str, - marker: &str, - version_marker: &str, - delimiter: &str, + marker: Option, + version_marker: Option, + delimiter: Option, max_keys: i32, ) -> Result { self.inner_list_object_versions(bucket, prefix, marker, version_marker, delimiter, max_keys) @@ -1672,12 +1671,12 @@ impl StorageAPI for ECStore { &self, bucket: &str, prefix: &str, - key_marker: &str, - upload_id_marker: &str, - delimiter: &str, + key_marker: Option, + upload_id_marker: Option, + delimiter: Option, max_uploads: usize, ) -> Result { - check_list_multipart_args(bucket, prefix, key_marker, upload_id_marker, delimiter)?; + check_list_multipart_args(bucket, prefix, &key_marker, &upload_id_marker, &delimiter)?; if prefix.is_empty() { // TODO: return from cache @@ -1693,14 +1692,21 @@ impl StorageAPI for ECStore { for pool in self.pools.iter() { let res = pool - .list_multipart_uploads(bucket, prefix, key_marker, upload_id_marker, delimiter, max_uploads) + .list_multipart_uploads( + bucket, + prefix, + key_marker.clone(), + upload_id_marker.clone(), + delimiter.clone(), + max_uploads, + ) .await?; uploads.extend(res.uploads); } Ok(ListMultipartsInfo { - key_marker: key_marker.to_owned(), - upload_id_marker: upload_id_marker.to_owned(), + key_marker, + upload_id_marker, max_uploads, uploads, prefix: prefix.to_owned(), @@ -1718,7 +1724,7 @@ impl StorageAPI for ECStore { for (idx, pool) in self.pools.iter().enumerate() { // // TODO: IsSuspended let res = pool - .list_multipart_uploads(bucket, object, "", "", "", MAX_UPLOADS_LIST) + .list_multipart_uploads(bucket, object, None, None, None, MAX_UPLOADS_LIST) .await?; if !res.uploads.is_empty() { @@ -2203,7 +2209,7 @@ fn check_bucket_and_object_names(bucket: &str, object: &str) -> Result<()> { Ok(()) } -pub fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &str) -> Result<()> { +pub fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &Option) -> Result<()> { if !is_meta_bucketname(bucket) && check_valid_bucket_name_strict(bucket).is_err() { return Err(Error::new(StorageError::BucketNameInvalid(bucket.to_string()))); } @@ -2218,18 +2224,20 @@ pub fn check_list_objs_args(bucket: &str, prefix: &str, _marker: &str) -> Result fn check_list_multipart_args( bucket: &str, prefix: &str, - key_marker: &str, - upload_id_marker: &str, - _delimiter: &str, + key_marker: &Option, + upload_id_marker: &Option, + _delimiter: &Option, ) -> Result<()> { check_list_objs_args(bucket, prefix, key_marker)?; - if !upload_id_marker.is_empty() { - if key_marker.ends_with('/') { - return Err(Error::new(StorageError::InvalidUploadIDKeyCombination( - upload_id_marker.to_string(), - key_marker.to_string(), - ))); + if let Some(upload_id_marker) = upload_id_marker { + if let Some(key_marker) = key_marker { + if key_marker.ends_with('/') { + return Err(Error::new(StorageError::InvalidUploadIDKeyCombination( + upload_id_marker.to_string(), + key_marker.to_string(), + ))); + } } if let Err(_e) = base64_decode(upload_id_marker.as_bytes()) { diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index 1cbcc487f..cd1eb6b7d 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -688,7 +688,7 @@ pub struct ListObjectsInfo { // When response is truncated (the IsTruncated element value in the response // is true), you can use the key name in this field as marker in the subsequent // request to get next set of objects. - pub next_marker: String, + pub next_marker: Option, // List of objects info for this request. pub objects: Vec, @@ -711,8 +711,8 @@ pub struct ListObjectsV2Info { // // NOTE: This element is returned only if you have delimiter request parameter // specified. - pub continuation_token: String, - pub next_continuation_token: String, + pub continuation_token: Option, + pub next_continuation_token: Option, // List of objects info for this request. pub objects: Vec, @@ -744,20 +744,20 @@ pub struct MultipartInfo { pub struct ListMultipartsInfo { // Together with upload-id-marker, this parameter specifies the multipart upload // after which listing should begin. - pub key_marker: String, + pub key_marker: Option, // Together with key-marker, specifies the multipart upload after which listing // should begin. If key-marker is not specified, the upload-id-marker parameter // is ignored. - pub upload_id_marker: String, + pub upload_id_marker: Option, // When a list is truncated, this element specifies the value that should be // used for the key-marker request parameter in a subsequent request. - pub next_key_marker: String, + pub next_key_marker: Option, // When a list is truncated, this element specifies the value that should be // used for the upload-id-marker request parameter in a subsequent request. - pub next_upload_id_marker: String, + pub next_upload_id_marker: Option, // Maximum number of multipart uploads that could have been included in the // response. @@ -778,7 +778,7 @@ pub struct ListMultipartsInfo { // A character used to truncate the object prefixes. // NOTE: only supported delimiter is '/'. - pub delimiter: String, + pub delimiter: Option, // CommonPrefixes contains all (if there are any) keys between Prefix and the // next occurrence of the string specified by delimiter. @@ -846,20 +846,20 @@ pub trait StorageAPI: ObjectIO { self: Arc, bucket: &str, prefix: &str, - continuation_token: &str, - delimiter: &str, + continuation_token: Option, + delimiter: Option, max_keys: i32, fetch_owner: bool, - start_after: &str, + start_after: Option, ) -> Result; // ListObjectVersions TODO: FIXME: async fn list_object_versions( self: Arc, bucket: &str, prefix: &str, - marker: &str, - version_marker: &str, - delimiter: &str, + marker: Option, + version_marker: Option, + delimiter: Option, max_keys: i32, ) -> Result; // Walk TODO: @@ -884,9 +884,9 @@ pub trait StorageAPI: ObjectIO { &self, bucket: &str, prefix: &str, - key_marker: &str, - upload_id_marker: &str, - delimiter: &str, + key_marker: Option, + upload_id_marker: Option, + delimiter: Option, max_uploads: usize, ) -> Result; async fn new_multipart_upload(&self, bucket: &str, object: &str, opts: &ObjectOptions) -> Result; diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 95c2dd9d5..f4b55c338 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -1,13 +1,16 @@ use crate::cache_value::metacache_set::{list_path_raw, ListPathRawOptions}; use crate::disk::error::{is_all_not_found, is_all_volume_not_found, is_err_eof, DiskError}; -use crate::disk::{DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntriesSorted, MetaCacheEntry, MetadataResolutionParams}; +use crate::disk::{ + DiskInfo, DiskStore, MetaCacheEntries, MetaCacheEntriesSorted, MetaCacheEntriesSortedResult, MetaCacheEntry, + MetadataResolutionParams, +}; use crate::error::{Error, Result}; use crate::file_meta::merge_file_meta_versions; use crate::peer::is_reserved_or_invalid_bucket; use crate::set_disk::SetDisks; use crate::store::check_list_objs_args; use crate::store_api::{ListObjectVersionsInfo, ListObjectsInfo, ObjectInfo, ObjectOptions}; -use crate::store_err::{is_err_bucket_exists, is_err_bucket_not_found, StorageError}; +use crate::store_err::{is_err_bucket_not_found, to_object_err, StorageError}; use crate::utils::path::{self, base_dir_from_prefix, SLASH_SEPARATOR}; use crate::StorageAPI; use crate::{store::ECStore, store_api::ListObjectsV2Info}; @@ -20,6 +23,7 @@ use std::sync::Arc; use tokio::sync::broadcast::{self, Receiver as B_Receiver}; use tokio::sync::mpsc::{self, Receiver, Sender}; use tracing::error; +use uuid::Uuid; const MAX_OBJECT_LIST: i32 = 1000; // const MAX_DELETE_LIST: i32 = 1000; @@ -41,7 +45,7 @@ pub fn max_keys_plus_one(max_keys: i32, add_one: bool) -> i32 { #[derive(Debug, Default, Clone)] pub struct ListPathOptions { - pub id: String, + pub id: Option, // Bucket of the listing. pub bucket: String, @@ -56,11 +60,11 @@ pub struct ListPathOptions { // FilterPrefix will return only results with this prefix when scanning. // Should never contain a slash. // Prefix should still be set. - pub filter_prefix: String, + pub filter_prefix: Option, // Marker to resume listing. // The response will be the first entry >= this object name. - pub marker: String, + pub marker: Option, // Limit the number of results. pub limit: i32, @@ -77,7 +81,7 @@ pub struct ListPathOptions { pub recursive: bool, // Separator to use. - pub separator: String, + pub separator: Option, // Create indicates that the lister should not attempt to load an existing cache. pub create: bool, @@ -94,8 +98,13 @@ pub struct ListPathOptions { pub versioned: bool, pub stop_disk_at_limit: bool, + + pub pool_idx: Option, + pub set_idx: Option, } +const MARKER_TAG_VERSION: &str = "v1"; + impl ListPathOptions { pub fn set_filter(&mut self) { if METACACHE_SHARE_PREFIX { @@ -106,10 +115,79 @@ impl ListPathOptions { } let s = SLASH_SEPARATOR.chars().next().unwrap_or_default(); - self.filter_prefix = self.prefix.trim_start_matches(&self.base_dir).trim_matches(s).to_owned(); + self.filter_prefix = { + let fp = self.prefix.trim_start_matches(&self.base_dir).trim_matches(s); - if self.filter_prefix.contains(s) { - self.filter_prefix = "".to_owned(); + if fp.contains(s) || fp.is_empty() { + None + } else { + Some(fp.to_owned()) + } + } + } + + pub fn parse_marker(&mut self) { + if let Some(marker) = &self.marker { + let s = marker.clone(); + if !s.contains(format!("[rustfs_cache:{}", MARKER_TAG_VERSION).as_str()) { + return; + } + + if let (Some(start_idx), Some(end_idx)) = (s.find("["), s.find("]")) { + self.marker = Some(s[0..start_idx].to_owned()); + let tags: Vec<_> = s[start_idx..end_idx].trim_matches(['[', ']']).split(",").collect(); + + for &tag in tags.iter() { + let kv: Vec<_> = tag.split(":").collect(); + if kv.len() != 2 { + continue; + } + + match kv[0] { + "rustfs_cache" => { + if kv[1] != MARKER_TAG_VERSION { + continue; + } + } + "id" => self.id = Some(kv[1].to_owned()), + "return" => { + self.id = Some(Uuid::new_v4().to_string()); + self.create = true; + } + "p" => match kv[1].parse::() { + Ok(res) => self.pool_idx = Some(res), + Err(_) => { + self.id = Some(Uuid::new_v4().to_string()); + self.create = true; + continue; + } + }, + "s" => match kv[1].parse::() { + Ok(res) => self.set_idx = Some(res), + Err(_) => { + self.id = Some(Uuid::new_v4().to_string()); + self.create = true; + continue; + } + }, + _ => (), + } + } + } + } + } + pub fn encode_marker(&mut self, marker: &str) -> String { + if let Some(id) = &self.id { + format!( + "{}[rustfs_cache:{},id:{},p:{},s:{}]", + marker, + MARKER_TAG_VERSION, + id.to_owned(), + self.pool_idx.unwrap_or_default(), + self.pool_idx.unwrap_or_default(), + ) + } else { + format!("{}[rustfs_cache:{},return:]", marker, MARKER_TAG_VERSION) } } } @@ -124,24 +202,24 @@ impl ECStore { self: Arc, bucket: &str, prefix: &str, - continuation_token: &str, - delimiter: &str, + continuation_token: Option, + delimiter: Option, max_keys: i32, _fetch_owner: bool, - start_after: &str, + start_after: Option, ) -> Result { let marker = { - if continuation_token.is_empty() { + if continuation_token.is_none() { start_after } else { - continuation_token + continuation_token.clone() } }; let loi = self.list_objects_generic(bucket, prefix, marker, delimiter, max_keys).await?; Ok(ListObjectsV2Info { is_truncated: loi.is_truncated, - continuation_token: continuation_token.to_owned(), + continuation_token, next_continuation_token: loi.next_marker, objects: loi.objects, prefixes: loi.prefixes, @@ -152,23 +230,23 @@ impl ECStore { self: Arc, bucket: &str, prefix: &str, - marker: &str, - delimiter: &str, + marker: Option, + delimiter: Option, max_keys: i32, ) -> Result { let opts = ListPathOptions { bucket: bucket.to_owned(), prefix: prefix.to_owned(), - separator: delimiter.to_owned(), - limit: max_keys_plus_one(max_keys, !marker.is_empty()), - marker: marker.to_owned(), + separator: delimiter.clone(), + limit: max_keys_plus_one(max_keys, marker.is_some()), + marker, incl_deleted: false, ask_disks: "strict".to_owned(), //TODO: from config ..Default::default() }; // use get - if !opts.prefix.is_empty() && opts.limit == 1 && opts.marker.is_empty() { + if !opts.prefix.is_empty() && opts.limit == 1 && opts.marker.is_none() { match self .get_object_info( &opts.bucket, @@ -194,31 +272,46 @@ impl ECStore { }; }; - let mut err_eof = false; - let has_merged = match self.list_path(&opts).await { - Ok(res) => Some(res), - Err(err) => { - if !is_err_eof(&err) { - return Err(err); - } + let mut list_result = match self.list_path(&opts).await { + Ok(res) => res, + Err(err) => MetaCacheEntriesSortedResult { + err: Some(err), + ..Default::default() + }, + }; - err_eof = true; - None + if let Some(err) = &list_result.err { + if !is_err_eof(err) { + return Err(to_object_err(list_result.err.unwrap(), vec![bucket, prefix])); } - }; + } - let mut get_objects = if let Some(merged) = has_merged { - merged.file_infos(bucket, prefix, delimiter).await - } else { - Vec::new() - }; + if let Some(result) = list_result.entries.as_mut() { + result.forward_past(opts.marker); + } + + // contextCanceled + + let mut get_objects = list_result + .entries + .unwrap_or_default() + .file_infos(bucket, prefix, delimiter.clone()) + .await; let is_truncated = { if max_keys > 0 && get_objects.len() > max_keys as usize { get_objects.truncate(max_keys as usize); true } else { - !err_eof && !get_objects.is_empty() + list_result.err.is_none() && !get_objects.is_empty() + } + }; + + let next_marker = { + if is_truncated { + get_objects.last().map(|last| last.name.clone()) + } else { + None } }; @@ -226,35 +319,31 @@ impl ECStore { let mut objects = Vec::with_capacity(get_objects.len()); for obj in get_objects.into_iter() { - if obj.is_dir && obj.mod_time.is_none() && !delimiter.is_empty() { - let mut found = false; - if delimiter != SLASH_SEPARATOR { - for p in prefixes.iter() { - if found { - break; + if let Some(delimiter) = &delimiter { + if obj.is_dir && obj.mod_time.is_none() { + let mut found = false; + if delimiter != SLASH_SEPARATOR { + for p in prefixes.iter() { + if found { + break; + } + found = p == &obj.name; } - found = p == &obj.name; } - } - if !found { - prefixes.push(obj.name.clone()); + if !found { + prefixes.push(obj.name.clone()); + } + } else { + objects.push(obj); } } else { objects.push(obj); } } - let next_marker = { - if is_truncated { - objects.last().map(|last| last.name.clone()) - } else { - None - } - }; - Ok(ListObjectsInfo { is_truncated, - next_marker: next_marker.unwrap_or_default(), + next_marker, objects, prefixes, }) @@ -264,80 +353,64 @@ impl ECStore { self: Arc, bucket: &str, prefix: &str, - marker: &str, - version_marker: &str, - delimiter: &str, + marker: Option, + version_marker: Option, + delimiter: Option, max_keys: i32, ) -> Result { - if marker.is_empty() && !version_marker.is_empty() { + if marker.is_none() && version_marker.is_some() { return Err(Error::new(StorageError::NotImplemented)); } + // if marker set, limit +1 let opts = ListPathOptions { bucket: bucket.to_owned(), prefix: prefix.to_owned(), - separator: delimiter.to_owned(), - limit: max_keys_plus_one(max_keys, !marker.is_empty()), - marker: marker.to_owned(), + separator: delimiter.clone(), + limit: max_keys_plus_one(max_keys, marker.is_some()), + marker, incl_deleted: true, ask_disks: "strict".to_owned(), versioned: true, ..Default::default() }; - let mut err_eof = false; - let has_merged = match self.list_path(&opts).await { - Ok(res) => Some(res), - Err(err) => { - if !is_err_eof(&err) { - return Err(err); - } + let mut list_result = match self.list_path(&opts).await { + Ok(res) => res, + Err(err) => MetaCacheEntriesSortedResult { + err: Some(err), + ..Default::default() + }, + }; - err_eof = true; - None + if let Some(err) = &list_result.err { + if !is_err_eof(err) { + return Err(to_object_err(list_result.err.unwrap(), vec![bucket, prefix])); } - }; + } - let mut get_objects = if let Some(merged) = has_merged { - merged.file_info_versions(bucket, prefix, delimiter, version_marker).await - } else { - Vec::new() - }; + if let Some(result) = list_result.entries.as_mut() { + result.forward_past(opts.marker); + } + + let mut get_objects = list_result + .entries + .unwrap_or_default() + .file_info_versions(bucket, prefix, delimiter.clone(), version_marker) + .await; let is_truncated = { if max_keys > 0 && get_objects.len() > max_keys as usize { get_objects.truncate(max_keys as usize); true } else { - !err_eof && !get_objects.is_empty() + list_result.err.is_none() && !get_objects.is_empty() } }; - let mut prefixes: Vec = Vec::new(); - - let mut objects = Vec::with_capacity(get_objects.len()); - for obj in get_objects.into_iter() { - if obj.is_dir && obj.mod_time.is_none() && !delimiter.is_empty() { - let mut found = false; - if delimiter != SLASH_SEPARATOR { - for p in prefixes.iter() { - if found { - break; - } - found = p == &obj.name; - } - } - if !found { - prefixes.push(obj.name.clone()); - } - } else { - objects.push(obj); - } - } - let (next_marker, next_version_idmarker) = { if is_truncated { - objects + get_objects .last() .map(|last| (Some(last.name.clone()), last.version_id.map(|v| v.to_string()))) .unwrap_or_default() @@ -346,6 +419,32 @@ impl ECStore { } }; + let mut prefixes: Vec = Vec::new(); + + let mut objects = Vec::with_capacity(get_objects.len()); + for obj in get_objects.into_iter() { + if let Some(delimiter) = &delimiter { + if obj.is_dir && obj.mod_time.is_none() { + let mut found = false; + if delimiter != SLASH_SEPARATOR { + for p in prefixes.iter() { + if found { + break; + } + found = p == &obj.name; + } + } + if !found { + prefixes.push(obj.name.clone()); + } + } else { + objects.push(obj); + } + } else { + objects.push(obj); + } + } + Ok(ListObjectVersionsInfo { is_truncated, next_marker, @@ -355,19 +454,21 @@ impl ECStore { }) } - pub async fn list_path(self: Arc, o: &ListPathOptions) -> Result { + pub async fn list_path(self: Arc, o: &ListPathOptions) -> Result { + // warn!("list_path opt {:?}", &o); + check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?; // if opts.prefix.ends_with(SLASH_SEPARATOR) { // return Err(Error::msg("eof")); // } let mut o = o.clone(); - if o.marker < o.prefix { - o.marker = "".to_owned(); - } + o.marker = o.marker.filter(|v| v >= &o.prefix); - if !o.marker.is_empty() && !o.prefix.is_empty() && !o.marker.starts_with(&o.prefix) { - return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + if let Some(marker) = &o.marker { + if !o.prefix.is_empty() && !marker.starts_with(&o.prefix) { + return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + } } if o.limit == 0 { @@ -378,16 +479,18 @@ impl ECStore { return Err(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); } - o.include_directories = o.separator == SLASH_SEPARATOR; + let slash_separator = Some(SLASH_SEPARATOR.to_owned()); - if (o.separator == SLASH_SEPARATOR || o.separator.is_empty()) && !o.recursive { - o.recursive = o.separator != SLASH_SEPARATOR; - o.separator = SLASH_SEPARATOR.to_owned(); + o.include_directories = o.separator == slash_separator; + + if (o.separator == slash_separator || o.separator.is_none()) && !o.recursive { + o.recursive = o.separator != slash_separator; + o.separator = slash_separator; } else { o.recursive = true } - // TODO: parseMarker + o.parse_marker(); if o.base_dir.is_empty() { o.base_dir = base_dir_from_prefix(&o.prefix); @@ -421,10 +524,16 @@ impl ECStore { let cancel_rx2 = cancel_rx.resubscribe(); let (result_tx, mut result_rx) = mpsc::channel(1); + let err_tx2 = err_tx.clone(); + let opts = o.clone(); + let job2 = tokio::spawn(async move { + if let Err(err) = gather_results(cancel_rx2, opts, recv, result_tx).await { + error!("gather_results err {:?}", err); + let _ = err_tx2.send(err); + } + }); - let job2 = tokio::spawn(gather_results(cancel_rx2, o, recv, result_tx)); - - let result = { + let mut result = { // receiver result tokio::select! { res = err_rx.recv() =>{ @@ -432,11 +541,12 @@ impl ECStore { match res{ Ok(o) => { error!("list_path err_rx.recv() ok {:?}", &o); - Err(o) + MetaCacheEntriesSortedResult{ entries: None, err: Some(o) } }, Err(err) => { error!("list_path err_rx.recv() err {:?}", &err); - Err(Error::new(err)) + + MetaCacheEntriesSortedResult{ entries: None, err: Some(Error::new(err)) } }, } }, @@ -452,7 +562,28 @@ impl ECStore { // wait spawns exit join_all(vec![job1, job2]).await; - result + if result.err.is_some() { + return Ok(result); + } + + if let Some(entries) = result.entries.as_mut() { + entries.reuse = true; + let truncated = !entries.entries().is_empty() || result.err.is_none(); + entries.o.0.truncate(o.limit as usize); + if !o.transient && truncated { + entries.list_id = if let Some(id) = o.id { + Some(id) + } else { + Some(Uuid::new_v4().to_string()) + } + } + + if !truncated { + result.err = Some(Error::new(std::io::Error::from(ErrorKind::UnexpectedEof))); + } + } + + Ok(result) } // 读所有 @@ -488,6 +619,10 @@ impl ECStore { // let merge_res = merge_entry_channels(rx, inputs, sender.clone(), 1).await; + // TODO: cancelList + + // let merge_res = merge_entry_channels(rx, inputs, sender.clone(), 1).await; + let results = join_all(futures).await; let mut all_at_eof = true; @@ -538,17 +673,15 @@ async fn gather_results( _rx: B_Receiver, opts: ListPathOptions, recv: Receiver, - results_tx: Sender>, -) { + results_tx: Sender, +) -> Result<()> { let mut returned = false; - let mut results = MetaCacheEntriesSorted { - o: MetaCacheEntries(Vec::new()), - }; + + let mut sender = Some(results_tx); let mut recv = recv; - // let mut entrys = Vec::new(); + let mut entrys = Vec::new(); while let Some(mut entry) = recv.recv().await { - // warn!("gather_entrys entry {}", &entry.name); if returned { continue; } @@ -562,21 +695,62 @@ async fn gather_results( continue; } - if !opts.marker.is_empty() && entry.name < opts.marker { + if let Some(marker) = &opts.marker { + if &entry.name < marker { + continue; + } + } + + if !entry.name.starts_with(&opts.prefix) { continue; } - // TODO: other - if opts.limit > 0 && results.o.0.len() >= opts.limit as usize { - returned = true; + if let Some(separator) = &opts.separator { + if !opts.recursive && !entry.is_in_dir(&opts.prefix, separator) { + continue; + } + } + + if !opts.incl_deleted && entry.is_object() && entry.is_latest_deletemarker() && entry.is_object_dir() { continue; } - results.o.0.push(Some(entry)); + // TODO: Lifecycle + + if opts.limit > 0 && entrys.len() >= opts.limit as usize { + if let Some(tx) = sender { + tx.send(MetaCacheEntriesSortedResult { + entries: Some(MetaCacheEntriesSorted { + o: MetaCacheEntries(entrys.clone()), + ..Default::default() + }), + err: None, + }) + .await?; + + returned = true; + sender = None; + } + continue; + } + + entrys.push(Some(entry)); // entrys.push(entry); } - results_tx.send(Ok(results)).await; + // finish not full, return eof + if let Some(tx) = sender { + tx.send(MetaCacheEntriesSortedResult { + entries: Some(MetaCacheEntriesSorted { + o: MetaCacheEntries(entrys.clone()), + ..Default::default() + }), + err: Some(Error::new(std::io::Error::new(ErrorKind::UnexpectedEof, "Unexpected EOF"))), + }) + .await?; + } + + Ok(()) } async fn select_from( @@ -1024,7 +1198,7 @@ mod test { let (_, rx) = broadcast::channel(1); let bucket = "dada".to_owned(); - let forward_to = "".to_owned(); + let forward_to = None; let disks = vec![Some(disk)]; let fallback_disks = Vec::new(); diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index a3ea78b99..cda7db11c 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -55,7 +55,7 @@ impl ObjectStore { let items = self .object_api .clone() - .list_objects_v2(Self::BUCKET_NAME.into(), &prefix.clone(), "", "", 0, false, "") + .list_objects_v2(Self::BUCKET_NAME, &prefix.clone(), None, None, 0, false, None) .await; match items { diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index f2c1df3cd..999d80df0 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -10,7 +10,7 @@ use ecstore::{ bucket::{metadata::load_bucket_metadata, metadata_sys}, disk::{ DeleteOptions, DiskAPI, DiskInfoOptions, DiskStore, FileInfoVersions, ReadMultipleReq, ReadOptions, Reader, - UpdateMetadataOpts, WalkDirOptions, + UpdateMetadataOpts, }, erasure::Writer, heal::{ diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index da9eb186e..4251391b5 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -460,6 +460,7 @@ impl S3 for FS { #[tracing::instrument(level = "debug", skip(self, req))] async fn list_objects_v2(&self, req: S3Request) -> S3Result> { + // warn!("list_objects_v2 req {:?}", &req.input); let ListObjectsV2Input { bucket, continuation_token, @@ -472,9 +473,12 @@ impl S3 for FS { } = req.input; let prefix = prefix.unwrap_or_default(); - let delimiter = delimiter.unwrap_or_default(); let max_keys = max_keys.unwrap_or(1000); + let delimiter = delimiter.filter(|v| !v.is_empty()); + let continuation_token = continuation_token.filter(|v| !v.is_empty()); + let start_after = start_after.filter(|v| !v.is_empty()); + let Some(store) = new_object_layer_fn() else { return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string())); }; @@ -483,16 +487,16 @@ impl S3 for FS { .list_objects_v2( &bucket, &prefix, - &continuation_token.unwrap_or_default(), - &delimiter, + continuation_token, + delimiter.clone(), max_keys, fetch_owner.unwrap_or_default(), - &start_after.unwrap_or_default(), + start_after, ) .await .map_err(to_s3_error)?; - // warn!("object_infos {:?}", object_infos); + // warn!("object_infos objects {:?}", object_infos.objects); let objects: Vec = object_infos .objects @@ -526,10 +530,13 @@ impl S3 for FS { .collect(); let output = ListObjectsV2Output { + is_truncated: Some(object_infos.is_truncated), + continuation_token: object_infos.continuation_token, + next_continuation_token: object_infos.next_continuation_token, key_count: Some(key_count), max_keys: Some(key_count), contents: Some(objects), - delimiter: Some(delimiter), + delimiter, name: Some(bucket), prefix: Some(prefix), common_prefixes: Some(common_prefixes), @@ -555,22 +562,18 @@ impl S3 for FS { } = req.input; let prefix = prefix.unwrap_or_default(); - let delimiter = delimiter.unwrap_or_default(); let max_keys = max_keys.unwrap_or(1000); + let key_marker = key_marker.filter(|v| !v.is_empty()); + let version_id_marker = version_id_marker.filter(|v| !v.is_empty()); + let delimiter = delimiter.filter(|v| !v.is_empty()); + let Some(store) = new_object_layer_fn() else { return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string())); }; let object_infos = store - .list_object_versions( - &bucket, - &prefix, - &key_marker.unwrap_or_default(), - &version_id_marker.unwrap_or_default(), - &delimiter, - max_keys, - ) + .list_object_versions(&bucket, &prefix, key_marker, version_id_marker, delimiter.clone(), max_keys) .await .map_err(to_s3_error)?; @@ -579,7 +582,7 @@ impl S3 for FS { .iter() .filter(|v| !v.name.is_empty()) .map(|v| { - let obj = ObjectVersion { + ObjectVersion { key: Some(v.name.to_owned()), last_modified: v.mod_time.map(Timestamp::from), size: Some(v.size as i64), @@ -587,9 +590,7 @@ impl S3 for FS { is_latest: Some(v.is_latest), e_tag: v.etag.clone(), ..Default::default() // TODO: another fields - }; - - obj + } }) .collect(); @@ -604,7 +605,7 @@ impl S3 for FS { let output = ListObjectVersionsOutput { // is_truncated: Some(object_infos.is_truncated), max_keys: Some(key_count), - delimiter: Some(delimiter), + delimiter, name: Some(bucket), prefix: Some(prefix), common_prefixes: Some(common_prefixes), From 1af62dafa4b67f5b80dd25a7e5e8050a3bcc5969 Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 26 Dec 2024 00:17:41 +0800 Subject: [PATCH 76/77] cargo fmt --- .../generated/flatbuffers_generated/models.rs | 207 +++++++++--------- 1 file changed, 104 insertions(+), 103 deletions(-) diff --git a/common/protos/src/generated/flatbuffers_generated/models.rs b/common/protos/src/generated/flatbuffers_generated/models.rs index aa1f6ae2f..e4949fdcf 100644 --- a/common/protos/src/generated/flatbuffers_generated/models.rs +++ b/common/protos/src/generated/flatbuffers_generated/models.rs @@ -1,10 +1,9 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use core::mem; use core::cmp::Ordering; +use core::mem; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -12,112 +11,114 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod models { - use core::mem; - use core::cmp::Ordering; + use core::cmp::Ordering; + use core::mem; - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; -pub enum PingBodyOffset {} -#[derive(Copy, Clone, PartialEq)] + pub enum PingBodyOffset {} + #[derive(Copy, Clone, PartialEq)] -pub struct PingBody<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { - type Inner = PingBody<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PingBody<'a> { - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; - - pub const fn get_fully_qualified_name() -> &'static str { - "models.PingBody" - } - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PingBody { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PingBodyArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PingBodyBuilder::new(_fbb); - if let Some(x) = args.payload { builder.add_payload(x); } - builder.finish() - } - - - #[inline] - pub fn payload(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(PingBody::VT_PAYLOAD, None)} - } -} - -impl flatbuffers::Verifiable for PingBody<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("payload", Self::VT_PAYLOAD, false)? - .finish(); - Ok(()) - } -} -pub struct PingBodyArgs<'a> { - pub payload: Option>>, -} -impl<'a> Default for PingBodyArgs<'a> { - #[inline] - fn default() -> Self { - PingBodyArgs { - payload: None, + pub struct PingBody<'a> { + pub _tab: flatbuffers::Table<'a>, } - } -} -pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PingBody::VT_PAYLOAD, payload); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PingBodyBuilder { - fbb_: _fbb, - start_: start, + impl<'a> flatbuffers::Follow<'a> for PingBody<'a> { + type Inner = PingBody<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} -impl core::fmt::Debug for PingBody<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PingBody"); - ds.field("payload", &self.payload()); - ds.finish() - } -} -} // pub mod models + impl<'a> PingBody<'a> { + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4; + pub const fn get_fully_qualified_name() -> &'static str { + "models.PingBody" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PingBody { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PingBodyArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = PingBodyBuilder::new(_fbb); + if let Some(x) = args.payload { + builder.add_payload(x); + } + builder.finish() + } + + #[inline] + pub fn payload(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>(PingBody::VT_PAYLOAD, None) + } + } + } + + impl flatbuffers::Verifiable for PingBody<'_> { + #[inline] + fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>("payload", Self::VT_PAYLOAD, false)? + .finish(); + Ok(()) + } + } + pub struct PingBodyArgs<'a> { + pub payload: Option>>, + } + impl<'a> Default for PingBodyArgs<'a> { + #[inline] + fn default() -> Self { + PingBodyArgs { payload: None } + } + } + + pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> { + #[inline] + pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(PingBody::VT_PAYLOAD, payload); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PingBodyBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for PingBody<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PingBody"); + ds.field("payload", &self.payload()); + ds.finish() + } + } +} // pub mod models From d2c71a5a47e82a243d4b81a53e9b5ecae5a7d3cf Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 26 Dec 2024 09:30:40 +0800 Subject: [PATCH 77/77] rm test --- ecstore/src/store_list_objects.rs | 430 +++++++++++++++--------------- 1 file changed, 215 insertions(+), 215 deletions(-) diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index f4b55c338..f9bc08fe0 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -1090,260 +1090,260 @@ fn calc_common_counter(infos: &[DiskInfo], read_quorum: usize) -> u64 { // list_path_raw -#[cfg(test)] -mod test { - use std::sync::Arc; +// #[cfg(test)] +// mod test { +// use std::sync::Arc; - use crate::cache_value::metacache_set::list_path_raw; - use crate::cache_value::metacache_set::ListPathRawOptions; - use crate::disk::endpoint::Endpoint; - use crate::disk::error::is_err_eof; - use crate::disk::format::FormatV3; - use crate::disk::new_disk; - use crate::disk::DiskAPI; - use crate::disk::DiskOption; - use crate::disk::MetaCacheEntries; - use crate::disk::MetaCacheEntry; - use crate::disk::WalkDirOptions; - use crate::endpoints::EndpointServerPools; - use crate::error::Error; - use crate::metacache::writer::MetacacheReader; - use crate::set_disk::SetDisks; - use crate::store::ECStore; - use crate::store_list_objects::ListPathOptions; - use futures::future::join_all; - use lock::namespace_lock::NsLockMap; - use tokio::sync::broadcast; - use tokio::sync::mpsc; - use tokio::sync::RwLock; - use uuid::Uuid; +// use crate::cache_value::metacache_set::list_path_raw; +// use crate::cache_value::metacache_set::ListPathRawOptions; +// use crate::disk::endpoint::Endpoint; +// use crate::disk::error::is_err_eof; +// use crate::disk::format::FormatV3; +// use crate::disk::new_disk; +// use crate::disk::DiskAPI; +// use crate::disk::DiskOption; +// use crate::disk::MetaCacheEntries; +// use crate::disk::MetaCacheEntry; +// use crate::disk::WalkDirOptions; +// use crate::endpoints::EndpointServerPools; +// use crate::error::Error; +// use crate::metacache::writer::MetacacheReader; +// use crate::set_disk::SetDisks; +// use crate::store::ECStore; +// use crate::store_list_objects::ListPathOptions; +// use futures::future::join_all; +// use lock::namespace_lock::NsLockMap; +// use tokio::sync::broadcast; +// use tokio::sync::mpsc; +// use tokio::sync::RwLock; +// use uuid::Uuid; - #[tokio::test] - async fn test_walk_dir() { - let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); - ep.pool_idx = 0; - ep.set_idx = 0; - ep.disk_idx = 0; - ep.is_local = true; +// #[tokio::test] +// async fn test_walk_dir() { +// let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); +// ep.pool_idx = 0; +// ep.set_idx = 0; +// ep.disk_idx = 0; +// ep.is_local = true; - let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); +// let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); - // let disk = match LocalDisk::new(&ep, false).await { - // Ok(res) => res, - // Err(err) => { - // println!("LocalDisk::new err {:?}", err); - // return; - // } - // }; +// // let disk = match LocalDisk::new(&ep, false).await { +// // Ok(res) => res, +// // Err(err) => { +// // println!("LocalDisk::new err {:?}", err); +// // return; +// // } +// // }; - let (rd, mut wr) = tokio::io::duplex(64); +// let (rd, mut wr) = tokio::io::duplex(64); - let job = tokio::spawn(async move { - let opts = WalkDirOptions { - bucket: "dada".to_owned(), - base_dir: "".to_owned(), - recursive: true, - ..Default::default() - }; +// let job = tokio::spawn(async move { +// let opts = WalkDirOptions { +// bucket: "dada".to_owned(), +// base_dir: "".to_owned(), +// recursive: true, +// ..Default::default() +// }; - println!("walk opts {:?}", opts); - if let Err(err) = disk.walk_dir(opts, &mut wr).await { - println!("walk_dir err {:?}", err); - } - }); +// println!("walk opts {:?}", opts); +// if let Err(err) = disk.walk_dir(opts, &mut wr).await { +// println!("walk_dir err {:?}", err); +// } +// }); - let job2 = tokio::spawn(async move { - let mut mrd = MetacacheReader::new(rd); +// let job2 = tokio::spawn(async move { +// let mut mrd = MetacacheReader::new(rd); - loop { - match mrd.peek().await { - Ok(res) => { - if let Some(info) = res { - println!("info {:?}", info.name) - } else { - break; - } - } - Err(err) => { - if is_err_eof(&err) { - break; - } +// loop { +// match mrd.peek().await { +// Ok(res) => { +// if let Some(info) = res { +// println!("info {:?}", info.name) +// } else { +// break; +// } +// } +// Err(err) => { +// if is_err_eof(&err) { +// break; +// } - println!("get err {:?}", err); - break; - } - } - } - }); - join_all(vec![job, job2]).await; - } +// println!("get err {:?}", err); +// break; +// } +// } +// } +// }); +// join_all(vec![job, job2]).await; +// } - #[tokio::test] - async fn test_list_path_raw() { - let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); - ep.pool_idx = 0; - ep.set_idx = 0; - ep.disk_idx = 0; - ep.is_local = true; +// #[tokio::test] +// async fn test_list_path_raw() { +// let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); +// ep.pool_idx = 0; +// ep.set_idx = 0; +// ep.disk_idx = 0; +// ep.is_local = true; - let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); +// let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); - // let disk = match LocalDisk::new(&ep, false).await { - // Ok(res) => res, - // Err(err) => { - // println!("LocalDisk::new err {:?}", err); - // return; - // } - // }; +// // let disk = match LocalDisk::new(&ep, false).await { +// // Ok(res) => res, +// // Err(err) => { +// // println!("LocalDisk::new err {:?}", err); +// // return; +// // } +// // }; - let (_, rx) = broadcast::channel(1); - let bucket = "dada".to_owned(); - let forward_to = None; - let disks = vec![Some(disk)]; - let fallback_disks = Vec::new(); +// let (_, rx) = broadcast::channel(1); +// let bucket = "dada".to_owned(); +// let forward_to = None; +// let disks = vec![Some(disk)]; +// let fallback_disks = Vec::new(); - list_path_raw( - rx, - ListPathRawOptions { - disks, - fallback_disks, - bucket, - path: "".to_owned(), - recursice: true, - forward_to, - min_disks: 1, - report_not_found: false, - agreed: Some(Box::new(move |entry: MetaCacheEntry| { - Box::pin(async move { println!("get entry: {}", entry.name) }) - })), - partial: Some(Box::new(move |entries: MetaCacheEntries, _: &[Option]| { - Box::pin(async move { println!("get entries: {:?}", entries) }) - })), - finished: None, - ..Default::default() - }, - ) - .await - .unwrap(); - } +// list_path_raw( +// rx, +// ListPathRawOptions { +// disks, +// fallback_disks, +// bucket, +// path: "".to_owned(), +// recursice: true, +// forward_to, +// min_disks: 1, +// report_not_found: false, +// agreed: Some(Box::new(move |entry: MetaCacheEntry| { +// Box::pin(async move { println!("get entry: {}", entry.name) }) +// })), +// partial: Some(Box::new(move |entries: MetaCacheEntries, _: &[Option]| { +// Box::pin(async move { println!("get entries: {:?}", entries) }) +// })), +// finished: None, +// ..Default::default() +// }, +// ) +// .await +// .unwrap(); +// } - #[tokio::test] - async fn test_set_list_path() { - let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); - ep.pool_idx = 0; - ep.set_idx = 0; - ep.disk_idx = 0; - ep.is_local = true; +// #[tokio::test] +// async fn test_set_list_path() { +// let mut ep = Endpoint::try_from("/Users/weisd/project/weisd/s3-rustfs/target/volume/test").unwrap(); +// ep.pool_idx = 0; +// ep.set_idx = 0; +// ep.disk_idx = 0; +// ep.is_local = true; - let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); - let _ = disk.set_disk_id(Some(Uuid::new_v4())).await; +// let disk = new_disk(&ep, &DiskOption::default()).await.expect("init disk fail"); +// let _ = disk.set_disk_id(Some(Uuid::new_v4())).await; - let set = SetDisks { - lockers: Vec::new(), - locker_owner: String::new(), - ns_mutex: Arc::new(RwLock::new(NsLockMap::new(false))), - disks: RwLock::new(vec![Some(disk)]), - set_endpoints: Vec::new(), - set_drive_count: 1, - default_parity_count: 0, - set_index: 0, - pool_index: 0, - format: FormatV3::new(1, 1), - }; +// let set = SetDisks { +// lockers: Vec::new(), +// locker_owner: String::new(), +// ns_mutex: Arc::new(RwLock::new(NsLockMap::new(false))), +// disks: RwLock::new(vec![Some(disk)]), +// set_endpoints: Vec::new(), +// set_drive_count: 1, +// default_parity_count: 0, +// set_index: 0, +// pool_index: 0, +// format: FormatV3::new(1, 1), +// }; - let (_tx, rx) = broadcast::channel(1); +// let (_tx, rx) = broadcast::channel(1); - let bucket = "dada".to_owned(); +// let bucket = "dada".to_owned(); - let opts = ListPathOptions { - bucket, - recursive: true, - ..Default::default() - }; +// let opts = ListPathOptions { +// bucket, +// recursive: true, +// ..Default::default() +// }; - let (sender, mut recv) = mpsc::channel(10); +// let (sender, mut recv) = mpsc::channel(10); - set.list_path(rx, opts, sender).await.unwrap(); +// set.list_path(rx, opts, sender).await.unwrap(); - while let Some(entry) = recv.recv().await { - println!("get entry {:?}", entry.name) - } - } +// while let Some(entry) = recv.recv().await { +// println!("get entry {:?}", entry.name) +// } +// } - #[tokio::test] - async fn test_list_merged() { - let server_address = "localhost:9000"; +// #[tokio::test] +// async fn test_list_merged() { +// let server_address = "localhost:9000"; - let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( - server_address, - vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], - ) - .unwrap(); +// let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( +// server_address, +// vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], +// ) +// .unwrap(); - let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) - .await - .unwrap(); +// let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) +// .await +// .unwrap(); - let (_tx, rx) = broadcast::channel(1); +// let (_tx, rx) = broadcast::channel(1); - let bucket = "dada".to_owned(); - let opts = ListPathOptions { - bucket, - recursive: true, - ..Default::default() - }; +// let bucket = "dada".to_owned(); +// let opts = ListPathOptions { +// bucket, +// recursive: true, +// ..Default::default() +// }; - let (sender, mut recv) = mpsc::channel(10); +// let (sender, mut recv) = mpsc::channel(10); - store.list_merged(rx, opts, sender).await.unwrap(); +// store.list_merged(rx, opts, sender).await.unwrap(); - while let Some(entry) = recv.recv().await { - println!("get entry {:?}", entry.name) - } - } +// while let Some(entry) = recv.recv().await { +// println!("get entry {:?}", entry.name) +// } +// } - #[tokio::test] - async fn test_list_path() { - let server_address = "localhost:9000"; +// #[tokio::test] +// async fn test_list_path() { +// let server_address = "localhost:9000"; - let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( - server_address, - vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], - ) - .unwrap(); +// let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( +// server_address, +// vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], +// ) +// .unwrap(); - let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) - .await - .unwrap(); +// let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) +// .await +// .unwrap(); - let bucket = "dada".to_owned(); - let opts = ListPathOptions { - bucket, - recursive: true, - limit: 100, +// let bucket = "dada".to_owned(); +// let opts = ListPathOptions { +// bucket, +// recursive: true, +// limit: 100, - ..Default::default() - }; +// ..Default::default() +// }; - let ret = store.list_path(&opts).await.unwrap(); - println!("ret {:?}", ret); - } +// let ret = store.list_path(&opts).await.unwrap(); +// println!("ret {:?}", ret); +// } - // #[tokio::test] - // async fn test_list_objects_v2() { - // let server_address = "localhost:9000"; +// // #[tokio::test] +// // async fn test_list_objects_v2() { +// // let server_address = "localhost:9000"; - // let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( - // server_address, - // vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], - // ) - // .unwrap(); +// // let (endpoint_pools, _setup_type) = EndpointServerPools::from_volumes( +// // server_address, +// // vec!["/Users/weisd/project/weisd/s3-rustfs/target/volume/test".to_string()], +// // ) +// // .unwrap(); - // let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) - // .await - // .unwrap(); +// // let store = ECStore::new(server_address.to_string(), endpoint_pools.clone()) +// // .await +// // .unwrap(); - // let ret = store.list_objects_v2("data", "", "", "", 100, false, "").await.unwrap(); - // println!("ret {:?}", ret); - // } -} +// // let ret = store.list_objects_v2("data", "", "", "", 100, false, "").await.unwrap(); +// // println!("ret {:?}", ret); +// // } +// }