From 84d4a08128e8e7c8b1bb029bf2d2871c9972c672 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 4 Dec 2024 11:15:49 +0800 Subject: [PATCH 01/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] =?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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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 = "/";