refactor: segment RustFS storage API root exports (#3909)

This commit is contained in:
Zhengchao An
2026-06-26 17:15:33 +08:00
committed by GitHub
parent 72ae43cb90
commit 72a589f0c0
13 changed files with 201 additions and 133 deletions
+10 -16
View File
@@ -15,6 +15,8 @@
use std::ops::Deref;
use std::sync::Arc;
use rustfs_storage_api as storage_contracts;
mod ecstore_bucket {
pub(crate) use crate::storage::ecstore_bucket::{
bandwidth, bucket_target_sys, lifecycle, metadata, metadata_sys, quota, replication, target, utils, versioning,
@@ -408,17 +410,6 @@ pub(crate) static ERR_TIER_NAME_NOT_UPPERCASE: AdminErrorRef =
AdminErrorRef(|| &ecstore_tier::tier_handlers::ERR_TIER_NAME_NOT_UPPERCASE);
pub(crate) static ERR_TIER_NOT_FOUND: AdminErrorRef = AdminErrorRef(|| &ecstore_tier::tier_handlers::ERR_TIER_NOT_FOUND);
pub(crate) use crate::storage::StorageObjectOptions;
pub(crate) use crate::storage::access::{ReqInfo, authorize_request};
pub(crate) use crate::storage::request_context::{RequestContext, spawn_traced};
pub(crate) use rustfs_storage_api::{
BucketOperations, BucketOptions, CapabilitySnapshotError, CapabilityState, CapabilityStatus, DeleteBucketOptions,
HealOperations, ListOperations, MakeBucketOptions, ObjectIO, ObjectOperations, ObservabilitySnapshot,
ObservabilitySnapshotProvider, SRBucketDeleteOp, StorageAdminApi, TopologySnapshot, TopologySnapshotProvider,
};
#[cfg(test)]
pub(crate) use rustfs_storage_api::{MemorySamplingState, PlatformSupport, TopologyCapabilities, UserspaceProfilingCapability};
pub(crate) mod data_usage {
use std::sync::Arc;
@@ -430,7 +421,8 @@ pub(crate) mod data_usage {
}
pub(crate) mod access {
pub(crate) use super::{ReqInfo, RequestContext, authorize_request, spawn_traced};
pub(crate) use crate::storage::access::{ReqInfo, authorize_request};
pub(crate) use crate::storage::request_context::{RequestContext, spawn_traced};
}
pub(crate) mod bucket {
@@ -457,13 +449,15 @@ pub(crate) mod cluster {
ClusterMembershipSnapshot, ClusterNodeMembership, ClusterPeerHealth, ClusterPeerHealthSnapshot, ClusterPoolState,
ClusterPoolStateSnapshot,
};
pub(crate) use super::{
pub(crate) use super::storage_contracts::{
CapabilitySnapshotError, CapabilityState, CapabilityStatus, ObservabilitySnapshot, ObservabilitySnapshotProvider,
TopologySnapshot, TopologySnapshotProvider,
};
#[cfg(test)]
pub(crate) use super::{MemorySamplingState, PlatformSupport, TopologyCapabilities, UserspaceProfilingCapability};
pub(crate) use super::storage_contracts::{
MemorySamplingState, PlatformSupport, TopologyCapabilities, UserspaceProfilingCapability,
};
}
pub(crate) mod config {
@@ -475,7 +469,7 @@ pub(crate) mod config {
}
pub(crate) mod contract {
pub(crate) use super::{
pub(crate) use super::storage_contracts::{
BucketOperations, BucketOptions, DeleteBucketOptions, HealOperations, ListOperations, MakeBucketOptions, ObjectIO,
ObjectOperations, SRBucketDeleteOp, StorageAdminApi,
};
@@ -490,7 +484,7 @@ pub(crate) mod metrics {
}
pub(crate) mod object {
pub(crate) use super::StorageObjectOptions;
pub(crate) use crate::storage::StorageObjectOptions;
}
pub(crate) mod rebalance {
+53 -60
View File
@@ -14,15 +14,11 @@
//! App-local boundary for storage-layer helper APIs used by S3 use cases.
pub(crate) use crate::storage::ECStore;
#[cfg(test)]
pub(crate) use crate::storage::{Endpoint, Endpoints, PoolEndpoints};
pub(crate) use rustfs_storage_api::{ObjectToDelete, TransitionedObject};
pub(crate) type EndpointServerPools = crate::storage::EndpointServerPools;
use rustfs_storage_api as storage_contracts;
#[cfg(test)]
#[allow(non_snake_case)]
pub(crate) fn EndpointServerPools(pools: Vec<PoolEndpoints>) -> EndpointServerPools {
pub(crate) fn EndpointServerPools(pools: Vec<crate::storage::PoolEndpoints>) -> crate::storage::EndpointServerPools {
crate::storage::EndpointServerPools::from(pools)
}
@@ -54,7 +50,7 @@ pub(crate) mod data_usage {
}
pub(crate) async fn load_data_usage_from_backend(
store: Arc<super::ECStore>,
store: Arc<crate::storage::ECStore>,
) -> Result<rustfs_data_usage::DataUsageInfo, crate::storage::StorageError> {
crate::storage::ecstore_data_usage::load_data_usage_from_backend(store).await
}
@@ -69,7 +65,7 @@ pub(crate) mod data_usage {
}
pub(crate) async fn remove_bucket_usage_from_backend(
store: Arc<super::ECStore>,
store: Arc<crate::storage::ECStore>,
bucket: &str,
) -> Result<(), crate::storage::StorageError> {
crate::storage::ecstore_data_usage::remove_bucket_usage_from_backend(store, bucket).await
@@ -103,7 +99,7 @@ pub(crate) mod runtime {
crate::storage::ecstore_config::set_global_storage_class(cfg);
}
pub(crate) fn get_global_endpoints_opt() -> Option<super::EndpointServerPools> {
pub(crate) fn get_global_endpoints_opt() -> Option<crate::storage::EndpointServerPools> {
crate::storage::get_global_endpoints_opt()
}
@@ -135,7 +131,7 @@ pub(crate) mod runtime {
crate::storage::get_global_expiry_state()
}
pub(crate) fn new_object_layer_fn() -> Option<Arc<super::ECStore>> {
pub(crate) fn new_object_layer_fn() -> Option<Arc<crate::storage::ECStore>> {
crate::storage::new_object_layer_fn()
}
@@ -172,7 +168,9 @@ pub(crate) mod runtime {
}
#[cfg(test)]
pub(crate) async fn init_local_disks(endpoint_pools: super::EndpointServerPools) -> Result<(), crate::storage::StorageError> {
pub(crate) async fn init_local_disks(
endpoint_pools: crate::storage::EndpointServerPools,
) -> Result<(), crate::storage::StorageError> {
crate::storage::init_local_disks(endpoint_pools).await
}
}
@@ -348,7 +346,7 @@ pub(crate) mod bucket {
version_id: Option<uuid::Uuid>,
versioned: bool,
suspended: bool,
transitioned: &crate::app::storage_api::TransitionedObject,
transitioned: &super::super::super::storage_contracts::TransitionedObject,
) -> Option<Jentry> {
crate::storage::ecstore_bucket::lifecycle::tier_sweeper::transitioned_delete_journal_entry(
version_id,
@@ -359,7 +357,7 @@ pub(crate) mod bucket {
}
pub(crate) fn transitioned_force_delete_journal_entry(
transitioned: &crate::app::storage_api::TransitionedObject,
transitioned: &super::super::super::storage_contracts::TransitionedObject,
) -> Option<Jentry> {
crate::storage::ecstore_bucket::lifecycle::tier_sweeper::transitioned_force_delete_journal_entry(transitioned)
}
@@ -544,7 +542,7 @@ pub(crate) mod bucket {
pub(crate) async fn check_replicate_delete(
bucket: &str,
dobj: &crate::app::storage_api::ObjectToDelete,
dobj: &super::super::storage_contracts::ObjectToDelete,
oi: &crate::storage::StorageObjectInfo,
del_opts: &crate::storage::StorageObjectOptions,
gerr: Option<String>,
@@ -721,83 +719,78 @@ pub(crate) mod s3_api {
}
}
pub(crate) use crate::storage::{
RFC1123, StorageDeletedObject, StorageObjectInfo, StorageObjectOptions, StorageObjectToDelete, StoragePutObjReader,
check_preconditions, get_validated_store, has_replication_rules, parse_object_lock_legal_hold, parse_object_lock_retention,
parse_part_number_i32_to_usize, process_lambda_configurations, process_queue_configurations, process_topic_configurations,
remove_object_lock_metadata_for_copy, strip_managed_encryption_metadata, validate_bucket_object_lock_enabled,
validate_list_object_unordered_with_delimiter, validate_object_key, validate_sse_headers_for_read,
validate_sse_headers_for_write, validate_ssec_for_read, wrap_response_with_cors,
};
pub(crate) use rustfs_storage_api::{
BucketOperations, BucketOptions, CompletePart, DeleteBucketOptions, HTTPRangeSpec, ListObjectVersionsInfo, ListObjectsV2Info,
ListOperations, MakeBucketOptions, MultipartOperations, MultipartUploadResult, NamespaceLocking, ObjectIO, ObjectOperations,
StorageAdminApi,
};
#[cfg(test)]
pub(crate) use rustfs_storage_api::{HTTPPreconditions, HealOperations};
pub(crate) mod admin_usecase {
pub(crate) use super::{ECStore, EndpointServerPools, StorageAdminApi};
pub(crate) use super::storage_contracts::StorageAdminApi;
pub(crate) use super::{admin, capacity, data_usage};
pub(crate) use crate::storage::{ECStore, EndpointServerPools};
}
pub(crate) mod bucket_usecase {
pub(crate) use super::{
BucketOperations, BucketOptions, DeleteBucketOptions, ECStore, ListObjectVersionsInfo, ListObjectsV2Info, ListOperations,
MakeBucketOptions, StorageObjectInfo, get_validated_store, process_lambda_configurations, process_queue_configurations,
process_topic_configurations, validate_list_object_unordered_with_delimiter,
pub(crate) use super::storage_contracts::{
BucketOperations, BucketOptions, DeleteBucketOptions, ListObjectVersionsInfo, ListObjectsV2Info, ListOperations,
MakeBucketOptions,
};
pub(crate) use super::{access, bucket, data_usage, error, helper, object_utils, request_context, s3_api};
pub(crate) use crate::storage::{
ECStore, StorageObjectInfo, get_validated_store, process_lambda_configurations, process_queue_configurations,
process_topic_configurations, validate_list_object_unordered_with_delimiter,
};
}
pub(crate) mod object_usecase {
#[cfg(test)]
pub(crate) use super::HTTPPreconditions;
pub(crate) use super::storage_contracts::HTTPPreconditions;
pub(crate) use super::storage_contracts::{HTTPRangeSpec, NamespaceLocking, ObjectIO, ObjectOperations};
pub(crate) use super::{
ECStore, HTTPRangeSpec, NamespaceLocking, ObjectIO, ObjectOperations, RFC1123, StorageDeletedObject, StorageObjectInfo,
StorageObjectOptions, StorageObjectToDelete, StoragePutObjReader, bucket, check_preconditions, get_validated_store,
has_replication_rules, parse_object_lock_legal_hold, parse_object_lock_retention, parse_part_number_i32_to_usize,
remove_object_lock_metadata_for_copy, strip_managed_encryption_metadata, validate_bucket_object_lock_enabled,
validate_object_key, validate_sse_headers_for_read, validate_sse_headers_for_write, validate_ssec_for_read,
wrap_response_with_cors,
access, bucket, compression, concurrency, data_usage, deadlock_detector, ecfs, error, head_prefix, helper, io,
object_utils, options, request_context, s3_api, set_disk, sse, storage_class, timeout_wrapper,
};
pub(crate) use super::{
access, compression, concurrency, data_usage, deadlock_detector, ecfs, error, head_prefix, helper, io, object_utils,
options, request_context, s3_api, set_disk, sse, storage_class, timeout_wrapper,
pub(crate) use crate::storage::{
ECStore, RFC1123, StorageDeletedObject, StorageObjectInfo, StorageObjectOptions, StorageObjectToDelete,
StoragePutObjReader, check_preconditions, get_validated_store, has_replication_rules, parse_object_lock_legal_hold,
parse_object_lock_retention, parse_part_number_i32_to_usize, remove_object_lock_metadata_for_copy,
strip_managed_encryption_metadata, validate_bucket_object_lock_enabled, validate_object_key,
validate_sse_headers_for_read, validate_sse_headers_for_write, validate_ssec_for_read, wrap_response_with_cors,
};
}
pub(crate) mod multipart_usecase {
#[cfg(test)]
pub(crate) use super::HTTPPreconditions;
pub(crate) use super::{
CompletePart, ECStore, HTTPRangeSpec, MultipartOperations, MultipartUploadResult, ObjectIO, ObjectOperations,
StorageObjectOptions, StoragePutObjReader, access, bucket, compression, data_usage, error, helper, io, object_utils,
options, s3_api, set_disk, sse,
pub(crate) use super::storage_contracts::HTTPPreconditions;
pub(crate) use super::storage_contracts::{
CompletePart, HTTPRangeSpec, MultipartOperations, MultipartUploadResult, ObjectIO, ObjectOperations,
};
pub(crate) use super::{
access, bucket, compression, data_usage, error, helper, io, object_utils, options, s3_api, set_disk, sse,
};
pub(crate) use crate::storage::{ECStore, StorageObjectOptions, StoragePutObjReader};
}
pub(crate) mod select_object {
pub(crate) use super::ObjectOperations;
pub(crate) use super::get_validated_store;
pub(crate) use super::storage_contracts::ObjectOperations;
pub(crate) use super::{options, request_context};
pub(crate) use super::{validate_sse_headers_for_read, validate_ssec_for_read};
pub(crate) use crate::storage::{get_validated_store, validate_sse_headers_for_read, validate_ssec_for_read};
}
pub(crate) mod context {
pub(crate) use super::bucket;
pub(crate) use super::{ECStore, EndpointServerPools, runtime};
#[cfg(test)]
pub(crate) use super::{Endpoint, Endpoints, PoolEndpoints};
pub(crate) use super::EndpointServerPools;
pub(crate) use super::bucket;
pub(crate) use super::runtime;
pub(crate) use crate::storage::{ECStore, EndpointServerPools};
#[cfg(test)]
pub(crate) use crate::storage::{Endpoint, Endpoints, PoolEndpoints};
}
#[cfg(test)]
pub(crate) mod test {
pub(crate) use super::{
BucketOperations, BucketOptions, ECStore, Endpoint, EndpointServerPools, Endpoints, HealOperations, ListOperations,
MakeBucketOptions, MultipartOperations, ObjectIO, ObjectOperations, PoolEndpoints, StorageObjectInfo,
StorageObjectOptions, StoragePutObjReader,
pub(crate) use super::EndpointServerPools;
pub(crate) use super::storage_contracts::{
BucketOperations, BucketOptions, HealOperations, ListOperations, MakeBucketOptions, MultipartOperations, ObjectIO,
ObjectOperations,
};
pub(crate) use super::{bucket, ecfs, object_utils, runtime};
pub(crate) use crate::storage::{
ECStore, Endpoint, Endpoints, PoolEndpoints, StorageObjectInfo, StorageObjectOptions, StoragePutObjReader,
};
}
+1 -1
View File
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::BucketOperations;
use super::ECStore;
use super::ecfs::FS;
use super::resolve_object_store_handle;
@@ -23,6 +22,7 @@ use crate::auth::{check_key_valid, get_condition_values_with_query_and_client_in
use crate::error::ApiError;
use crate::license::license_check;
use crate::server::RemoteAddr;
use crate::storage::contract::BucketOperations;
use crate::storage::request_context::RequestContext;
use crate::storage::runtime_sources;
use metrics::counter;
+3 -3
View File
@@ -14,9 +14,8 @@
use super::{
BUCKET_ACCELERATE_CONFIG, BUCKET_LOGGING_CONFIG, BUCKET_REQUEST_PAYMENT_CONFIG, BUCKET_VERSIONING_CONFIG,
BUCKET_WEBSITE_CONFIG, BucketOperations, BucketOptions, BucketVersioningSys, OBJECT_LOCK_CONFIG, ObjectLockRetentionOptions,
ObjectOperations as _, StorageError, check_retention_for_modification, decode_tags, decode_tags_to_map,
delete_bucket_metadata_config, encode_tags, get_bucket_accelerate_config, get_bucket_logging_config,
BUCKET_WEBSITE_CONFIG, BucketVersioningSys, OBJECT_LOCK_CONFIG, StorageError, check_retention_for_modification, decode_tags,
decode_tags_to_map, delete_bucket_metadata_config, encode_tags, get_bucket_accelerate_config, get_bucket_logging_config,
get_bucket_object_lock_config, get_bucket_replication_config, get_bucket_request_payment_config, get_bucket_website_config,
is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found, record_replication_proxy, serialize,
update_bucket_metadata_config,
@@ -24,6 +23,7 @@ use super::{
use super::{StorageReplicationConfigExt as _, StorageVersioningConfigExt as _};
use crate::error::ApiError;
use crate::storage::access::has_bypass_governance_header;
use crate::storage::contract::{BucketOperations, BucketOptions, ObjectLockRetentionOptions, ObjectOperations as _};
use crate::storage::helper::OperationHelper;
use crate::storage::options::get_opts;
use crate::storage::runtime_sources;
+4 -3
View File
@@ -14,12 +14,13 @@
use super::StorageReplicationConfigExt as _;
use super::{
BucketOperations, BucketOptions, StorageError, add_object_lock_years, get_bucket_cors_config, get_bucket_object_lock_config,
get_bucket_replication_config, resolve_object_store_handle,
StorageError, add_object_lock_years, get_bucket_cors_config, get_bucket_object_lock_config, get_bucket_replication_config,
resolve_object_store_handle,
};
use crate::config::{RustFSBufferConfig, WorkloadProfile, is_buffer_profile_enabled};
use crate::error::ApiError;
use crate::server::cors;
use crate::storage::contract::{BucketOperations, BucketOptions, ObjectToDelete};
use crate::storage::ecfs::ListObjectUnorderedQuery;
use http::header::{IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_UNMODIFIED_SINCE};
use http::{HeaderMap, HeaderValue, StatusCode};
@@ -45,8 +46,8 @@ use time::format_description::well_known::Rfc3339;
use time::{format_description::FormatItem, macros::format_description};
use tracing::{debug, warn};
use crate::storage::StorageObjectInfo as ObjectInfo;
use crate::storage::runtime_sources;
use crate::storage::{StorageObjectInfo as ObjectInfo, StorageObjectToDelete as ObjectToDelete};
const LOG_COMPONENT_STORAGE: &str = "storage";
const LOG_SUBSYSTEM_OBJECT_LOCK: &str = "object_lock";
+1 -1
View File
@@ -13,7 +13,7 @@
// limitations under the License.
use super::ECStore;
use super::ListOperations as _;
use crate::storage::contract::ListOperations as _;
use std::sync::Arc;
/// Determines if the key "looks like a prefix" (ends with `/`).
+2 -1
View File
@@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::{BucketVersioningSys, HTTPPreconditions, HTTPRangeSpec, Result, StorageError};
use super::{BucketVersioningSys, Result, StorageError};
use crate::storage::contract::{HTTPPreconditions, HTTPRangeSpec};
use http::header::{IF_MATCH, IF_NONE_MATCH};
use http::{HeaderMap, HeaderValue};
use rustfs_utils::http::{
+6 -6
View File
@@ -13,17 +13,17 @@
// limitations under the License.
use super::super::{
BucketOptions, CollectMetricsOpts, DeleteBucketOptions, DeleteOptions, DiskError, DiskInfoOptions, DiskStore, ECStore, Error,
FileInfoVersions, LocalPeerS3Client, MakeBucketOptions, MetricType, PEER_RESTSIGNAL, PEER_RESTSUB_SYS, ReadMultipleReq,
ReadMultipleResp, ReadOptions, SERVICE_SIGNAL_REFRESH_CONFIG, SERVICE_SIGNAL_RELOAD_DYNAMIC, StorageAdminApi,
StorageDiskRpcExt as _, StoragePeerS3ClientExt as _, UpdateMetadataOpts, all_local_disk_path, collect_local_metrics,
find_local_disk_by_ref, get_local_server_property, load_bucket_metadata, reload_transition_tier_config,
resolve_object_store_handle, set_bucket_metadata,
CollectMetricsOpts, DeleteOptions, DiskError, DiskInfoOptions, DiskStore, ECStore, Error, FileInfoVersions,
LocalPeerS3Client, MetricType, PEER_RESTSIGNAL, PEER_RESTSUB_SYS, ReadMultipleReq, ReadMultipleResp, ReadOptions,
SERVICE_SIGNAL_REFRESH_CONFIG, SERVICE_SIGNAL_RELOAD_DYNAMIC, StorageDiskRpcExt as _, StoragePeerS3ClientExt as _,
UpdateMetadataOpts, all_local_disk_path, collect_local_metrics, find_local_disk_by_ref, get_local_server_property,
load_bucket_metadata, reload_transition_tier_config, resolve_object_store_handle, set_bucket_metadata,
};
use crate::admin::service::{
config::{reload_dynamic_config_runtime_state, reload_runtime_config_snapshot},
site_replication::reload_site_replication_runtime_state,
};
use crate::storage::contract::{BucketOptions, DeleteBucketOptions, MakeBucketOptions, StorageAdminApi};
use crate::storage::runtime_sources;
use bytes::Bytes;
use futures::Stream;
+4 -4
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::s3_api::common::rustfs_owner;
use crate::storage::to_s3s_etag;
use crate::storage::{
use crate::storage::contract::{
BucketInfo, ListObjectVersionsInfo as StorageListObjectVersionsInfo, ListObjectsV2Info as StorageListObjectsV2Info,
};
use crate::storage::s3_api::common::rustfs_owner;
use crate::storage::to_s3s_etag;
use percent_encoding::percent_decode_str;
use s3s::dto::{
Bucket, CommonPrefix, DeleteMarkerEntry, EncodingType, ListBucketsOutput, ListObjectVersionsOutput, ListObjectsOutput,
@@ -394,8 +394,8 @@ mod tests {
build_list_object_versions_output, build_list_objects_output, build_list_objects_v2_output,
parse_list_object_versions_params, parse_list_objects_v2_params,
};
use crate::storage::BucketInfo;
use crate::storage::StorageObjectInfo as ObjectInfo;
use crate::storage::contract::BucketInfo;
use crate::storage::s3_api::common::rustfs_owner;
use s3s::S3ErrorCode;
use s3s::dto::{CommonPrefix, EncodingType, ListObjectsV2Output, Object};
+2 -2
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::contract::{ListMultipartsInfo, ListPartsInfo};
use crate::storage::s3_api::common::{rustfs_initiator, rustfs_owner};
use crate::storage::to_s3s_etag;
use crate::storage::{ListMultipartsInfo, ListPartsInfo};
use s3s::dto::{CommonPrefix, ListMultipartUploadsOutput, ListPartsOutput, MultipartUpload, Part, Timestamp};
use s3s::{S3Error, S3ErrorCode};
@@ -195,9 +195,9 @@ mod tests {
MAX_MULTIPART_UPLOADS_LIST, build_list_multipart_uploads_output, build_list_parts_output,
parse_list_multipart_uploads_params, parse_list_parts_params, parse_upload_part_number,
};
use crate::storage::contract::{ListMultipartsInfo, ListPartsInfo, MultipartInfo, PartInfo};
use crate::storage::s3_api::common::{rustfs_initiator, rustfs_owner};
use crate::storage::to_s3s_etag;
use crate::storage::{ListMultipartsInfo, ListPartsInfo, MultipartInfo, PartInfo};
use s3s::S3ErrorCode;
use s3s::dto::Timestamp;
use time::OffsetDateTime;
+36 -25
View File
@@ -16,20 +16,23 @@
use std::sync::Arc;
pub(crate) use rustfs_storage_api::{
BucketInfo, BucketOperations, BucketOptions, DeleteBucketOptions, DeletedObject, DiskCapabilities, HTTPPreconditions,
HTTPRangeSpec, ListMultipartsInfo, ListObjectVersionsInfo, ListObjectsV2Info, ListOperations, ListPartsInfo,
MakeBucketOptions, ObjectIO, ObjectLockRetentionOptions, ObjectOperations, ObjectToDelete, StorageAdminApi,
TopologyCapabilities, TopologySnapshot,
};
#[cfg(test)]
pub(crate) use rustfs_storage_api::{MultipartInfo, PartInfo};
use rustfs_storage_api as storage_contracts;
pub(crate) type StorageDeletedObject = DeletedObject;
pub(crate) mod contract {
pub(crate) use rustfs_storage_api::{
BucketInfo, BucketOperations, BucketOptions, DeleteBucketOptions, HTTPPreconditions, HTTPRangeSpec, ListMultipartsInfo,
ListObjectVersionsInfo, ListObjectsV2Info, ListOperations, ListPartsInfo, MakeBucketOptions, ObjectLockRetentionOptions,
ObjectOperations, ObjectToDelete, StorageAdminApi,
};
#[cfg(test)]
pub(crate) use rustfs_storage_api::{MultipartInfo, PartInfo};
}
pub(crate) type StorageDeletedObject = storage_contracts::DeletedObject;
pub(crate) type StorageGetObjectReader = super::GetObjectReader;
pub(crate) type StorageObjectInfo = super::ObjectInfo;
pub(crate) type StorageObjectOptions = super::ObjectOptions;
pub(crate) type StorageObjectToDelete = ObjectToDelete;
pub(crate) type StorageObjectToDelete = storage_contracts::ObjectToDelete;
pub(crate) type StoragePutObjReader = super::PutObjReader;
pub(crate) mod ecstore_admin {
@@ -624,10 +627,14 @@ pub(crate) trait StoragePeerS3ClientExt {
bucket: &str,
opts: &rustfs_common::heal_channel::HealOpts,
) -> DiskResult<rustfs_madmin::heal_commands::HealResultItem>;
async fn make_bucket(&self, bucket: &str, opts: &MakeBucketOptions) -> DiskResult<()>;
async fn list_bucket(&self, opts: &BucketOptions) -> DiskResult<Vec<BucketInfo>>;
async fn delete_bucket(&self, bucket: &str, opts: &DeleteBucketOptions) -> DiskResult<()>;
async fn get_bucket_info(&self, bucket: &str, opts: &BucketOptions) -> DiskResult<BucketInfo>;
async fn make_bucket(&self, bucket: &str, opts: &storage_contracts::MakeBucketOptions) -> DiskResult<()>;
async fn list_bucket(&self, opts: &storage_contracts::BucketOptions) -> DiskResult<Vec<storage_contracts::BucketInfo>>;
async fn delete_bucket(&self, bucket: &str, opts: &storage_contracts::DeleteBucketOptions) -> DiskResult<()>;
async fn get_bucket_info(
&self,
bucket: &str,
opts: &storage_contracts::BucketOptions,
) -> DiskResult<storage_contracts::BucketInfo>;
}
impl StoragePeerS3ClientExt for LocalPeerS3Client {
@@ -639,19 +646,23 @@ impl StoragePeerS3ClientExt for LocalPeerS3Client {
ecstore_rpc::PeerS3Client::heal_bucket(self, bucket, opts).await
}
async fn make_bucket(&self, bucket: &str, opts: &MakeBucketOptions) -> DiskResult<()> {
async fn make_bucket(&self, bucket: &str, opts: &storage_contracts::MakeBucketOptions) -> DiskResult<()> {
ecstore_rpc::PeerS3Client::make_bucket(self, bucket, opts).await
}
async fn list_bucket(&self, opts: &BucketOptions) -> DiskResult<Vec<BucketInfo>> {
async fn list_bucket(&self, opts: &storage_contracts::BucketOptions) -> DiskResult<Vec<storage_contracts::BucketInfo>> {
ecstore_rpc::PeerS3Client::list_bucket(self, opts).await
}
async fn delete_bucket(&self, bucket: &str, opts: &DeleteBucketOptions) -> DiskResult<()> {
async fn delete_bucket(&self, bucket: &str, opts: &storage_contracts::DeleteBucketOptions) -> DiskResult<()> {
ecstore_rpc::PeerS3Client::delete_bucket(self, bucket, opts).await
}
async fn get_bucket_info(&self, bucket: &str, opts: &BucketOptions) -> DiskResult<BucketInfo> {
async fn get_bucket_info(
&self,
bucket: &str,
opts: &storage_contracts::BucketOptions,
) -> DiskResult<storage_contracts::BucketInfo> {
ecstore_rpc::PeerS3Client::get_bucket_info(self, bucket, opts).await
}
}
@@ -906,9 +917,9 @@ where
pub(crate) fn topology_snapshot_from_endpoint_pools_with_capabilities(
endpoint_pools: &EndpointServerPools,
capabilities: TopologyCapabilities,
disk_capabilities: DiskCapabilities,
) -> TopologySnapshot {
capabilities: storage_contracts::TopologyCapabilities,
disk_capabilities: storage_contracts::DiskCapabilities,
) -> storage_contracts::TopologySnapshot {
ecstore_cluster::topology_snapshot_from_endpoint_pools_with_capabilities(endpoint_pools, capabilities, disk_capabilities)
}
@@ -946,7 +957,7 @@ impl StorageVersioningConfigExt for s3s::dto::VersioningConfiguration {
}
}
pub(crate) type GetObjectReader = <ECStore as ObjectIO>::GetObjectReader;
pub(crate) type ObjectInfo = <ECStore as ObjectOperations>::ObjectInfo;
pub(crate) type ObjectOptions = <ECStore as ObjectOperations>::ObjectOptions;
pub(crate) type PutObjReader = <ECStore as ObjectIO>::PutObjectReader;
pub(crate) type GetObjectReader = <ECStore as storage_contracts::ObjectIO>::GetObjectReader;
pub(crate) type ObjectInfo = <ECStore as storage_contracts::ObjectOperations>::ObjectInfo;
pub(crate) type ObjectOptions = <ECStore as storage_contracts::ObjectOperations>::ObjectOptions;
pub(crate) type PutObjReader = <ECStore as storage_contracts::ObjectIO>::PutObjectReader;