mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 21:07:43 +00:00
refactor: segment storage owner contracts by domain (#3911)
This commit is contained in:
@@ -22,7 +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::contract::bucket::BucketOperations;
|
||||
use crate::storage::request_context::RequestContext;
|
||||
use crate::storage::runtime_sources;
|
||||
use metrics::counter;
|
||||
|
||||
@@ -23,7 +23,10 @@ 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::contract::{
|
||||
bucket::{BucketOperations, BucketOptions},
|
||||
object::{ObjectLockRetentionOptions, ObjectOperations as _},
|
||||
};
|
||||
use crate::storage::helper::OperationHelper;
|
||||
use crate::storage::options::get_opts;
|
||||
use crate::storage::runtime_sources;
|
||||
|
||||
@@ -20,7 +20,10 @@ use super::{
|
||||
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::contract::{
|
||||
bucket::{BucketOperations, BucketOptions},
|
||||
object::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};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::ECStore;
|
||||
use crate::storage::contract::ListOperations as _;
|
||||
use crate::storage::contract::list::ListOperations as _;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Determines if the key "looks like a prefix" (ends with `/`).
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::{BucketVersioningSys, Result, StorageError};
|
||||
use crate::storage::contract::{HTTPPreconditions, HTTPRangeSpec};
|
||||
use crate::storage::contract::{object::HTTPPreconditions, range::HTTPRangeSpec};
|
||||
use http::header::{IF_MATCH, IF_NONE_MATCH};
|
||||
use http::{HeaderMap, HeaderValue};
|
||||
use rustfs_utils::http::{
|
||||
|
||||
@@ -23,7 +23,10 @@ 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::contract::{
|
||||
admin::StorageAdminApi,
|
||||
bucket::{BucketOptions, DeleteBucketOptions, MakeBucketOptions},
|
||||
};
|
||||
use crate::storage::runtime_sources;
|
||||
use bytes::Bytes;
|
||||
use futures::Stream;
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate::storage::contract::{
|
||||
BucketInfo, ListObjectVersionsInfo as StorageListObjectVersionsInfo, ListObjectsV2Info as StorageListObjectsV2Info,
|
||||
bucket::BucketInfo,
|
||||
list::{ListObjectVersionsInfo as StorageListObjectVersionsInfo, ListObjectsV2Info as StorageListObjectsV2Info},
|
||||
};
|
||||
use crate::storage::s3_api::common::rustfs_owner;
|
||||
use crate::storage::to_s3s_etag;
|
||||
@@ -395,7 +396,7 @@ mod tests {
|
||||
parse_list_object_versions_params, parse_list_objects_v2_params,
|
||||
};
|
||||
use crate::storage::StorageObjectInfo as ObjectInfo;
|
||||
use crate::storage::contract::BucketInfo;
|
||||
use crate::storage::contract::bucket::BucketInfo;
|
||||
use crate::storage::s3_api::common::rustfs_owner;
|
||||
use s3s::S3ErrorCode;
|
||||
use s3s::dto::{CommonPrefix, EncodingType, ListObjectsV2Output, Object};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::storage::contract::{ListMultipartsInfo, ListPartsInfo};
|
||||
use crate::storage::contract::multipart::{ListMultipartsInfo, ListPartsInfo};
|
||||
use crate::storage::s3_api::common::{rustfs_initiator, rustfs_owner};
|
||||
use crate::storage::to_s3s_etag;
|
||||
use s3s::dto::{CommonPrefix, ListMultipartUploadsOutput, ListPartsOutput, MultipartUpload, Part, Timestamp};
|
||||
@@ -195,7 +195,7 @@ 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::contract::multipart::{ListMultipartsInfo, ListPartsInfo, MultipartInfo, PartInfo};
|
||||
use crate::storage::s3_api::common::{rustfs_initiator, rustfs_owner};
|
||||
use crate::storage::to_s3s_etag;
|
||||
use s3s::S3ErrorCode;
|
||||
|
||||
@@ -19,20 +19,46 @@ use std::sync::Arc;
|
||||
use rustfs_storage_api as storage_contracts;
|
||||
|
||||
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) mod admin {
|
||||
pub(crate) use super::super::storage_contracts::StorageAdminApi;
|
||||
}
|
||||
|
||||
pub(crate) mod bucket {
|
||||
pub(crate) use super::super::storage_contracts::{
|
||||
BucketInfo, BucketOperations, BucketOptions, DeleteBucketOptions, MakeBucketOptions,
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) mod list {
|
||||
pub(crate) use super::super::storage_contracts::{ListObjectVersionsInfo, ListObjectsV2Info, ListOperations};
|
||||
}
|
||||
|
||||
pub(crate) mod multipart {
|
||||
pub(crate) use super::super::storage_contracts::{ListMultipartsInfo, ListPartsInfo};
|
||||
#[cfg(test)]
|
||||
pub(crate) use super::super::storage_contracts::{MultipartInfo, PartInfo};
|
||||
}
|
||||
|
||||
pub(crate) mod object {
|
||||
pub(crate) use super::super::storage_contracts::{
|
||||
DeletedObject, HTTPPreconditions, ObjectIO, ObjectLockRetentionOptions, ObjectOperations, ObjectToDelete,
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) mod range {
|
||||
pub(crate) use super::super::storage_contracts::HTTPRangeSpec;
|
||||
}
|
||||
|
||||
pub(crate) mod topology {
|
||||
pub(crate) use super::super::storage_contracts::{DiskCapabilities, TopologyCapabilities, TopologySnapshot};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) type StorageDeletedObject = storage_contracts::DeletedObject;
|
||||
pub(crate) type StorageDeletedObject = contract::object::DeletedObject;
|
||||
pub(crate) type StorageGetObjectReader = super::GetObjectReader;
|
||||
pub(crate) type StorageObjectInfo = super::ObjectInfo;
|
||||
pub(crate) type StorageObjectOptions = super::ObjectOptions;
|
||||
pub(crate) type StorageObjectToDelete = storage_contracts::ObjectToDelete;
|
||||
pub(crate) type StorageObjectToDelete = contract::object::ObjectToDelete;
|
||||
pub(crate) type StoragePutObjReader = super::PutObjReader;
|
||||
|
||||
pub(crate) mod ecstore_admin {
|
||||
@@ -630,14 +656,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: &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 make_bucket(&self, bucket: &str, opts: &contract::bucket::MakeBucketOptions) -> DiskResult<()>;
|
||||
async fn list_bucket(&self, opts: &contract::bucket::BucketOptions) -> DiskResult<Vec<contract::bucket::BucketInfo>>;
|
||||
async fn delete_bucket(&self, bucket: &str, opts: &contract::bucket::DeleteBucketOptions) -> DiskResult<()>;
|
||||
async fn get_bucket_info(
|
||||
&self,
|
||||
bucket: &str,
|
||||
opts: &storage_contracts::BucketOptions,
|
||||
) -> DiskResult<storage_contracts::BucketInfo>;
|
||||
opts: &contract::bucket::BucketOptions,
|
||||
) -> DiskResult<contract::bucket::BucketInfo>;
|
||||
}
|
||||
|
||||
impl StoragePeerS3ClientExt for LocalPeerS3Client {
|
||||
@@ -649,23 +675,23 @@ impl StoragePeerS3ClientExt for LocalPeerS3Client {
|
||||
ecstore_rpc::PeerS3Client::heal_bucket(self, bucket, opts).await
|
||||
}
|
||||
|
||||
async fn make_bucket(&self, bucket: &str, opts: &storage_contracts::MakeBucketOptions) -> DiskResult<()> {
|
||||
async fn make_bucket(&self, bucket: &str, opts: &contract::bucket::MakeBucketOptions) -> DiskResult<()> {
|
||||
ecstore_rpc::PeerS3Client::make_bucket(self, bucket, opts).await
|
||||
}
|
||||
|
||||
async fn list_bucket(&self, opts: &storage_contracts::BucketOptions) -> DiskResult<Vec<storage_contracts::BucketInfo>> {
|
||||
async fn list_bucket(&self, opts: &contract::bucket::BucketOptions) -> DiskResult<Vec<contract::bucket::BucketInfo>> {
|
||||
ecstore_rpc::PeerS3Client::list_bucket(self, opts).await
|
||||
}
|
||||
|
||||
async fn delete_bucket(&self, bucket: &str, opts: &storage_contracts::DeleteBucketOptions) -> DiskResult<()> {
|
||||
async fn delete_bucket(&self, bucket: &str, opts: &contract::bucket::DeleteBucketOptions) -> DiskResult<()> {
|
||||
ecstore_rpc::PeerS3Client::delete_bucket(self, bucket, opts).await
|
||||
}
|
||||
|
||||
async fn get_bucket_info(
|
||||
&self,
|
||||
bucket: &str,
|
||||
opts: &storage_contracts::BucketOptions,
|
||||
) -> DiskResult<storage_contracts::BucketInfo> {
|
||||
opts: &contract::bucket::BucketOptions,
|
||||
) -> DiskResult<contract::bucket::BucketInfo> {
|
||||
ecstore_rpc::PeerS3Client::get_bucket_info(self, bucket, opts).await
|
||||
}
|
||||
}
|
||||
@@ -926,9 +952,9 @@ where
|
||||
|
||||
pub(crate) fn topology_snapshot_from_endpoint_pools_with_capabilities(
|
||||
endpoint_pools: &EndpointServerPools,
|
||||
capabilities: storage_contracts::TopologyCapabilities,
|
||||
disk_capabilities: storage_contracts::DiskCapabilities,
|
||||
) -> storage_contracts::TopologySnapshot {
|
||||
capabilities: contract::topology::TopologyCapabilities,
|
||||
disk_capabilities: contract::topology::DiskCapabilities,
|
||||
) -> contract::topology::TopologySnapshot {
|
||||
ecstore_cluster::topology_snapshot_from_endpoint_pools_with_capabilities(endpoint_pools, capabilities, disk_capabilities)
|
||||
}
|
||||
|
||||
@@ -966,7 +992,7 @@ impl StorageVersioningConfigExt for s3s::dto::VersioningConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
pub(crate) type GetObjectReader = <ECStore as contract::object::ObjectIO>::GetObjectReader;
|
||||
pub(crate) type ObjectInfo = <ECStore as contract::object::ObjectOperations>::ObjectInfo;
|
||||
pub(crate) type ObjectOptions = <ECStore as contract::object::ObjectOperations>::ObjectOptions;
|
||||
pub(crate) type PutObjReader = <ECStore as contract::object::ObjectIO>::PutObjectReader;
|
||||
|
||||
Reference in New Issue
Block a user