refactor: Restructure project layout and clean up dependencies (#30)

This commit introduces a significant reorganization of the project structure to improve maintainability and clarity.

Key changes include:
- Adjusted the directory layout for a more logical module organization.
- Removed unused crate dependencies, reducing the overall project size and potentially speeding up build times.
- Updated import paths and configuration files to reflect the structural changes.
This commit is contained in:
houseme
2025-07-02 19:33:12 +08:00
committed by GitHub
parent 0be4264eb1
commit 5826396cd0
322 changed files with 977 additions and 1542 deletions
+13 -36
View File
@@ -31,47 +31,37 @@ workspace = true
[dependencies]
rustfs-zip = { workspace = true }
tokio-tar = { workspace = true }
madmin = { workspace = true }
api = { workspace = true }
appauth = { workspace = true }
rustfs-madmin = { workspace = true }
rustfs-s3select-api = { workspace = true }
rustfs-appauth = { workspace = true }
rustfs-ecstore = { workspace = true }
rustfs-policy = { workspace = true }
rustfs-common = { workspace = true }
atoi = { workspace = true }
atomic_enum = { workspace = true }
aws-sdk-s3 = { workspace = true }
axum.workspace = true
axum-extra = { workspace = true }
axum-server = { workspace = true }
async-trait.workspace = true
bytes.workspace = true
async-trait = { workspace = true }
bytes = { workspace = true }
chrono = { workspace = true }
clap.workspace = true
crypto = { workspace = true }
clap = { workspace = true }
datafusion = { workspace = true }
common.workspace = true
const-str = { workspace = true }
ecstore.workspace = true
policy.workspace = true
flatbuffers.workspace = true
futures.workspace = true
futures-util.workspace = true
hyper.workspace = true
hyper-util.workspace = true
http.workspace = true
http-body.workspace = true
iam = { workspace = true }
include_dir = { workspace = true }
jsonwebtoken = { workspace = true }
lock.workspace = true
rustfs-iam = { workspace = true }
matchit = { workspace = true }
mime.workspace = true
mime_guess = { workspace = true }
opentelemetry = { workspace = true }
percent-encoding = { workspace = true }
pin-project-lite.workspace = true
protos.workspace = true
query = { workspace = true }
regex = { workspace = true }
rustfs-protos.workspace = true
rustfs-s3select-query = { workspace = true }
reqwest = { workspace = true }
rmp-serde.workspace = true
rustfs-config = { workspace = true, features = ["constants", "notify"] }
rustfs-notify = { workspace = true }
rustfs-obs = { workspace = true }
@@ -99,7 +89,6 @@ lazy_static.workspace = true
tokio-stream.workspace = true
tonic = { workspace = true }
tower.workspace = true
transform-stream.workspace = true
tower-http = { workspace = true, features = [
"trace",
"compression-deflate",
@@ -110,9 +99,6 @@ urlencoding = { workspace = true }
uuid = { workspace = true }
rustfs-filemeta.workspace = true
rustfs-rio.workspace = true
base64 = { workspace = true }
hmac = { workspace = true }
sha2 = { workspace = true }
zip = { workspace = true }
[target.'cfg(target_os = "linux")'.dependencies]
@@ -122,22 +108,13 @@ libsystemd.workspace = true
tikv-jemallocator = "0.6"
[build-dependencies]
prost-build.workspace = true
tonic-build.workspace = true
http.workspace = true
bytes.workspace = true
futures.workspace = true
futures-util.workspace = true
# uuid = { version = "1.8.0", features = ["v4", "fast-rng", "serde"] }
ecstore = { workspace = true }
s3s.workspace = true
s3s = { workspace = true }
clap = { workspace = true }
hyper-util = { workspace = true, features = [
"tokio",
"server-auto",
"server-graceful",
] }
transform-stream = { workspace = true }
netif = "0.1.6"
shadow-rs = { workspace = true, features = ["build"] }
# pin-utils = "0.1.0"
+40 -39
View File
@@ -18,39 +18,38 @@ use crate::auth::get_condition_values;
use crate::auth::get_session_token;
use crate::error::ApiError;
use bytes::Bytes;
use ecstore::admin_server_info::get_server_info;
use ecstore::bucket::metadata_sys::{self, get_replication_config};
use ecstore::bucket::target::BucketTarget;
use ecstore::bucket::versioning_sys::BucketVersioningSys;
use ecstore::cmd::bucket_targets::{self, GLOBAL_Bucket_Target_Sys};
use ecstore::error::StorageError;
use ecstore::global::GLOBAL_ALlHealState;
use ecstore::global::get_global_action_cred;
use ecstore::heal::data_usage::load_data_usage_from_backend;
use ecstore::heal::heal_commands::HealOpts;
use ecstore::heal::heal_ops::new_heal_sequence;
use ecstore::metrics_realtime::{CollectMetricsOpts, MetricType, collect_local_metrics};
use ecstore::new_object_layer_fn;
use ecstore::pools::{get_total_usable_capacity, get_total_usable_capacity_free};
use ecstore::store::is_valid_object_prefix;
use ecstore::store_api::BucketOptions;
use ecstore::store_api::StorageAPI;
use ecstore::store_utils::is_reserved_or_invalid_bucket;
use futures::{Stream, StreamExt};
use http::{HeaderMap, Uri};
use hyper::StatusCode;
use iam::store::MappedPolicy;
use rustfs_utils::path::path_join;
// use lazy_static::lazy_static;
use madmin::metrics::RealtimeMetrics;
use madmin::utils::parse_duration;
use matchit::Params;
use percent_encoding::{AsciiSet, CONTROLS, percent_encode};
use policy::policy::Args;
use policy::policy::BucketPolicy;
use policy::policy::action::Action;
use policy::policy::action::S3Action;
use policy::policy::default::DEFAULT_POLICIES;
use rustfs_ecstore::admin_server_info::get_server_info;
use rustfs_ecstore::bucket::metadata_sys::{self, get_replication_config};
use rustfs_ecstore::bucket::target::BucketTarget;
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
use rustfs_ecstore::cmd::bucket_targets::{self, GLOBAL_Bucket_Target_Sys};
use rustfs_ecstore::error::StorageError;
use rustfs_ecstore::global::GLOBAL_ALlHealState;
use rustfs_ecstore::global::get_global_action_cred;
use rustfs_ecstore::heal::data_usage::load_data_usage_from_backend;
use rustfs_ecstore::heal::heal_commands::HealOpts;
use rustfs_ecstore::heal::heal_ops::new_heal_sequence;
use rustfs_ecstore::metrics_realtime::{CollectMetricsOpts, MetricType, collect_local_metrics};
use rustfs_ecstore::new_object_layer_fn;
use rustfs_ecstore::pools::{get_total_usable_capacity, get_total_usable_capacity_free};
use rustfs_ecstore::store::is_valid_object_prefix;
use rustfs_ecstore::store_api::BucketOptions;
use rustfs_ecstore::store_api::StorageAPI;
use rustfs_ecstore::store_utils::is_reserved_or_invalid_bucket;
use rustfs_iam::store::MappedPolicy;
use rustfs_madmin::metrics::RealtimeMetrics;
use rustfs_madmin::utils::parse_duration;
use rustfs_policy::policy::Args;
use rustfs_policy::policy::BucketPolicy;
use rustfs_policy::policy::action::Action;
use rustfs_policy::policy::action::S3Action;
use rustfs_policy::policy::default::DEFAULT_POLICIES;
use rustfs_utils::path::path_join;
use s3s::header::CONTENT_TYPE;
use s3s::stream::{ByteStream, DynByteStream};
use s3s::{Body, S3Error, S3Request, S3Response, S3Result, s3_error};
@@ -87,7 +86,7 @@ use urlencoding::decode;
#[serde(rename_all = "PascalCase", default)]
pub struct AccountInfo {
pub account_name: String,
pub server: madmin::BackendInfo,
pub server: rustfs_madmin::BackendInfo,
pub policy: BucketPolicy,
}
@@ -106,7 +105,9 @@ impl Operation for AccountInfoHandler {
let (cred, owner) =
check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &input_cred.access_key).await?;
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let default_claims = HashMap::new();
let claims = cred.claims.as_ref().unwrap_or(&default_claims);
@@ -211,7 +212,7 @@ impl Operation for AccountInfoHandler {
));
};
let mut effective_policy: policy::policy::Policy = Default::default();
let mut effective_policy: rustfs_policy::policy::Policy = Default::default();
if account_name == admin_cred.access_key {
for (name, p) in DEFAULT_POLICIES.iter() {
@@ -240,7 +241,7 @@ impl Operation for AccountInfoHandler {
let policy_str = serde_json::to_string(&effective_policy)
.map_err(|_e| S3Error::with_message(S3ErrorCode::InternalError, "parse policy failed"))?;
let mut account_info = madmin::AccountInfo {
let mut account_info = rustfs_madmin::AccountInfo {
account_name,
server: store.backend_info().await,
policy: serde_json::Value::String(policy_str),
@@ -261,15 +262,15 @@ impl Operation for AccountInfoHandler {
if rd || wr {
// TODO: BucketQuotaSys
// TODO: other attributes
account_info.buckets.push(madmin::BucketAccessInfo {
account_info.buckets.push(rustfs_madmin::BucketAccessInfo {
name: bucket.name.clone(),
details: Some(madmin::BucketDetails {
details: Some(rustfs_madmin::BucketDetails {
versioning: BucketVersioningSys::enabled(bucket.name.as_str()).await,
versioning_suspended: BucketVersioningSys::suspended(bucket.name.as_str()).await,
..Default::default()
}),
created: bucket.created,
access: madmin::AccountAccess { read: rd, write: wr },
access: rustfs_madmin::AccountAccess { read: rd, write: wr },
..Default::default()
});
}
@@ -832,9 +833,9 @@ impl Operation for SetRemoteTargetHandler {
};
// let binfo:BucketInfo = store
// .get_bucket_info(bucket, &ecstore::store_api::BucketOptions::default()).await;
// .get_bucket_info(bucket, &rustfs_ecstore::store_api::BucketOptions::default()).await;
match store
.get_bucket_info(bucket, &ecstore::store_api::BucketOptions::default())
.get_bucket_info(bucket, &rustfs_ecstore::store_api::BucketOptions::default())
.await
{
Ok(info) => {
@@ -949,7 +950,7 @@ impl Operation for ListRemoteTargetHandler {
};
match store
.get_bucket_info(bucket, &ecstore::store_api::BucketOptions::default())
.get_bucket_info(bucket, &rustfs_ecstore::store_api::BucketOptions::default())
.await
{
Ok(info) => {
@@ -1047,7 +1048,7 @@ impl Operation for RemoveRemoteTargetHandler {
#[cfg(test)]
mod test {
use ecstore::heal::heal_commands::HealOpts;
use rustfs_ecstore::heal::heal_commands::HealOpts;
#[ignore] // FIXME: failed in github actions
#[test]
+14 -13
View File
@@ -22,7 +22,9 @@ use crate::{
auth::{check_key_valid, get_session_token},
};
use ecstore::{
use http::{HeaderMap, StatusCode};
use matchit::Params;
use rustfs_ecstore::{
StorageAPI,
bucket::{
metadata::{
@@ -38,13 +40,11 @@ use ecstore::{
new_object_layer_fn,
store_api::BucketOptions,
};
use ecstore::{
use rustfs_ecstore::{
bucket::utils::{deserialize, serialize},
store_api::MakeBucketOptions,
};
use http::{HeaderMap, StatusCode};
use matchit::Params;
use policy::policy::BucketPolicy;
use rustfs_policy::policy::BucketPolicy;
use rustfs_utils::path::{SLASH_SEPARATOR, path_join_buf};
use s3s::{
Body, S3Request, S3Response, S3Result,
@@ -125,15 +125,16 @@ impl Operation for ExportBucketMetadata {
let conf_path = path_join_buf(&[bucket.name.as_str(), conf]);
match conf {
BUCKET_POLICY_CONFIG => {
let config: policy::policy::BucketPolicy = match metadata_sys::get_bucket_policy(&bucket.name).await {
Ok((res, _)) => res,
Err(e) => {
if e == StorageError::ConfigNotFound {
continue;
let config: rustfs_policy::policy::BucketPolicy =
match metadata_sys::get_bucket_policy(&bucket.name).await {
Ok((res, _)) => res,
Err(e) => {
if e == StorageError::ConfigNotFound {
continue;
}
return Err(s3_error!(InternalError, "get bucket metadata failed: {e}"));
}
return Err(s3_error!(InternalError, "get bucket metadata failed: {e}"));
}
};
};
let config_json =
serde_json::to_vec(&config).map_err(|e| s3_error!(InternalError, "serialize config failed: {e}"))?;
zip_writer
+7 -4
View File
@@ -74,14 +74,17 @@ impl Operation for SetNotificationTarget {
let mut kvs_map: HashMap<String, String> = serde_json::from_slice(&body)
.map_err(|e| s3_error!(InvalidArgument, "invalid json body for target config: {}", e))?;
// If there is an enable key, add an enable key value to "on"
if !kvs_map.contains_key(ecstore::config::ENABLE_KEY) {
kvs_map.insert(ecstore::config::ENABLE_KEY.to_string(), ecstore::config::ENABLE_ON.to_string());
if !kvs_map.contains_key(rustfs_ecstore::config::ENABLE_KEY) {
kvs_map.insert(
rustfs_ecstore::config::ENABLE_KEY.to_string(),
rustfs_ecstore::config::ENABLE_ON.to_string(),
);
}
let kvs = ecstore::config::KVS(
let kvs = rustfs_ecstore::config::KVS(
kvs_map
.into_iter()
.map(|(key, value)| ecstore::config::KV {
.map(|(key, value)| rustfs_ecstore::config::KV {
key,
value,
hidden_if_empty: false, // Set a default value
+7 -7
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::global::get_global_action_cred;
use http::{HeaderMap, StatusCode};
use iam::error::{is_err_no_such_group, is_err_no_such_user};
use madmin::GroupAddRemove;
use matchit::Params;
use rustfs_ecstore::global::get_global_action_cred;
use rustfs_iam::error::{is_err_no_such_group, is_err_no_such_user};
use rustfs_madmin::GroupAddRemove;
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
use serde::Deserialize;
use serde_urlencoded::from_bytes;
@@ -36,7 +36,7 @@ impl Operation for ListGroups {
async fn call(&self, _req: S3Request<Body>, _params: Params<'_, '_>) -> S3Result<S3Response<(StatusCode, Body)>> {
warn!("handle ListGroups");
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let groups = iam_store.list_groups().await.map_err(|e| {
warn!("list groups failed, e: {:?}", e);
@@ -67,7 +67,7 @@ impl Operation for GetGroup {
GroupQuery::default()
}
};
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let g = iam_store.get_group_description(&query.group).await.map_err(|e| {
warn!("get group failed, e: {:?}", e);
@@ -103,7 +103,7 @@ impl Operation for SetGroupStatus {
return Err(s3_error!(InvalidArgument, "group is required"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
if let Some(status) = query.status {
match status.as_str() {
@@ -154,7 +154,7 @@ impl Operation for UpdateGroupMembers {
warn!("UpdateGroupMembers args {:?}", args);
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
for member in args.members.iter() {
match iam_store.is_temp_user(member).await {
+10 -10
View File
@@ -13,12 +13,12 @@
// limitations under the License.
use crate::admin::{router::Operation, utils::has_space_be};
use ecstore::global::get_global_action_cred;
use http::{HeaderMap, StatusCode};
use iam::error::is_err_no_such_user;
use iam::store::MappedPolicy;
use matchit::Params;
use policy::policy::Policy;
use rustfs_ecstore::global::get_global_action_cred;
use rustfs_iam::error::is_err_no_such_user;
use rustfs_iam::store::MappedPolicy;
use rustfs_policy::policy::Policy;
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
use serde::Deserialize;
use serde_urlencoded::from_bytes;
@@ -46,7 +46,7 @@ impl Operation for ListCannedPolicies {
}
};
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let policies = iam_store.list_polices(&query.bucket).await.map_err(|e| {
warn!("list policies failed, e: {:?}", e);
@@ -114,7 +114,7 @@ impl Operation for AddCannedPolicy {
return Err(s3_error!(InvalidRequest, "policy version is empty"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
iam_store.set_policy(&query.name, policy).await.map_err(|e| {
warn!("set policy failed, e: {:?}", e);
@@ -153,7 +153,7 @@ impl Operation for InfoCannedPolicy {
return Err(s3_error!(InvalidArgument, "too many policies"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let pd = iam_store.info_policy(&query.name).await.map_err(|e| {
warn!("info policy failed, e: {:?}", e);
@@ -189,7 +189,7 @@ impl Operation for RemoveCannedPolicy {
return Err(s3_error!(InvalidArgument, "policy name is empty"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
iam_store.delete_policy(&query.name, true).await.map_err(|e| {
warn!("delete policy failed, e: {:?}", e);
@@ -237,7 +237,7 @@ impl Operation for SetPolicyForUserOrGroup {
return Err(s3_error!(InvalidArgument, "user or group is empty"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else { return Err(s3_error!(InternalError, "iam not init")) };
if !query.is_group {
match iam_store.is_temp_user(&query.user_or_group).await {
@@ -275,7 +275,7 @@ impl Operation for SetPolicyForUserOrGroup {
}
iam_store
.policy_db_set(&query.user_or_group, iam::store::UserType::Reg, query.is_group, &query.policy_name)
.policy_db_set(&query.user_or_group, rustfs_iam::store::UserType::Reg, query.is_group, &query.policy_name)
.await
.map_err(|e| {
warn!("policy db set failed, e: {:?}", e);
+1 -1
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::{GLOBAL_Endpoints, new_object_layer_fn};
use http::{HeaderMap, StatusCode};
use matchit::Params;
use rustfs_ecstore::{GLOBAL_Endpoints, new_object_layer_fn};
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
use serde::Deserialize;
use serde_urlencoded::from_bytes;
+4 -4
View File
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::{
use http::{HeaderMap, StatusCode};
use matchit::Params;
use rustfs_ecstore::{
StorageAPI,
error::StorageError,
new_object_layer_fn,
@@ -20,8 +22,6 @@ use ecstore::{
rebalance::{DiskStat, RebalSaveOpt},
store_api::BucketOptions,
};
use http::{HeaderMap, StatusCode};
use matchit::Params;
use s3s::{Body, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
use serde::{Deserialize, Serialize};
use std::time::Duration;
@@ -29,7 +29,7 @@ use time::OffsetDateTime;
use tracing::warn;
use crate::admin::router::Operation;
use ecstore::rebalance::RebalanceMeta;
use rustfs_ecstore::rebalance::RebalanceMeta;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct RebalanceResp {
+22 -12
View File
@@ -15,18 +15,18 @@
use crate::admin::utils::has_space_be;
use crate::auth::{get_condition_values, get_session_token};
use crate::{admin::router::Operation, auth::check_key_valid};
use ecstore::global::get_global_action_cred;
use http::HeaderMap;
use hyper::StatusCode;
use iam::error::is_err_no_such_service_account;
use iam::sys::{NewServiceAccountOpts, UpdateServiceAccountOpts};
use madmin::{
use matchit::Params;
use rustfs_ecstore::global::get_global_action_cred;
use rustfs_iam::error::is_err_no_such_service_account;
use rustfs_iam::sys::{NewServiceAccountOpts, UpdateServiceAccountOpts};
use rustfs_madmin::{
AddServiceAccountReq, AddServiceAccountResp, Credentials, InfoServiceAccountResp, ListServiceAccountsResp,
ServiceAccountInfo, UpdateServiceAccountReq,
};
use matchit::Params;
use policy::policy::action::{Action, AdminAction};
use policy::policy::{Args, Policy};
use rustfs_policy::policy::action::{Action, AdminAction};
use rustfs_policy::policy::{Args, Policy};
use s3s::S3ErrorCode::InvalidRequest;
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
use serde::Deserialize;
@@ -102,7 +102,9 @@ impl Operation for AddServiceAccount {
req_is_derived_cred = true;
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let deny_only = cred.access_key == target_user || cred.parent_user == target_user;
@@ -222,7 +224,9 @@ impl Operation for UpdateServiceAccount {
let access_key = query.access_key;
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
// let svc_account = iam_store.get_service_account(&access_key).await.map_err(|e| {
// debug!("get service account failed, e: {:?}", e);
@@ -329,7 +333,9 @@ impl Operation for InfoServiceAccount {
let access_key = query.access_key;
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let (svc_account, session_policy) = iam_store.get_service_account(&access_key).await.map_err(|e| {
debug!("get service account failed, e: {:?}", e);
@@ -466,7 +472,9 @@ impl Operation for ListServiceAccount {
// cred.parent_user
// };
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let target_account = if query.user.as_ref().is_some_and(|v| v != &cred.access_key) {
if !iam_store
@@ -552,7 +560,9 @@ impl Operation for DeleteServiceAccount {
return Err(s3_error!(InvalidArgument, "access key is empty"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let svc_account = match iam_store.get_service_account(&query.access_key).await {
Ok((res, _)) => Some(res),
+6 -4
View File
@@ -16,11 +16,11 @@ use crate::{
admin::router::Operation,
auth::{check_key_valid, get_session_token},
};
use ecstore::bucket::utils::serialize;
use http::StatusCode;
use iam::{manager::get_token_signing_key, sys::SESSION_POLICY_NAME};
use matchit::Params;
use policy::{auth::get_new_credentials_with_metadata, policy::Policy};
use rustfs_ecstore::bucket::utils::serialize;
use rustfs_iam::{manager::get_token_signing_key, sys::SESSION_POLICY_NAME};
use rustfs_policy::{auth::get_new_credentials_with_metadata, policy::Policy};
use rustfs_utils::crypto::base64_encode;
use s3s::{
Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result,
@@ -112,7 +112,9 @@ impl Operation for AssumeRoleHandle {
// 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")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
if let Err(_err) = iam_store.policy_db_get(&cred.access_key, &cred.groups).await {
return Err(s3_error!(InvalidArgument, "invalid policy arg"));
+2 -2
View File
@@ -14,11 +14,11 @@
// limitations under the License.
use http::{HeaderMap, StatusCode};
use time::OffsetDateTime;
//use iam::get_global_action_cred;
use matchit::Params;
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
use serde_urlencoded::from_bytes;
use time::OffsetDateTime;
use tracing::{debug, warn};
use crate::{
@@ -26,7 +26,7 @@ use crate::{
auth::{check_key_valid, get_session_token},
};
use ecstore::{
use rustfs_ecstore::{
config::storageclass,
global::GLOBAL_TierConfigMgr,
tier::{
+2 -2
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::{GLOBAL_Endpoints, rpc::PeerRestClient};
use http::StatusCode;
use hyper::Uri;
use madmin::service_commands::ServiceTraceOpts;
use matchit::Params;
use rustfs_ecstore::{GLOBAL_Endpoints, rpc::PeerRestClient};
use rustfs_madmin::service_commands::ServiceTraceOpts;
use s3s::{Body, S3Request, S3Response, S3Result, s3_error};
use tracing::warn;
+33 -19
View File
@@ -16,18 +16,18 @@ use crate::{
admin::{router::Operation, utils::has_space_be},
auth::{check_key_valid, get_condition_values, get_session_token},
};
use ecstore::global::get_global_action_cred;
use http::{HeaderMap, StatusCode};
use iam::{
use matchit::Params;
use rustfs_ecstore::global::get_global_action_cred;
use rustfs_iam::{
store::{GroupInfo, MappedPolicy, UserType},
sys::NewServiceAccountOpts,
};
use madmin::{
use rustfs_madmin::{
AccountStatus, AddOrUpdateUserReq, IAMEntities, IAMErrEntities, IAMErrEntity, IAMErrPolicyEntity,
user::{ImportIAMResult, SRSessionPolicy, SRSvcAccCreate},
};
use matchit::Params;
use policy::policy::{
use rustfs_policy::policy::{
Args,
action::{Action, AdminAction},
};
@@ -104,7 +104,9 @@ impl Operation for AddUser {
}
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
if let Some(user) = iam_store.get_user(ak).await {
if (user.credentials.is_temp() || user.credentials.is_service_account()) && cred.parent_user == ak {
@@ -180,7 +182,9 @@ impl Operation for SetUserStatus {
let status = AccountStatus::try_from(query.status.as_deref().unwrap_or_default())
.map_err(|e| S3Error::with_message(S3ErrorCode::InvalidArgument, e))?;
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
iam_store
.set_user_status(ak, status)
@@ -213,7 +217,9 @@ impl Operation for ListUsers {
}
};
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let users = {
if !query.bucket.is_empty() {
@@ -266,7 +272,9 @@ impl Operation for RemoveUser {
return Err(s3_error!(InvalidArgument, "access key is empty"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let (is_temp, _) = iam_store
.is_temp_user(ak)
@@ -327,7 +335,9 @@ impl Operation for GetUserInfo {
return Err(s3_error!(InvalidArgument, "access key is empty"));
}
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let Some(input_cred) = req.credentials else {
return Err(s3_error!(InvalidRequest, "get cred failed"));
@@ -401,7 +411,9 @@ impl Operation for ExportIam {
let (_cred, _owner) =
check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &input_cred.access_key).await?;
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let mut zip_writer = ZipWriter::new(Cursor::new(Vec::new()));
let options = SimpleFileOptions::default();
@@ -410,7 +422,7 @@ impl Operation for ExportIam {
let file_path = path_join_buf(&[IAM_ASSETS_DIR, file]);
match file {
ALL_POLICIES_FILE => {
let policies: HashMap<String, policy::policy::Policy> = iam_store
let policies: HashMap<String, rustfs_policy::policy::Policy> = iam_store
.list_polices("")
.await
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, e.to_string()))?;
@@ -615,7 +627,9 @@ impl Operation for ImportIam {
let mut zip_reader =
ZipArchive::new(Cursor::new(body)).map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, e.to_string()))?;
let Ok(iam_store) = iam::get() else { return Err(s3_error!(InvalidRequest, "iam not init")) };
let Ok(iam_store) = rustfs_iam::get() else {
return Err(s3_error!(InvalidRequest, "iam not init"));
};
let skipped = IAMEntities::default();
let mut removed = IAMEntities::default();
@@ -637,7 +651,7 @@ impl Operation for ImportIam {
};
if let Some(file_content) = file_content {
let policies: HashMap<String, policy::policy::Policy> = serde_json::from_slice(&file_content)
let policies: HashMap<String, rustfs_policy::policy::Policy> = serde_json::from_slice(&file_content)
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, e.to_string()))?;
for (name, policy) in policies {
if policy.id.is_empty() {
@@ -723,7 +737,7 @@ impl Operation for ImportIam {
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, e.to_string()))?;
for (group_name, group_info) in groups {
if let Err(e) = iam_store.get_group_description(&group_name).await {
if matches!(e, iam::error::Error::NoSuchGroup(_)) || has_space_be(&group_name) {
if matches!(e, rustfs_iam::error::Error::NoSuchGroup(_)) || has_space_be(&group_name) {
return Err(s3_error!(InvalidArgument, "group not found or has space be"));
}
}
@@ -763,7 +777,7 @@ impl Operation for ImportIam {
}
let sp = if let Some(ps) = req.session_policy.as_str() {
let sp = policy::policy::Policy::parse_config(ps.as_bytes())
let sp = rustfs_policy::policy::Policy::parse_config(ps.as_bytes())
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, e.to_string()))?;
Some(sp)
} else {
@@ -777,7 +791,7 @@ impl Operation for ImportIam {
let mut update = true;
if let Err(e) = iam_store.get_service_account(&req.access_key).await {
if !matches!(e, iam::error::Error::NoSuchServiceAccount(_)) {
if !matches!(e, rustfs_iam::error::Error::NoSuchServiceAccount(_)) {
return Err(s3_error!(InvalidArgument, "failed to get service account {ak} {e}"));
}
update = false;
@@ -838,7 +852,7 @@ impl Operation for ImportIam {
let has_temp = match iam_store.is_temp_user(&user_name).await {
Ok((has_temp, _)) => has_temp,
Err(e) => {
if !matches!(e, iam::error::Error::NoSuchUser(_)) {
if !matches!(e, rustfs_iam::error::Error::NoSuchUser(_)) {
return Err(s3_error!(InternalError, "is temp user failed, name: {user_name}, err: {e}"));
}
false
@@ -934,7 +948,7 @@ impl Operation for ImportIam {
let has_temp = match iam_store.is_temp_user(&user_name).await {
Ok((has_temp, _)) => has_temp,
Err(e) => {
if !matches!(e, iam::error::Error::NoSuchUser(_)) {
if !matches!(e, rustfs_iam::error::Error::NoSuchUser(_)) {
return Err(s3_error!(InternalError, "is temp user failed, name: {user_name}, err: {e}"));
}
false
+1 -1
View File
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::rpc::verify_rpc_signature;
use hyper::HeaderMap;
use hyper::Method;
use hyper::StatusCode;
@@ -20,6 +19,7 @@ use hyper::Uri;
use hyper::http::Extensions;
use matchit::Params;
use matchit::Router;
use rustfs_ecstore::rpc::verify_rpc_signature;
use s3s::Body;
use s3s::S3Request;
use s3s::S3Response;
+4 -4
View File
@@ -15,14 +15,14 @@
use super::router::AdminOperation;
use super::router::Operation;
use super::router::S3Router;
use ecstore::disk::DiskAPI;
use ecstore::disk::WalkDirOptions;
use ecstore::set_disk::DEFAULT_READ_BUFFER_SIZE;
use ecstore::store::find_local_disk;
use futures::StreamExt;
use http::StatusCode;
use hyper::Method;
use matchit::Params;
use rustfs_ecstore::disk::DiskAPI;
use rustfs_ecstore::disk::WalkDirOptions;
use rustfs_ecstore::set_disk::DEFAULT_READ_BUFFER_SIZE;
use rustfs_ecstore::store::find_local_disk;
use rustfs_utils::net::bytes_stream;
use s3s::Body;
use s3s::S3Request;
+7 -7
View File
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::global::get_global_action_cred;
use http::HeaderMap;
use http::Uri;
use iam::error::Error as IamError;
use iam::sys::SESSION_POLICY_NAME;
use policy::auth;
use policy::auth::get_claims_from_token_with_secret;
use rustfs_ecstore::global::get_global_action_cred;
use rustfs_iam::error::Error as IamError;
use rustfs_iam::sys::SESSION_POLICY_NAME;
use rustfs_policy::auth;
use rustfs_policy::auth::get_claims_from_token_with_secret;
use s3s::S3Error;
use s3s::S3ErrorCode;
use s3s::S3Result;
@@ -51,7 +51,7 @@ impl S3Auth for IAMAuth {
return Ok(key);
}
if let Ok(iam_store) = iam::get() {
if let Ok(iam_store) = rustfs_iam::get() {
if let Some(id) = iam_store.get_user(access_key).await {
return Ok(SecretKey::from(id.credentials.secret_key.clone()));
}
@@ -73,7 +73,7 @@ pub async fn check_key_valid(session_token: &str, access_key: &str) -> S3Result<
let sys_cred = cred.clone();
if cred.access_key != access_key {
let Ok(iam_store) = iam::get() else {
let Ok(iam_store) = rustfs_iam::get() else {
return Err(S3Error::with_message(
S3ErrorCode::InternalError,
format!("check_key_valid {:?}", IamError::IamSysNotInitialized),
+4 -4
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::error::StorageError;
use rustfs_ecstore::error::StorageError;
use s3s::{S3Error, S3ErrorCode};
#[derive(Debug)]
@@ -102,8 +102,8 @@ impl From<std::io::Error> for ApiError {
}
}
impl From<iam::error::Error> for ApiError {
fn from(err: iam::error::Error) -> Self {
impl From<rustfs_iam::error::Error> for ApiError {
fn from(err: rustfs_iam::error::Error) -> Self {
let serr: StorageError = err.into();
serr.into()
}
@@ -228,7 +228,7 @@ mod tests {
#[test]
fn test_api_error_from_iam_error() {
let iam_error = iam::error::Error::other("IAM test error");
let iam_error = rustfs_iam::error::Error::other("IAM test error");
let api_error: ApiError = iam_error.into();
// IAM error is first converted to StorageError, then to ApiError
+1 -1
View File
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::config::GLOBAL_ServerConfig;
use rustfs_config::DEFAULT_DELIMITER;
use rustfs_ecstore::config::GLOBAL_ServerConfig;
use tracing::{error, info, instrument};
#[instrument]
+2 -2
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use appauth::token::Token;
use rustfs_appauth::token::Token;
use std::io::{Error, Result};
use std::sync::OnceLock;
use std::time::SystemTime;
@@ -31,7 +31,7 @@ pub fn init_license(license: Option<String>) {
return;
}
let license = license.unwrap();
let token = appauth::token::parse_license(&license).unwrap_or_default();
let token = rustfs_appauth::token::parse_license(&license).unwrap_or_default();
LICENSE.set(token).unwrap_or_else(|_| {
error!("Failed to set license");
+20 -23
View File
@@ -34,26 +34,6 @@ use crate::server::{SHUTDOWN_TIMEOUT, ServiceState, ServiceStateManager, Shutdow
use bytes::Bytes;
use chrono::Datelike;
use clap::Parser;
use common::{
// error::{Error, Result},
globals::set_global_addr,
};
use ecstore::StorageAPI;
use ecstore::bucket::metadata_sys::init_bucket_metadata_sys;
use ecstore::cmd::bucket_replication::init_bucket_replication_pool;
use ecstore::config as ecconfig;
use ecstore::config::GLOBAL_ConfigSys;
use ecstore::heal::background_heal_ops::init_auto_heal;
use ecstore::rpc::make_server;
use ecstore::store_api::BucketOptions;
use ecstore::{
endpoints::EndpointServerPools,
heal::data_scanner::init_data_scanner,
set_global_endpoints,
store::{ECStore, init_local_disks},
update_erasure_type,
};
use ecstore::{global::set_global_rustfs_port, notification_sys::new_global_notification_sys};
use http::{HeaderMap, Request as HttpRequest, Response};
use hyper_util::server::graceful::GracefulShutdown;
use hyper_util::{
@@ -61,11 +41,28 @@ use hyper_util::{
server::conn::auto::Builder as ConnBuilder,
service::TowerToHyperService,
};
use iam::init_iam_sys;
use license::init_license;
use protos::proto_gen::node_service::node_service_server::NodeServiceServer;
use rustfs_common::globals::set_global_addr;
use rustfs_config::{DEFAULT_ACCESS_KEY, DEFAULT_SECRET_KEY, RUSTFS_TLS_CERT, RUSTFS_TLS_KEY};
use rustfs_ecstore::StorageAPI;
use rustfs_ecstore::bucket::metadata_sys::init_bucket_metadata_sys;
use rustfs_ecstore::cmd::bucket_replication::init_bucket_replication_pool;
use rustfs_ecstore::config as ecconfig;
use rustfs_ecstore::config::GLOBAL_ConfigSys;
use rustfs_ecstore::heal::background_heal_ops::init_auto_heal;
use rustfs_ecstore::rpc::make_server;
use rustfs_ecstore::store_api::BucketOptions;
use rustfs_ecstore::{
endpoints::EndpointServerPools,
heal::data_scanner::init_data_scanner,
set_global_endpoints,
store::{ECStore, init_local_disks},
update_erasure_type,
};
use rustfs_ecstore::{global::set_global_rustfs_port, notification_sys::new_global_notification_sys};
use rustfs_iam::init_iam_sys;
use rustfs_obs::{SystemObserver, init_obs, set_global_guard};
use rustfs_protos::proto_gen::node_service::node_service_server::NodeServiceServer;
use rustfs_utils::net::parse_and_resolve_address;
use rustls::ServerConfig;
use s3s::{host::MultiDomain, service::S3ServiceBuilder};
@@ -142,7 +139,7 @@ async fn run(opt: config::Opt) -> Result<()> {
debug!("server_address {}", &server_address);
// Set up AK and SK
ecstore::global::init_global_action_cred(Some(opt.access_key.clone()), Some(opt.secret_key.clone()));
rustfs_ecstore::global::init_global_action_cred(Some(opt.access_key.clone()), Some(opt.secret_key.clone()));
set_global_rustfs_port(server_port);
+6 -6
View File
@@ -15,11 +15,11 @@
use super::ecfs::FS;
use crate::auth::{check_key_valid, get_condition_values, get_session_token};
use crate::license::license_check;
use ecstore::bucket::policy_sys::PolicySys;
use iam::error::Error as IamError;
use policy::auth;
use policy::policy::action::{Action, S3Action};
use policy::policy::{Args, BucketPolicyArgs};
use rustfs_ecstore::bucket::policy_sys::PolicySys;
use rustfs_iam::error::Error as IamError;
use rustfs_policy::auth;
use rustfs_policy::policy::action::{Action, S3Action};
use rustfs_policy::policy::{Args, BucketPolicyArgs};
use s3s::access::{S3Access, S3AccessContext};
use s3s::{S3Error, S3ErrorCode, S3Request, S3Result, dto::*, s3_error};
use std::collections::HashMap;
@@ -39,7 +39,7 @@ pub async fn authorize_request<T>(req: &mut S3Request<T>, action: Action) -> S3R
let req_info = req.extensions.get_mut::<ReqInfo>().expect("ReqInfo not found");
if let Some(cred) = &req_info.cred {
let Ok(iam_store) = iam::get() else {
let Ok(iam_store) = rustfs_iam::get() else {
return Err(S3Error::with_message(
S3ErrorCode::InternalError,
format!("authorize_request {:?}", IamError::IamSysNotInitialized),
+56 -59
View File
@@ -22,71 +22,71 @@ use crate::storage::access::ReqInfo;
use crate::storage::options::copy_dst_opts;
use crate::storage::options::copy_src_opts;
use crate::storage::options::{extract_metadata_from_mime, get_opts};
use api::object_store::bytes_stream;
use api::query::Context;
use api::query::Query;
use api::server::dbms::DatabaseManagerSystem;
use bytes::Bytes;
use chrono::DateTime;
use chrono::Utc;
use datafusion::arrow::csv::WriterBuilder as CsvWriterBuilder;
use datafusion::arrow::json::WriterBuilder as JsonWriterBuilder;
use datafusion::arrow::json::writer::JsonArray;
use rustfs_s3select_api::object_store::bytes_stream;
use rustfs_s3select_api::query::Context;
use rustfs_s3select_api::query::Query;
use rustfs_s3select_api::server::dbms::DatabaseManagerSystem;
// use ecstore::store_api::RESERVED_METADATA_PREFIX;
use ecstore::bucket::lifecycle::bucket_lifecycle_ops::validate_transition_tier;
use ecstore::bucket::metadata::BUCKET_LIFECYCLE_CONFIG;
use ecstore::bucket::metadata::BUCKET_NOTIFICATION_CONFIG;
use ecstore::bucket::metadata::BUCKET_POLICY_CONFIG;
use ecstore::bucket::metadata::BUCKET_REPLICATION_CONFIG;
use ecstore::bucket::metadata::BUCKET_SSECONFIG;
use ecstore::bucket::metadata::BUCKET_TAGGING_CONFIG;
use ecstore::bucket::metadata::BUCKET_VERSIONING_CONFIG;
use ecstore::bucket::metadata::OBJECT_LOCK_CONFIG;
use ecstore::bucket::metadata_sys;
use ecstore::bucket::policy_sys::PolicySys;
use ecstore::bucket::tagging::decode_tags;
use ecstore::bucket::tagging::encode_tags;
use ecstore::bucket::utils::serialize;
use ecstore::bucket::versioning_sys::BucketVersioningSys;
use ecstore::cmd::bucket_replication::ReplicationStatusType;
use ecstore::cmd::bucket_replication::ReplicationType;
use ecstore::cmd::bucket_replication::get_must_replicate_options;
use ecstore::cmd::bucket_replication::must_replicate;
use ecstore::cmd::bucket_replication::schedule_replication;
use ecstore::compress::MIN_COMPRESSIBLE_SIZE;
use ecstore::compress::is_compressible;
use ecstore::error::StorageError;
use ecstore::new_object_layer_fn;
use ecstore::set_disk::DEFAULT_READ_BUFFER_SIZE;
use ecstore::store_api::BucketOptions;
use ecstore::store_api::CompletePart;
use ecstore::store_api::DeleteBucketOptions;
use ecstore::store_api::HTTPRangeSpec;
use ecstore::store_api::MakeBucketOptions;
use ecstore::store_api::MultipartUploadResult;
use ecstore::store_api::ObjectIO;
use ecstore::store_api::ObjectOptions;
use ecstore::store_api::ObjectToDelete;
use ecstore::store_api::PutObjReader;
use ecstore::store_api::StorageAPI;
// use rustfs_ecstore::store_api::RESERVED_METADATA_PREFIX;
use futures::StreamExt;
use http::HeaderMap;
use lazy_static::lazy_static;
use policy::auth;
use policy::policy::BucketPolicy;
use policy::policy::BucketPolicyArgs;
use policy::policy::Validator;
use policy::policy::action::Action;
use policy::policy::action::S3Action;
use query::instance::make_rustfsms;
use rustfs_ecstore::bucket::lifecycle::bucket_lifecycle_ops::validate_transition_tier;
use rustfs_ecstore::bucket::lifecycle::lifecycle::Lifecycle;
use rustfs_ecstore::bucket::metadata::BUCKET_LIFECYCLE_CONFIG;
use rustfs_ecstore::bucket::metadata::BUCKET_NOTIFICATION_CONFIG;
use rustfs_ecstore::bucket::metadata::BUCKET_POLICY_CONFIG;
use rustfs_ecstore::bucket::metadata::BUCKET_REPLICATION_CONFIG;
use rustfs_ecstore::bucket::metadata::BUCKET_SSECONFIG;
use rustfs_ecstore::bucket::metadata::BUCKET_TAGGING_CONFIG;
use rustfs_ecstore::bucket::metadata::BUCKET_VERSIONING_CONFIG;
use rustfs_ecstore::bucket::metadata::OBJECT_LOCK_CONFIG;
use rustfs_ecstore::bucket::metadata_sys;
use rustfs_ecstore::bucket::policy_sys::PolicySys;
use rustfs_ecstore::bucket::tagging::decode_tags;
use rustfs_ecstore::bucket::tagging::encode_tags;
use rustfs_ecstore::bucket::utils::serialize;
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
use rustfs_ecstore::cmd::bucket_replication::ReplicationStatusType;
use rustfs_ecstore::cmd::bucket_replication::ReplicationType;
use rustfs_ecstore::cmd::bucket_replication::get_must_replicate_options;
use rustfs_ecstore::cmd::bucket_replication::must_replicate;
use rustfs_ecstore::cmd::bucket_replication::schedule_replication;
use rustfs_ecstore::compress::MIN_COMPRESSIBLE_SIZE;
use rustfs_ecstore::compress::is_compressible;
use rustfs_ecstore::error::StorageError;
use rustfs_ecstore::new_object_layer_fn;
use rustfs_ecstore::set_disk::DEFAULT_READ_BUFFER_SIZE;
use rustfs_ecstore::store_api::BucketOptions;
use rustfs_ecstore::store_api::CompletePart;
use rustfs_ecstore::store_api::DeleteBucketOptions;
use rustfs_ecstore::store_api::HTTPRangeSpec;
use rustfs_ecstore::store_api::MakeBucketOptions;
use rustfs_ecstore::store_api::MultipartUploadResult;
use rustfs_ecstore::store_api::ObjectIO;
use rustfs_ecstore::store_api::ObjectOptions;
use rustfs_ecstore::store_api::ObjectToDelete;
use rustfs_ecstore::store_api::PutObjReader;
use rustfs_ecstore::store_api::StorageAPI;
use rustfs_filemeta::headers::RESERVED_METADATA_PREFIX_LOWER;
use rustfs_filemeta::headers::{AMZ_DECODED_CONTENT_LENGTH, AMZ_OBJECT_TAGGING};
use rustfs_notify::EventName;
use rustfs_policy::auth;
use rustfs_policy::policy::action::Action;
use rustfs_policy::policy::action::S3Action;
use rustfs_policy::policy::{BucketPolicy, BucketPolicyArgs, Validator};
use rustfs_rio::CompressReader;
use rustfs_rio::EtagReader;
use rustfs_rio::HashReader;
use rustfs_rio::Reader;
use rustfs_rio::WarpReader;
use rustfs_s3select_query::instance::make_rustfsms;
use rustfs_utils::CompressionAlgorithm;
use rustfs_utils::path::path_join_buf;
use rustfs_zip::CompressionFormat;
@@ -115,9 +115,6 @@ use tracing::info;
use tracing::warn;
use uuid::Uuid;
use ecstore::bucket::lifecycle::lifecycle::Lifecycle;
use rustfs_notify::EventName;
macro_rules! try_ {
($result:expr) => {
match $result {
@@ -329,7 +326,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::BucketCreated,
bucket_name: bucket.clone(),
object: ecstore::store_api::ObjectInfo { ..Default::default() },
object: rustfs_ecstore::store_api::ObjectInfo { ..Default::default() },
req_params: rustfs_utils::extract_req_params_header(&req.headers),
resp_elements: rustfs_utils::extract_resp_elements(&S3Response::new(output.clone())),
version_id: String::new(),
@@ -514,7 +511,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::BucketRemoved,
bucket_name: input.bucket,
object: ecstore::store_api::ObjectInfo { ..Default::default() },
object: rustfs_ecstore::store_api::ObjectInfo { ..Default::default() },
req_params: rustfs_utils::extract_req_params_header(&req.headers),
resp_elements: rustfs_utils::extract_resp_elements(&S3Response::new(DeleteBucketOutput {})),
version_id: String::new(),
@@ -585,7 +582,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::ObjectRemovedDelete,
bucket_name: bucket.clone(),
object: ecstore::store_api::ObjectInfo {
object: rustfs_ecstore::store_api::ObjectInfo {
name: key,
bucket,
..Default::default()
@@ -671,7 +668,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name,
bucket_name: bucket.clone(),
object: ecstore::store_api::ObjectInfo {
object: rustfs_ecstore::store_api::ObjectInfo {
name: dobj.object_name,
bucket: bucket.clone(),
..Default::default()
@@ -1376,7 +1373,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::ObjectCreatedCompleteMultipartUpload,
bucket_name: bucket_name.clone(),
object: ecstore::store_api::ObjectInfo {
object: rustfs_ecstore::store_api::ObjectInfo {
name: object_name,
bucket: bucket_name,
..Default::default()
@@ -1668,7 +1665,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::ObjectCreatedPutTagging,
bucket_name: bucket.clone(),
object: ecstore::store_api::ObjectInfo {
object: rustfs_ecstore::store_api::ObjectInfo {
name: object.clone(),
bucket,
..Default::default()
@@ -1735,7 +1732,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::ObjectCreatedDeleteTagging,
bucket_name: bucket.clone(),
object: ecstore::store_api::ObjectInfo {
object: rustfs_ecstore::store_api::ObjectInfo {
name: object.clone(),
bucket,
..Default::default()
@@ -2485,7 +2482,7 @@ impl S3 for FS {
let event_args = rustfs_notify::event::EventArgs {
event_name: EventName::ObjectAccessedAttributes,
bucket_name: bucket.clone(),
object: ecstore::store_api::ObjectInfo {
object: rustfs_ecstore::store_api::ObjectInfo {
name: key.clone(),
bucket,
..Default::default()
+2 -2
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use common::error::Error;
use ecstore::error::StorageError;
use s3s::{S3Error, S3ErrorCode, s3_error};
use rustfs_common::error::Error;
use s3s::{s3_error, S3Error, S3ErrorCode};
pub fn to_s3_error(err: Error) -> S3Error {
if let Some(storage_err) = err.downcast_ref::<StorageError>() {
return match storage_err {
+4 -4
View File
@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ecstore::bucket::versioning_sys::BucketVersioningSys;
use ecstore::error::Result;
use ecstore::error::StorageError;
use ecstore::store_api::ObjectOptions;
use http::{HeaderMap, HeaderValue};
use lazy_static::lazy_static;
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
use rustfs_ecstore::error::Result;
use rustfs_ecstore::error::StorageError;
use rustfs_ecstore::store_api::ObjectOptions;
use rustfs_utils::path::is_dir_object;
use std::collections::HashMap;
use uuid::Uuid;