refactor: expose remaining external owner symbols (#3751)

This commit is contained in:
Zhengchao An
2026-06-22 23:35:50 +08:00
committed by GitHub
parent ec5f112205
commit 6da61b44e5
7 changed files with 155 additions and 95 deletions
+37 -27
View File
@@ -15,11 +15,21 @@
use crate::error::{Error, Result};
use manager::IamCache;
use oidc::OidcSys;
use rustfs_ecstore::api::config as ecstore_config;
use rustfs_ecstore::api::error as ecstore_error;
use rustfs_ecstore::api::global as ecstore_global;
use rustfs_ecstore::api::notification as ecstore_notification;
use rustfs_ecstore::api::storage as ecstore_storage;
use rustfs_ecstore::api::config::RUSTFS_CONFIG_PREFIX as ECSTORE_RUSTFS_CONFIG_PREFIX;
use rustfs_ecstore::api::config::com::{
delete_config as ecstore_delete_config, read_config_no_lock as ecstore_read_config_no_lock,
read_config_with_metadata as ecstore_read_config_with_metadata, save_config as ecstore_save_config,
save_config_with_opts as ecstore_save_config_with_opts,
};
use rustfs_ecstore::api::error::{
Error as EcstoreErrorType, Result as EcstoreResultType, StorageError as EcstoreStorageError,
classify_system_path_failure_reason as ecstore_classify_system_path_failure_reason,
};
use rustfs_ecstore::api::global::is_first_cluster_node_local as ecstore_is_first_cluster_node_local;
use rustfs_ecstore::api::notification::{
NotificationPeerErr as EcstoreNotificationPeerErr, get_global_notification_sys as ecstore_get_global_notification_sys,
};
use rustfs_ecstore::api::storage::ECStore as EcstoreStore;
use std::sync::{Arc, OnceLock};
use store::object::ObjectStore;
use sys::IamSys;
@@ -41,17 +51,17 @@ pub mod store;
pub mod sys;
pub mod utils;
pub(crate) const IAM_CONFIG_ROOT_PREFIX: &str = ecstore_config::RUSTFS_CONFIG_PREFIX;
pub(crate) const IAM_CONFIG_ROOT_PREFIX: &str = ECSTORE_RUSTFS_CONFIG_PREFIX;
pub(crate) type IamEcstoreError = ecstore_error::Error;
pub(crate) type IamStorageError = ecstore_error::StorageError;
pub(crate) type IamStorageResult<T> = ecstore_error::Result<T>;
pub(crate) type IamStore = ecstore_storage::ECStore;
pub(crate) type IamEcstoreError = EcstoreErrorType;
pub(crate) type IamStorageError = EcstoreStorageError;
pub(crate) type IamStorageResult<T> = EcstoreResultType<T>;
pub(crate) type IamStore = EcstoreStore;
pub(crate) type IamConfigObjectInfo = <IamStore as rustfs_storage_api::ObjectOperations>::ObjectInfo;
pub(crate) type IamConfigObjectOptions = <IamStore as rustfs_storage_api::ObjectOperations>::ObjectOptions;
pub(crate) async fn read_iam_config_no_lock(api: Arc<IamStore>, file: &str) -> IamStorageResult<Vec<u8>> {
ecstore_config::com::read_config_no_lock(api, file).await
ecstore_read_config_no_lock(api, file).await
}
pub(crate) async fn read_iam_config_with_metadata(
@@ -59,11 +69,11 @@ pub(crate) async fn read_iam_config_with_metadata(
file: &str,
opts: &IamConfigObjectOptions,
) -> IamStorageResult<(Vec<u8>, IamConfigObjectInfo)> {
ecstore_config::com::read_config_with_metadata(api, file, opts).await
ecstore_read_config_with_metadata(api, file, opts).await
}
pub(crate) async fn save_iam_config(api: Arc<IamStore>, file: &str, data: Vec<u8>) -> IamStorageResult<()> {
ecstore_config::com::save_config(api, file, data).await
ecstore_save_config(api, file, data).await
}
pub(crate) async fn save_iam_config_with_opts(
@@ -72,33 +82,33 @@ pub(crate) async fn save_iam_config_with_opts(
data: Vec<u8>,
opts: &IamConfigObjectOptions,
) -> IamStorageResult<()> {
ecstore_config::com::save_config_with_opts(api, file, data, opts).await
ecstore_save_config_with_opts(api, file, data, opts).await
}
pub(crate) async fn delete_iam_config(api: Arc<IamStore>, file: &str) -> IamStorageResult<()> {
ecstore_config::com::delete_config(api, file).await
ecstore_delete_config(api, file).await
}
pub(crate) fn classify_iam_system_path_failure_reason(err: &IamEcstoreError) -> &'static str {
ecstore_error::classify_system_path_failure_reason(err)
ecstore_classify_system_path_failure_reason(err)
}
pub(crate) async fn is_iam_first_cluster_node_local() -> bool {
ecstore_global::is_first_cluster_node_local().await
ecstore_is_first_cluster_node_local().await
}
pub(crate) struct IamNotificationPeerErr {
pub(crate) err: Option<IamEcstoreError>,
}
impl From<ecstore_notification::NotificationPeerErr> for IamNotificationPeerErr {
fn from(value: ecstore_notification::NotificationPeerErr) -> Self {
impl From<EcstoreNotificationPeerErr> for IamNotificationPeerErr {
fn from(value: EcstoreNotificationPeerErr) -> Self {
Self { err: value.err }
}
}
pub(crate) async fn notify_iam_delete_policy(policy_name: &str) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.delete_policy(policy_name)
.await
@@ -110,7 +120,7 @@ pub(crate) async fn notify_iam_delete_policy(policy_name: &str) -> Vec<IamNotifi
}
pub(crate) async fn notify_iam_load_policy(policy_name: &str) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_policy(policy_name)
.await
@@ -122,7 +132,7 @@ pub(crate) async fn notify_iam_load_policy(policy_name: &str) -> Vec<IamNotifica
}
pub(crate) async fn notify_iam_delete_user(access_key: &str) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.delete_user(access_key)
.await
@@ -134,7 +144,7 @@ pub(crate) async fn notify_iam_delete_user(access_key: &str) -> Vec<IamNotificat
}
pub(crate) async fn notify_iam_load_user(access_key: &str, temp: bool) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_user(access_key, temp)
.await
@@ -146,7 +156,7 @@ pub(crate) async fn notify_iam_load_user(access_key: &str, temp: bool) -> Vec<Ia
}
pub(crate) async fn notify_iam_load_service_account(access_key: &str) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_service_account(access_key)
.await
@@ -158,7 +168,7 @@ pub(crate) async fn notify_iam_load_service_account(access_key: &str) -> Vec<Iam
}
pub(crate) async fn notify_iam_delete_service_account(access_key: &str) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.delete_service_account(access_key)
.await
@@ -170,7 +180,7 @@ pub(crate) async fn notify_iam_delete_service_account(access_key: &str) -> Vec<I
}
pub(crate) async fn notify_iam_load_group(group: &str) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys.load_group(group).await.into_iter().map(Into::into).collect(),
None => Vec::new(),
}
@@ -181,7 +191,7 @@ pub(crate) async fn notify_iam_load_policy_mapping(
user_type: u64,
is_group: bool,
) -> Vec<IamNotificationPeerErr> {
match ecstore_notification::get_global_notification_sys() {
match ecstore_get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_policy_mapping(user_or_group, user_type, is_group)
.await