refactor: remove storage api facade (#3490)

This commit is contained in:
安正超
2026-06-16 07:46:32 +08:00
committed by GitHub
parent c26593fa7a
commit 0baf90ee88
9 changed files with 60 additions and 116 deletions
-1
View File
@@ -60,7 +60,6 @@ pub use global::{get_global_lock_client, get_global_lock_clients, set_global_loc
pub use global::{new_object_layer_fn, resolve_object_store_handle, set_object_store_resolver};
pub use global::GLOBAL_Endpoints;
pub use store_api::StorageAPI;
#[cfg(test)]
mod rio_tests {
+1 -4
View File
@@ -55,7 +55,7 @@ use crate::{
BucketInfo, BucketOperations, BucketOptions, CompletePart, DeleteBucketOptions, DeletedObject, GetObjectReader,
HTTPRangeSpec, HealOperations, ListMultipartsInfo, ListObjectsV2Info, ListOperations, MakeBucketOptions, MultipartInfo,
MultipartOperations, MultipartUploadResult, NamespaceLocking, ObjectIO, ObjectInfo, ObjectOperations, PartInfo,
PutObjReader, StorageAPI,
PutObjReader,
},
store_init::load_format_erasure,
};
@@ -1633,9 +1633,6 @@ impl SetDisks {
}
}
#[async_trait::async_trait]
impl StorageAPI for SetDisks {}
#[async_trait::async_trait]
impl NamespaceLocking for SetDisks {
#[tracing::instrument(skip(self))]
+1 -4
View File
@@ -31,7 +31,7 @@ use crate::{
BucketInfo, BucketOperations, BucketOptions, CompletePart, DeleteBucketOptions, DeletedObject, GetObjectReader,
HTTPRangeSpec, HealOperations, ListMultipartsInfo, ListObjectVersionsInfo, ListObjectsV2Info, ListOperations,
MakeBucketOptions, MultipartInfo, MultipartOperations, MultipartUploadResult, NamespaceLocking, ObjectIO, ObjectInfo,
ObjectOperations, ObjectOptions, ObjectToDelete, PartInfo, PutObjReader, StorageAPI,
ObjectOperations, ObjectOptions, ObjectToDelete, PartInfo, PutObjReader,
},
store_init::{check_format_erasure_values, get_format_erasure_in_quorum, load_format_erasure_all, save_format_file},
};
@@ -896,9 +896,6 @@ impl HealOperations for Sets {
}
}
#[async_trait::async_trait]
impl StorageAPI for Sets {}
#[async_trait::async_trait]
impl NamespaceLocking for Sets {
async fn new_ns_lock(&self, bucket: &str, object: &str) -> Result<NamespaceLockWrapper> {
+1 -4
View File
@@ -68,7 +68,7 @@ use crate::{
BucketInfo, BucketOperations, BucketOptions, CompletePart, DeleteBucketOptions, DeletedObject, GetObjectReader,
HTTPRangeSpec, HealOperations, ListObjectsV2Info, ListOperations, MakeBucketOptions, MultipartOperations,
MultipartUploadResult, NamespaceLocking, ObjectInfo, ObjectOperations, ObjectOptions, ObjectToDelete, PartInfo,
PutObjReader, StorageAPI,
PutObjReader,
},
store_init,
};
@@ -703,9 +703,6 @@ impl HealOperations for ECStore {
}
}
#[async_trait::async_trait]
impl StorageAPI for ECStore {}
#[async_trait::async_trait]
impl NamespaceLocking for ECStore {
async fn new_ns_lock(&self, bucket: &str, object: &str) -> Result<NamespaceLockWrapper> {
-10
View File
@@ -178,13 +178,3 @@ pub trait HealOperations: Send + Sync + Debug {
pub trait NamespaceLocking: Send + Sync + Debug + 'static {
async fn new_ns_lock(&self, bucket: &str, object: &str) -> Result<NamespaceLockWrapper>;
}
/// Unified storage API combining all operation groups.
///
/// Consumers can depend on specific sub-traits (e.g., `BucketOperations`)
/// when they don't need the full API surface.
#[allow(clippy::too_many_arguments)]
pub trait StorageAPI:
ObjectIO + BucketOperations + ObjectOperations + ListOperations + MultipartOperations + HealOperations + Debug
{
}
@@ -12,12 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::{
disk::DiskStore,
error::Error,
store::ECStore,
store_api::{NamespaceLocking, StorageAPI},
};
use rustfs_ecstore::{disk::DiskStore, error::Error, store::ECStore, store_api::NamespaceLocking};
use rustfs_storage_api::StorageAdminApi;
fn storage_admin_api_type_name<T>() -> &'static str
@@ -32,9 +27,9 @@ where
std::any::type_name::<T>()
}
fn storage_api_with_namespace_locking_type_name<T>() -> &'static str
fn namespace_locking_type_name<T>() -> &'static str
where
T: StorageAPI + NamespaceLocking,
T: NamespaceLocking,
{
std::any::type_name::<T>()
}
@@ -45,6 +40,6 @@ fn ecstore_implements_storage_admin_api_contract() {
}
#[test]
fn ecstore_implements_storage_api_and_namespace_locking_contracts() {
assert!(storage_api_with_namespace_locking_type_name::<ECStore>().ends_with("::ECStore"));
fn ecstore_implements_namespace_locking_contract() {
assert!(namespace_locking_type_name::<ECStore>().ends_with("::ECStore"));
}