mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 04:16:38 +00:00
refactor: remove ecstore operation compat facades (#3608)
This commit is contained in:
@@ -16,12 +16,25 @@ use rustfs_common::heal_channel::HealOpts;
|
||||
use rustfs_ecstore::{
|
||||
disk::DiskStore,
|
||||
error::Error,
|
||||
object_api::{GetObjectReader, ObjectInfo, ObjectOptions, PutObjReader},
|
||||
store::ECStore,
|
||||
store_api::{HealOperations, NamespaceLocking},
|
||||
};
|
||||
use rustfs_filemeta::FileInfo;
|
||||
use rustfs_lock::NamespaceLockWrapper;
|
||||
use rustfs_madmin::heal_commands::HealResultItem;
|
||||
use rustfs_storage_api::{HealOperations as StorageHealOperations, NamespaceLocking as StorageNamespaceLocking, StorageAdminApi};
|
||||
use rustfs_storage_api::{
|
||||
CompletePart, DeletedObject, HTTPRangeSpec, HealOperations as StorageHealOperations, ListMultipartsInfo,
|
||||
ListObjectVersionsInfo as StorageListObjectVersionsInfo, ListObjectsV2Info as StorageListObjectsV2Info, ListPartsInfo,
|
||||
MultipartInfo, MultipartOperations as StorageMultipartOperations, MultipartUploadResult,
|
||||
NamespaceLocking as StorageNamespaceLocking, ObjectIO as StorageObjectIO, ObjectInfoOrErr as StorageObjectInfoOrErr,
|
||||
ObjectOperations as StorageObjectOperations, ObjectToDelete, PartInfo, StorageAdminApi, WalkOptions as StorageWalkOptions,
|
||||
};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
type ListObjectsV2Info = StorageListObjectsV2Info<ObjectInfo>;
|
||||
type ListObjectVersionsInfo = StorageListObjectVersionsInfo<ObjectInfo>;
|
||||
type ObjectInfoOrErr = StorageObjectInfoOrErr<ObjectInfo, Error>;
|
||||
type WalkOptions = StorageWalkOptions<fn(&FileInfo) -> bool>;
|
||||
|
||||
fn storage_admin_api_type_name<T>() -> &'static str
|
||||
where
|
||||
@@ -35,20 +48,6 @@ where
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn namespace_locking_type_name<T>() -> &'static str
|
||||
where
|
||||
T: NamespaceLocking,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn heal_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: HealOperations,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_namespace_locking_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageNamespaceLocking<Error = Error, NamespaceLock = NamespaceLockWrapper>,
|
||||
@@ -56,6 +55,68 @@ where
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_object_io_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageObjectIO<
|
||||
Error = Error,
|
||||
RangeSpec = HTTPRangeSpec,
|
||||
HeaderMap = http::HeaderMap,
|
||||
ObjectOptions = ObjectOptions,
|
||||
ObjectInfo = ObjectInfo,
|
||||
GetObjectReader = GetObjectReader,
|
||||
PutObjectReader = PutObjReader,
|
||||
>,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_object_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageObjectOperations<
|
||||
Error = Error,
|
||||
ObjectInfo = ObjectInfo,
|
||||
ObjectOptions = ObjectOptions,
|
||||
FileInfo = FileInfo,
|
||||
ObjectToDelete = ObjectToDelete,
|
||||
DeletedObject = DeletedObject,
|
||||
>,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_list_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: rustfs_storage_api::ListOperations<
|
||||
Error = Error,
|
||||
ListObjectsV2Info = ListObjectsV2Info,
|
||||
ListObjectVersionsInfo = ListObjectVersionsInfo,
|
||||
ObjectInfoOrErr = ObjectInfoOrErr,
|
||||
WalkOptions = WalkOptions,
|
||||
WalkCancellation = CancellationToken,
|
||||
WalkResultSender = tokio::sync::mpsc::Sender<ObjectInfoOrErr>,
|
||||
>,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_multipart_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageMultipartOperations<
|
||||
Error = Error,
|
||||
ObjectInfo = ObjectInfo,
|
||||
ObjectOptions = ObjectOptions,
|
||||
PutObjectReader = PutObjReader,
|
||||
CompletePart = CompletePart,
|
||||
ListMultipartsInfo = ListMultipartsInfo,
|
||||
MultipartUploadResult = MultipartUploadResult,
|
||||
PartInfo = PartInfo,
|
||||
MultipartInfo = MultipartInfo,
|
||||
ListPartsInfo = ListPartsInfo,
|
||||
>,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_heal_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageHealOperations<Error = Error, HealResultItem = HealResultItem, HealOptions = HealOpts>,
|
||||
@@ -68,21 +129,31 @@ fn ecstore_implements_storage_admin_api_contract() {
|
||||
assert!(storage_admin_api_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_namespace_locking_contract() {
|
||||
assert!(namespace_locking_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_heal_operations_contract() {
|
||||
assert!(heal_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_namespace_locking_contract() {
|
||||
assert!(storage_namespace_locking_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_object_io_contract() {
|
||||
assert!(storage_object_io_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_object_operations_contract() {
|
||||
assert!(storage_object_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_list_operations_contract() {
|
||||
assert!(storage_list_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_multipart_operations_contract() {
|
||||
assert!(storage_multipart_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_heal_operations_contract() {
|
||||
assert!(storage_heal_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
|
||||
@@ -8,7 +8,7 @@ use rustfs_ecstore::bitrot::create_bitrot_reader;
|
||||
use rustfs_ecstore::disk::endpoint::Endpoint;
|
||||
use rustfs_ecstore::disk::{DiskAPI as _, DiskOption, new_disk};
|
||||
use rustfs_ecstore::erasure_coding::Erasure;
|
||||
use rustfs_ecstore::store_api::{GetObjectReader, ObjectInfo, ObjectOptions};
|
||||
use rustfs_ecstore::object_api::{GetObjectReader, ObjectInfo, ObjectOptions};
|
||||
use rustfs_filemeta::{FileInfo, FileInfoOpts, get_file_info};
|
||||
use serde::Deserialize;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
Reference in New Issue
Block a user