diff --git a/ecstore/src/disk.rs b/ecstore/src/disk.rs index a223aaa5c..316f726da 100644 --- a/ecstore/src/disk.rs +++ b/ecstore/src/disk.rs @@ -1,17 +1,15 @@ use std::{ fs::Metadata, path::{Path, PathBuf}, - sync::{Arc, RwLock}, + sync::Arc, }; use anyhow::{Error, Result}; use bytes::Bytes; -use futures::{future::join_all, Stream}; +use futures::future::join_all; use path_absolutize::Absolutize; -use s3s::StdError; use time::OffsetDateTime; -use tokio::io::{self, AsyncRead, AsyncReadExt, AsyncSeekExt}; -use tokio::io::{AsyncWrite, BufWriter, ErrorKind}; +use tokio::io::{self, BufWriter, ErrorKind}; use tokio::{ fs::{self, File}, io::DuplexStream, @@ -23,7 +21,7 @@ use crate::{ disk_api::{DiskAPI, DiskError, ReadOptions, VolumeInfo}, endpoint::{Endpoint, Endpoints}, file_meta::FileMeta, - format::{DistributionAlgoVersion, FormatV3}, + format::FormatV3, store_api::{FileInfo, RawFileInfo}, utils, }; @@ -48,6 +46,7 @@ pub async fn new_disk(ep: &Endpoint, opt: &DiskOption) -> Result { let s = LocalDisk::new(ep, opt.cleanup).await?; Ok(Arc::new(Box::new(s))) } else { + let _ = opt.health_check; unimplemented!() // Ok(Disk::Remote(RemoteDisk::new(ep, opt.health_check)?)) } @@ -168,22 +167,22 @@ impl LocalDisk { self.resolve_abs_path(dir) } - /// Write to the filesystem atomically. - /// This is done by first writing to a temporary location and then moving the file. - pub(crate) async fn prepare_file_write<'a>(&self, path: &'a PathBuf) -> Result> { - let tmp_path = self.get_object_path(RUSTFS_META_TMP_BUCKET, Uuid::new_v4().to_string().as_str())?; + // /// Write to the filesystem atomically. + // /// This is done by first writing to a temporary location and then moving the file. + // pub(crate) async fn prepare_file_write<'a>(&self, path: &'a PathBuf) -> Result> { + // let tmp_path = self.get_object_path(RUSTFS_META_TMP_BUCKET, Uuid::new_v4().to_string().as_str())?; - debug!("prepare_file_write tmp_path:{:?}, path:{:?}", &tmp_path, &path); + // debug!("prepare_file_write tmp_path:{:?}, path:{:?}", &tmp_path, &path); - let file = File::create(&tmp_path).await?; - let writer = BufWriter::new(file); - Ok(FileWriter { - tmp_path, - dest_path: path, - writer, - clean_tmp: true, - }) - } + // let file = File::create(&tmp_path).await?; + // let writer = BufWriter::new(file); + // Ok(FileWriter { + // tmp_path, + // dest_path: path, + // writer, + // clean_tmp: true, + // }) + // } pub async fn rename_all(&self, src_data_path: &PathBuf, dst_data_path: &PathBuf, skip: &PathBuf) -> Result<()> { if !skip.starts_with(&src_data_path) { @@ -247,8 +246,8 @@ impl LocalDisk { async fn read_all_data( &self, - bucket: &str, - volume_dir: impl AsRef, + _bucket: &str, + _volume_dir: impl AsRef, path: impl AsRef, ) -> Result<(Vec, OffsetDateTime)> { let (data, meta) = read_file_all(path).await?; @@ -404,7 +403,14 @@ impl DiskAPI for LocalDisk { Ok(()) } - async fn create_file(&self, origvolume: &str, volume: &str, path: &str, fileSize: usize, mut r: DuplexStream) -> Result<()> { + async fn create_file( + &self, + _origvolume: &str, + volume: &str, + path: &str, + _file_size: usize, + mut r: DuplexStream, + ) -> Result<()> { let fpath = self.get_object_path(volume, path)?; debug!("CreateFile fpath: {:?}", fpath); @@ -461,15 +467,15 @@ impl DiskAPI for LocalDisk { let (dst_buf, _) = read_file_exists(&dst_file_path).await?; - let mut skipParent = dst_volume_path; + let mut skip_parent = dst_volume_path; if !&dst_buf.is_empty() { - skipParent = PathBuf::from(&dst_file_path.parent().unwrap_or(Path::new("/"))); + skip_parent = PathBuf::from(&dst_file_path.parent().unwrap_or(Path::new("/"))); } if !dst_buf.is_empty() { meta = match FileMeta::unmarshal(&dst_buf) { Ok(m) => m, - Err(e) => FileMeta::new(), + Err(_) => FileMeta::new(), } // xl.load // meta.from(dst_buf); @@ -483,10 +489,10 @@ impl DiskAPI for LocalDisk { let no_inline = src_data_path.has_root() && fi.data.is_none() && fi.size > 0; if no_inline { - self.rename_all(&src_data_path, &dst_data_path, &skipParent).await?; + self.rename_all(&src_data_path, &dst_data_path, &skip_parent).await?; } - self.rename_all(&src_file_path, &dst_file_path, &skipParent).await?; + self.rename_all(&src_file_path, &dst_file_path, &skip_parent).await?; if src_volume != RUSTFS_META_MULTIPART_BUCKET { fs::remove_dir(&src_file_path.parent().unwrap()).await?; @@ -542,7 +548,7 @@ impl DiskAPI for LocalDisk { }) } - async fn write_metadata(&self, org_volume: &str, volume: &str, path: &str, fi: FileInfo) -> Result<()> { + async fn write_metadata(&self, _org_volume: &str, volume: &str, path: &str, fi: FileInfo) -> Result<()> { let p = self.get_object_path(&volume, format!("{}/{}", path, STORAGE_FORMAT_FILE).as_str())?; let mut meta = FileMeta::new(); @@ -564,7 +570,7 @@ impl DiskAPI for LocalDisk { async fn read_version( &self, - org_volume: &str, + _org_volume: &str, volume: &str, path: &str, version_id: Uuid, @@ -618,44 +624,44 @@ impl DiskAPI for LocalDisk { // } // } -pub(crate) struct FileWriter<'a> { - tmp_path: PathBuf, - dest_path: &'a Path, - writer: BufWriter, - clean_tmp: bool, -} +// pub(crate) struct FileWriter<'a> { +// tmp_path: PathBuf, +// dest_path: &'a Path, +// writer: BufWriter, +// clean_tmp: bool, +// } -impl<'a> FileWriter<'a> { - pub(crate) fn tmp_path(&self) -> &Path { - &self.tmp_path - } +// impl<'a> FileWriter<'a> { +// pub(crate) fn tmp_path(&self) -> &Path { +// &self.tmp_path +// } - pub(crate) fn dest_path(&self) -> &'a Path { - self.dest_path - } +// pub(crate) fn dest_path(&self) -> &'a Path { +// self.dest_path +// } - pub(crate) fn writer(&mut self) -> &mut BufWriter { - &mut self.writer - } +// pub(crate) fn writer(&mut self) -> &mut BufWriter { +// &mut self.writer +// } - pub(crate) async fn done(mut self) -> Result<()> { - if let Some(final_dir_path) = self.dest_path().parent() { - fs::create_dir_all(&final_dir_path).await?; - } +// pub(crate) async fn done(mut self) -> Result<()> { +// if let Some(final_dir_path) = self.dest_path().parent() { +// fs::create_dir_all(&final_dir_path).await?; +// } - fs::rename(&self.tmp_path, self.dest_path()).await?; - self.clean_tmp = false; - Ok(()) - } -} +// fs::rename(&self.tmp_path, self.dest_path()).await?; +// self.clean_tmp = false; +// Ok(()) +// } +// } -impl<'a> Drop for FileWriter<'a> { - fn drop(&mut self) { - if self.clean_tmp { - let _ = std::fs::remove_file(&self.tmp_path); - } - } -} +// impl<'a> Drop for FileWriter<'a> { +// fn drop(&mut self) { +// if self.clean_tmp { +// let _ = std::fs::remove_file(&self.tmp_path); +// } +// } +// } #[cfg(test)] mod test { diff --git a/ecstore/src/disk_api.rs b/ecstore/src/disk_api.rs index 486d985e9..ff2152adb 100644 --- a/ecstore/src/disk_api.rs +++ b/ecstore/src/disk_api.rs @@ -15,7 +15,7 @@ pub trait DiskAPI: Debug + Send + Sync + 'static { async fn read_all(&self, volume: &str, path: &str) -> Result; async fn write_all(&self, volume: &str, path: &str, data: Bytes) -> Result<()>; async fn rename_file(&self, src_volume: &str, src_path: &str, dst_volume: &str, dst_path: &str) -> Result<()>; - async fn create_file(&self, origvolume: &str, volume: &str, path: &str, fileSize: usize, r: DuplexStream) -> Result<()>; + async fn create_file(&self, origvolume: &str, volume: &str, path: &str, file_size: usize, r: DuplexStream) -> Result<()>; async fn rename_data( &self, src_volume: &str, diff --git a/ecstore/src/erasure.rs b/ecstore/src/erasure.rs index b560a443a..68c726bdb 100644 --- a/ecstore/src/erasure.rs +++ b/ecstore/src/erasure.rs @@ -1,5 +1,5 @@ use anyhow::anyhow; -use anyhow::{Error, Result}; +use anyhow::Result; use bytes::Bytes; use futures::{Stream, StreamExt}; use reed_solomon_erasure::galois_8::ReedSolomon; @@ -11,16 +11,16 @@ use tracing::debug; use crate::chunk_stream::ChunkedStream; pub struct Erasure { - data_shards: usize, - parity_shards: usize, + // data_shards: usize, + // parity_shards: usize, encoder: ReedSolomon, } impl Erasure { pub fn new(data_shards: usize, parity_shards: usize) -> Self { Erasure { - data_shards, - parity_shards, + // data_shards, + // parity_shards, encoder: ReedSolomon::new(data_shards, parity_shards).unwrap(), } } @@ -31,7 +31,7 @@ impl Erasure { writers: &mut Vec, block_size: usize, data_size: usize, - write_quorum: usize, + _write_quorum: usize, ) -> Result where S: Stream> + Send + Sync + 'static, @@ -116,15 +116,15 @@ impl Erasure { } } -fn shards_to_option_shards(shards: &[Vec]) -> Vec>> { - let mut result = Vec::with_capacity(shards.len()); +// fn shards_to_option_shards(shards: &[Vec]) -> Vec>> { +// let mut result = Vec::with_capacity(shards.len()); - for v in shards.iter() { - let inner: Vec = v.clone(); - result.push(Some(inner)); - } - result -} +// for v in shards.iter() { +// let inner: Vec = v.clone(); +// result.push(Some(inner)); +// } +// result +// } #[cfg(test)] mod test { diff --git a/ecstore/src/format.rs b/ecstore/src/format.rs index 1bc3e9f64..b384097b1 100644 --- a/ecstore/src/format.rs +++ b/ecstore/src/format.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Error as JsonError; use uuid::Uuid; -use crate::{disk, disk_api::DiskError}; +use crate::disk_api::DiskError; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] pub enum FormatMetaVersion { diff --git a/ecstore/src/peer.rs b/ecstore/src/peer.rs index bb4d788ef..40d0f47f0 100644 --- a/ecstore/src/peer.rs +++ b/ecstore/src/peer.rs @@ -2,7 +2,6 @@ use anyhow::{Error, Result}; use async_trait::async_trait; use futures::future::join_all; use std::{fmt::Debug, sync::Arc}; -use tracing::debug; use crate::{ disk::DiskStore, @@ -141,15 +140,15 @@ impl PeerS3Client for S3PeerSys { #[derive(Debug)] pub struct LocalPeerS3Client { pub local_disks: Vec, - pub node: Node, + // pub node: Node, pub pools: Vec, } impl LocalPeerS3Client { - fn new(local_disks: Vec, node: Node, pools: Vec) -> Self { + fn new(local_disks: Vec, _node: Node, pools: Vec) -> Self { Self { local_disks, - node, + // node, pools, } } @@ -192,7 +191,7 @@ impl PeerS3Client for LocalPeerS3Client { Ok(()) } - async fn get_bucket_info(&self, bucket: &str, opts: &BucketOptions) -> Result { + async fn get_bucket_info(&self, bucket: &str, _opts: &BucketOptions) -> Result { let mut futures = Vec::with_capacity(self.local_disks.len()); for disk in self.local_disks.iter() { futures.push(disk.stat_volume(bucket)); @@ -233,13 +232,14 @@ impl PeerS3Client for LocalPeerS3Client { #[derive(Debug)] pub struct RemotePeerS3Client { - pub node: Node, - pub pools: Vec, + // pub node: Node, + // pub pools: Vec, } impl RemotePeerS3Client { - fn new(node: Node, pools: Vec) -> Self { - Self { node, pools } + fn new(_node: Node, _pools: Vec) -> Self { + // Self { node, pools } + Self {} } } @@ -251,7 +251,7 @@ impl PeerS3Client for RemotePeerS3Client { async fn make_bucket(&self, _bucket: &str, _opts: &MakeBucketOptions) -> Result<()> { unimplemented!() } - async fn get_bucket_info(&self, bucket: &str, opts: &BucketOptions) -> Result { + async fn get_bucket_info(&self, _bucket: &str, _opts: &BucketOptions) -> Result { unimplemented!() } } diff --git a/ecstore/src/sets.rs b/ecstore/src/sets.rs index 359b2e128..d781ae99d 100644 --- a/ecstore/src/sets.rs +++ b/ecstore/src/sets.rs @@ -1,13 +1,11 @@ -use std::sync::Arc; - use anyhow::{Error, Result}; -use futures::{future::join_all, AsyncWrite, StreamExt}; +use futures::future::join_all; use time::OffsetDateTime; use tracing::debug; use uuid::Uuid; use crate::{ - disk::{self, DiskStore, RUSTFS_META_MULTIPART_BUCKET, RUSTFS_META_TMP_BUCKET}, + disk::{DiskStore, RUSTFS_META_MULTIPART_BUCKET, RUSTFS_META_TMP_BUCKET}, endpoint::PoolEndpoints, erasure::Erasure, format::{DistributionAlgoVersion, FormatV3}, @@ -21,8 +19,6 @@ use crate::{ }, }; -const DEFAULT_INLINE_BLOCKS: usize = 128 * 1024; - #[derive(Debug)] pub struct Sets { pub id: Uuid, @@ -135,16 +131,16 @@ impl Sets { errors } - async fn commit_rename_data_dir( - &self, - disks: &Vec>, - bucket: &str, - object: &str, - data_dir: &str, - // write_quorum: usize, - ) -> Vec> { - unimplemented!() - } + // async fn commit_rename_data_dir( + // &self, + // disks: &Vec>, + // bucket: &str, + // object: &str, + // data_dir: &str, + // // write_quorum: usize, + // ) -> Vec> { + // unimplemented!() + // } } async fn write_unique_file_info( @@ -202,14 +198,6 @@ fn get_multipart_sha_dir(bucket: &str, object: &str) -> String { hex(sha256(path.as_bytes()).as_ref()) } -async fn check_upload_idexists() -> Result<()> { - unimplemented!() -} - -async fn read_all_file_info() -> Result<()> { - unimplemented!() -} - // #[derive(Debug)] // pub struct Objects { // pub endpoints: Vec, @@ -222,11 +210,11 @@ async fn read_all_file_info() -> Result<()> { #[async_trait::async_trait] impl StorageAPI for Sets { - async fn make_bucket(&self, bucket: &str, opts: &MakeBucketOptions) -> Result<()> { + async fn make_bucket(&self, _bucket: &str, _opts: &MakeBucketOptions) -> Result<()> { unimplemented!() } - async fn get_bucket_info(&self, bucket: &str, opts: &BucketOptions) -> Result { + async fn get_bucket_info(&self, _bucket: &str, _opts: &BucketOptions) -> Result { unimplemented!() } @@ -339,11 +327,11 @@ impl StorageAPI for Sets { bucket: &str, object: &str, upload_id: &str, - part_id: usize, - data: PutObjReader, - opts: &ObjectOptions, + _part_id: usize, + _data: PutObjReader, + _opts: &ObjectOptions, ) -> Result { - let upload_path = get_upload_id_dir(bucket, object, upload_id); + let _upload_path = get_upload_id_dir(bucket, object, upload_id); // TODO: checkUploadIDExists @@ -364,6 +352,8 @@ impl StorageAPI for Sets { write_quorum += 1 } + let _ = write_quorum; + let mut fi = FileInfo::new([bucket, object].join("/").as_str(), data_drives, parity_drives); fi.data_dir = Uuid::new_v4(); diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index db06150b5..e7bf26224 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -3,7 +3,6 @@ use std::collections::HashMap; use anyhow::{Error, Result}; use s3s::{dto::StreamingBlob, Body}; -use tracing::debug; use uuid::Uuid; use crate::{ diff --git a/ecstore/src/store_api.rs b/ecstore/src/store_api.rs index b043a827e..36543649f 100644 --- a/ecstore/src/store_api.rs +++ b/ecstore/src/store_api.rs @@ -1,11 +1,6 @@ -use std::{default, sync::Arc}; - use anyhow::Result; -use bytes::Bytes; -use futures::Stream; -use s3s::{dto::StreamingBlob, Body}; +use s3s::dto::StreamingBlob; use time::OffsetDateTime; -use tracing::debug; use uuid::Uuid; pub const ERASURE_ALGORITHM: &str = "rs-vandermonde"; diff --git a/ecstore/src/utils/string.rs b/ecstore/src/utils/string.rs index 1f2dbc60d..137f7f1f4 100644 --- a/ecstore/src/utils/string.rs +++ b/ecstore/src/utils/string.rs @@ -1,133 +1,133 @@ -use std::collections::HashMap; -use std::fmt; +// use std::collections::HashMap; +// use std::fmt; -#[derive(Debug, Clone)] -pub struct StringSet(HashMap); +// #[derive(Debug, Clone)] +// pub struct StringSet(HashMap); -impl StringSet { - // ToSlice - returns StringSet as a vector of strings. - pub fn to_slice(&self) -> Vec { - let mut keys = self.0.keys().cloned().collect::>(); - keys.sort(); - keys - } +// impl StringSet { +// // ToSlice - returns StringSet as a vector of strings. +// pub fn to_slice(&self) -> Vec { +// let mut keys = self.0.keys().cloned().collect::>(); +// keys.sort(); +// keys +// } - // IsEmpty - returns whether the set is empty or not. - pub fn is_empty(&self) -> bool { - self.0.len() == 0 - } +// // IsEmpty - returns whether the set is empty or not. +// pub fn is_empty(&self) -> bool { +// self.0.len() == 0 +// } - // Add - adds a string to the set. - pub fn add(&mut self, s: String) { - self.0.insert(s, ()); - } +// // Add - adds a string to the set. +// pub fn add(&mut self, s: String) { +// self.0.insert(s, ()); +// } - // Remove - removes a string from the set. It does nothing if the string does not exist in the set. - pub fn remove(&mut self, s: &str) { - self.0.remove(s); - } +// // Remove - removes a string from the set. It does nothing if the string does not exist in the set. +// pub fn remove(&mut self, s: &str) { +// self.0.remove(s); +// } - // Contains - checks if a string is in the set. - pub fn contains(&self, s: &str) -> bool { - self.0.contains_key(s) - } +// // Contains - checks if a string is in the set. +// pub fn contains(&self, s: &str) -> bool { +// self.0.contains_key(s) +// } - // FuncMatch - returns a new set containing each value that passes the match function. - pub fn func_match(&self, match_fn: F, match_string: &str) -> StringSet - where - F: Fn(&str, &str) -> bool, - { - StringSet( - self.0 - .iter() - .filter(|(k, _)| match_fn(k, match_string)) - .map(|(k, _)| (k.clone(), ())) - .collect::>(), - ) - } +// // FuncMatch - returns a new set containing each value that passes the match function. +// pub fn func_match(&self, match_fn: F, match_string: &str) -> StringSet +// where +// F: Fn(&str, &str) -> bool, +// { +// StringSet( +// self.0 +// .iter() +// .filter(|(k, _)| match_fn(k, match_string)) +// .map(|(k, _)| (k.clone(), ())) +// .collect::>(), +// ) +// } - // ApplyFunc - returns a new set containing each value processed by 'apply_fn'. - pub fn apply_func(&self, apply_fn: F) -> StringSet - where - F: Fn(&str) -> String, - { - StringSet( - self.0 - .iter() - .map(|(k, _)| (apply_fn(k), ())) - .collect::>(), - ) - } +// // ApplyFunc - returns a new set containing each value processed by 'apply_fn'. +// pub fn apply_func(&self, apply_fn: F) -> StringSet +// where +// F: Fn(&str) -> String, +// { +// StringSet( +// self.0 +// .iter() +// .map(|(k, _)| (apply_fn(k), ())) +// .collect::>(), +// ) +// } - // Equals - checks whether the given set is equal to the current set or not. - pub fn equals(&self, other: &StringSet) -> bool { - if self.0.len() != other.0.len() { - return false; - } - self.0.iter().all(|(k, _)| other.0.contains_key(k)) - } +// // Equals - checks whether the given set is equal to the current set or not. +// pub fn equals(&self, other: &StringSet) -> bool { +// if self.0.len() != other.0.len() { +// return false; +// } +// self.0.iter().all(|(k, _)| other.0.contains_key(k)) +// } - // Intersection - returns the intersection with the given set as a new set. - pub fn intersection(&self, other: &StringSet) -> StringSet { - StringSet( - self.0 - .iter() - .filter(|(k, _)| other.0.contains_key::(k)) - .map(|(k, _)| (k.clone(), ())) - .collect::>(), - ) - } +// // Intersection - returns the intersection with the given set as a new set. +// pub fn intersection(&self, other: &StringSet) -> StringSet { +// StringSet( +// self.0 +// .iter() +// .filter(|(k, _)| other.0.contains_key::(k)) +// .map(|(k, _)| (k.clone(), ())) +// .collect::>(), +// ) +// } - // Difference - returns the difference with the given set as a new set. - pub fn difference(&self, other: &StringSet) -> StringSet { - StringSet( - self.0 - .iter() - .filter(|(k, _)| !other.0.contains_key::(k)) - .map(|(k, _)| (k.clone(), ())) - .collect::>(), - ) - } +// // Difference - returns the difference with the given set as a new set. +// pub fn difference(&self, other: &StringSet) -> StringSet { +// StringSet( +// self.0 +// .iter() +// .filter(|(k, _)| !other.0.contains_key::(k)) +// .map(|(k, _)| (k.clone(), ())) +// .collect::>(), +// ) +// } - // Union - returns the union with the given set as a new set. - pub fn union(&self, other: &StringSet) -> StringSet { - let mut new_set = self.clone(); - for (k, _) in other.0.iter() { - new_set.0.insert(k.clone(), ()); - } - new_set - } -} +// // Union - returns the union with the given set as a new set. +// pub fn union(&self, other: &StringSet) -> StringSet { +// let mut new_set = self.clone(); +// for (k, _) in other.0.iter() { +// new_set.0.insert(k.clone(), ()); +// } +// new_set +// } +// } -// Implementing JSON serialization and deserialization would require the serde crate. -// You would also need to implement Display and PartialEq traits for more idiomatic Rust. +// // Implementing JSON serialization and deserialization would require the serde crate. +// // You would also need to implement Display and PartialEq traits for more idiomatic Rust. -// Implementing Display trait to provide a string representation of the set. -impl fmt::Display for StringSet { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.to_slice().join(", ")) - } -} +// // Implementing Display trait to provide a string representation of the set. +// impl fmt::Display for StringSet { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// write!(f, "{}", self.to_slice().join(", ")) +// } +// } -// Implementing PartialEq and Eq traits to allow comparison of StringSet instances. -impl PartialEq for StringSet { - fn eq(&self, other: &StringSet) -> bool { - self.equals(other) - } -} +// // Implementing PartialEq and Eq traits to allow comparison of StringSet instances. +// impl PartialEq for StringSet { +// fn eq(&self, other: &StringSet) -> bool { +// self.equals(other) +// } +// } -impl Eq for StringSet {} +// impl Eq for StringSet {} -// NewStringSet - creates a new string set. -pub fn new_string_set() -> StringSet { - StringSet(HashMap::new()) -} +// // NewStringSet - creates a new string set. +// pub fn new_string_set() -> StringSet { +// StringSet(HashMap::new()) +// } -// CreateStringSet - creates a new string set with given string values. -pub fn create_string_set(sl: Vec) -> StringSet { - let mut set = new_string_set(); - for k in sl { - set.add(k); - } - set -} +// // CreateStringSet - creates a new string set with given string values. +// pub fn create_string_set(sl: Vec) -> StringSet { +// let mut set = new_string_set(); +// for k in sl { +// set.add(k); +// } +// set +// } diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index 5c2ecdb42..8f259f77f 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -17,7 +17,6 @@ use s3s::{S3Request, S3Response}; use anyhow::Result; use ecstore::store::ECStore; -use tracing::error; macro_rules! try_ { ($result:expr) => { @@ -54,14 +53,14 @@ impl S3 for FS { .await ); - let output = CreateBucketOutput::default(); // TODO: handle other fields + let output = CreateBucketOutput::default(); Ok(S3Response::new(output)) } #[tracing::instrument] async fn copy_object(&self, req: S3Request) -> S3Result> { let input = req.input; - let (bucket, key) = match input.copy_source { + let (_bucket, _key) = match input.copy_source { CopySource::AccessPoint { .. } => return Err(s3_error!(NotImplemented)), CopySource::Bucket { ref bucket, ref key, .. } => (bucket, key), }; @@ -72,22 +71,22 @@ impl S3 for FS { #[tracing::instrument] async fn delete_bucket(&self, req: S3Request) -> S3Result> { - let input = req.input; + let _input = req.input; Ok(S3Response::new(DeleteBucketOutput {})) } #[tracing::instrument] async fn delete_object(&self, req: S3Request) -> S3Result> { - let input = req.input; + let _input = req.input; - let output = DeleteObjectOutput::default(); // TODO: handle other fields + let output = DeleteObjectOutput::default(); Ok(S3Response::new(output)) } #[tracing::instrument] async fn delete_objects(&self, req: S3Request) -> S3Result> { - let input = req.input; + let _input = req.input; let output = DeleteObjectsOutput { ..Default::default() }; Ok(S3Response::new(output)) @@ -146,7 +145,7 @@ impl S3 for FS { #[tracing::instrument] async fn head_object(&self, req: S3Request) -> S3Result> { - let input = req.input; + let _input = req.input; let output = HeadObjectOutput { ..Default::default() }; Ok(S3Response::new(output)) @@ -175,7 +174,7 @@ impl S3 for FS { #[tracing::instrument] async fn list_objects_v2(&self, req: S3Request) -> S3Result> { - let input = req.input; + let _input = req.input; let output = ListObjectsV2Output { ..Default::default() }; Ok(S3Response::new(output)) @@ -196,7 +195,7 @@ impl S3 for FS { body, bucket, key, - metadata, + // metadata, content_length, .. } = input; @@ -244,14 +243,14 @@ impl S3 for FS { async fn upload_part(&self, req: S3Request) -> S3Result> { let UploadPartInput { body, - upload_id, - part_number, + // upload_id, + // part_number, content_length, .. } = req.input; - let body = body.ok_or_else(|| s3_error!(IncompleteBody))?; - let content_length = content_length.ok_or_else(|| s3_error!(IncompleteBody))?; + let _body = body.ok_or_else(|| s3_error!(IncompleteBody))?; + let _content_length = content_length.ok_or_else(|| s3_error!(IncompleteBody))?; // mc cp step 4 @@ -261,7 +260,7 @@ impl S3 for FS { #[tracing::instrument] async fn upload_part_copy(&self, req: S3Request) -> S3Result> { - let input = req.input; + let _input = req.input; let output = UploadPartCopyOutput { ..Default::default() }; @@ -289,10 +288,10 @@ impl S3 for FS { req: S3Request, ) -> S3Result> { let CompleteMultipartUploadInput { - multipart_upload, + // multipart_upload, bucket, key, - upload_id, + // upload_id, .. } = req.input; @@ -307,7 +306,7 @@ impl S3 for FS { #[tracing::instrument] async fn abort_multipart_upload( &self, - req: S3Request, + _req: S3Request, ) -> S3Result> { Ok(S3Response::new(AbortMultipartUploadOutput { ..Default::default() })) }