mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
test(ecstore): cover SetDisks storage contracts (#4033)
This commit is contained in:
@@ -20,10 +20,10 @@ use rustfs_lock::NamespaceLockWrapper;
|
||||
use rustfs_madmin::heal_commands::HealResultItem;
|
||||
use storage_api::contract_compat::{
|
||||
CompletePart, DeletedObject, DiskStore, ECStore, Error, GetObjectReader, HTTPRangeSpec, ListMultipartsInfo, ListPartsInfo,
|
||||
MultipartInfo, MultipartUploadResult, ObjectInfo, ObjectOptions, ObjectToDelete, PartInfo, PutObjReader, StorageAdminApi,
|
||||
StorageHealOperations, StorageListObjectVersionsInfo, StorageListObjectsV2Info, StorageListOperations,
|
||||
StorageMultipartOperations, StorageNamespaceLocking, StorageObjectIO, StorageObjectInfoOrErr, StorageObjectOperations,
|
||||
StorageWalkOptions,
|
||||
MultipartInfo, MultipartUploadResult, ObjectInfo, ObjectOptions, ObjectToDelete, PartInfo, PutObjReader, SetDisks,
|
||||
StorageAdminApi, StorageBucketOperations, StorageHealOperations, StorageListObjectVersionsInfo, StorageListObjectsV2Info,
|
||||
StorageListOperations, StorageMultipartOperations, StorageNamespaceLocking, StorageObjectIO, StorageObjectInfoOrErr,
|
||||
StorageObjectOperations, StorageWalkOptions,
|
||||
};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
@@ -66,6 +66,13 @@ where
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_bucket_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageBucketOperations<Error = Error>,
|
||||
{
|
||||
std::any::type_name::<T>()
|
||||
}
|
||||
|
||||
fn storage_object_operations_type_name<T>() -> &'static str
|
||||
where
|
||||
T: StorageObjectOperations<
|
||||
@@ -135,6 +142,11 @@ fn ecstore_implements_storage_object_io_contract() {
|
||||
assert!(storage_object_io_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_bucket_operations_contract() {
|
||||
assert!(storage_bucket_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecstore_implements_storage_object_operations_contract() {
|
||||
assert!(storage_object_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
@@ -154,3 +166,38 @@ fn ecstore_implements_storage_multipart_operations_contract() {
|
||||
fn ecstore_implements_storage_heal_operations_contract() {
|
||||
assert!(storage_heal_operations_type_name::<ECStore>().ends_with("::ECStore"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_namespace_locking_contract() {
|
||||
assert!(storage_namespace_locking_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_object_io_contract() {
|
||||
assert!(storage_object_io_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_bucket_operations_contract() {
|
||||
assert!(storage_bucket_operations_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_object_operations_contract() {
|
||||
assert!(storage_object_operations_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_list_operations_contract() {
|
||||
assert!(storage_list_operations_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_multipart_operations_contract() {
|
||||
assert!(storage_multipart_operations_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_disks_implements_storage_heal_operations_contract() {
|
||||
assert!(storage_heal_operations_type_name::<SetDisks>().ends_with("::SetDisks"));
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@ pub(crate) use rustfs_ecstore::api::bitrot::create_bitrot_reader;
|
||||
pub(crate) use rustfs_ecstore::api::disk::{DiskAPI, DiskOption, DiskStore, STORAGE_FORMAT_FILE, endpoint::Endpoint, new_disk};
|
||||
pub(crate) use rustfs_ecstore::api::erasure::Erasure;
|
||||
pub(crate) use rustfs_ecstore::api::object::{GetObjectReader, ObjectInfo, ObjectOptions, PutObjReader};
|
||||
pub(crate) use rustfs_ecstore::api::{error::Error, storage::ECStore};
|
||||
pub(crate) use rustfs_ecstore::api::{error::Error, set_disk::SetDisks, storage::ECStore};
|
||||
use rustfs_storage_api as storage_contracts;
|
||||
|
||||
pub(crate) mod contract_compat {
|
||||
pub(crate) use super::storage_contracts::{
|
||||
CompletePart, DeletedObject, HTTPRangeSpec, HealOperations as StorageHealOperations, ListMultipartsInfo,
|
||||
ListObjectVersionsInfo as StorageListObjectVersionsInfo, ListObjectsV2Info as StorageListObjectsV2Info,
|
||||
ListOperations as StorageListOperations, ListPartsInfo, MultipartInfo, MultipartOperations as StorageMultipartOperations,
|
||||
MultipartUploadResult, NamespaceLocking as StorageNamespaceLocking, ObjectIO as StorageObjectIO,
|
||||
ObjectInfoOrErr as StorageObjectInfoOrErr, ObjectOperations as StorageObjectOperations, ObjectToDelete, PartInfo,
|
||||
StorageAdminApi, WalkOptions as StorageWalkOptions,
|
||||
BucketOperations as StorageBucketOperations, CompletePart, DeletedObject, HTTPRangeSpec,
|
||||
HealOperations as StorageHealOperations, ListMultipartsInfo, ListObjectVersionsInfo as StorageListObjectVersionsInfo,
|
||||
ListObjectsV2Info as StorageListObjectsV2Info, ListOperations as StorageListOperations, ListPartsInfo, MultipartInfo,
|
||||
MultipartOperations as StorageMultipartOperations, MultipartUploadResult, NamespaceLocking as StorageNamespaceLocking,
|
||||
ObjectIO as StorageObjectIO, ObjectInfoOrErr as StorageObjectInfoOrErr, ObjectOperations as StorageObjectOperations,
|
||||
ObjectToDelete, PartInfo, StorageAdminApi, WalkOptions as StorageWalkOptions,
|
||||
};
|
||||
|
||||
pub(crate) use super::{DiskStore, ECStore, Error, GetObjectReader, ObjectInfo, ObjectOptions, PutObjReader};
|
||||
pub(crate) use super::{DiskStore, ECStore, Error, GetObjectReader, ObjectInfo, ObjectOptions, PutObjReader, SetDisks};
|
||||
}
|
||||
|
||||
pub(crate) mod legacy_bitrot_read {
|
||||
|
||||
@@ -42,6 +42,10 @@ local boundary or storage-api contract first, then route consumers through it.
|
||||
| Replication | Bucket target and metadata systems, bucket target client config, disk, object API, runtime sources, notification, and SetDisks lock timing. | `ReplicationStorage`, `ReplicationMetadataStore`, `ReplicationRuntime`, `ReplicationEventSink`, and `ReplicationLifecycleBridge`. |
|
||||
| SetDisks | Shared disks, endpoints, format state, namespace locks, cache, and implementations for object IO, namespace locking, bucket, object, list, multipart, and heal operations. | Pure shard source, disk error, bitrot IO, namespace lock, metrics label, and file metadata contracts before any operation family moves. |
|
||||
|
||||
`crates/ecstore/tests/ecstore_contract_compat_test.rs` keeps compile-time
|
||||
coverage for `ECStore` and `SetDisks` storage-api trait compatibility before
|
||||
any facade shrink or operation-family movement.
|
||||
|
||||
## Shrink Rules
|
||||
|
||||
1. Do not remove a facade item until its downstream boundary has compile-time
|
||||
|
||||
Reference in New Issue
Block a user