refactor: route remaining external storage boundaries (#3889)

This commit is contained in:
Zhengchao An
2026-06-26 06:22:51 +08:00
committed by GitHub
parent 4d6ea453a7
commit e37e367390
31 changed files with 416 additions and 208 deletions
+7 -30
View File
@@ -13,46 +13,23 @@
// limitations under the License.
use datafusion::{common::DataFusionError, sql::sqlparser::parser::ParserError};
pub(crate) use rustfs_ecstore::api::error::StorageError as SelectStorageError;
use rustfs_ecstore::api::error::{
is_err_bucket_not_found as select_is_err_bucket_not_found_from_backend,
is_err_object_not_found as select_is_err_object_not_found_from_backend,
is_err_version_not_found as select_is_err_version_not_found_from_backend,
};
use rustfs_ecstore::api::global::resolve_object_store_handle as resolve_select_object_store_handle_from_backend;
pub(crate) use rustfs_ecstore::api::set_disk::DEFAULT_READ_BUFFER_SIZE as SELECT_DEFAULT_READ_BUFFER_SIZE;
pub(crate) use rustfs_ecstore::api::storage::ECStore as SelectStore;
use snafu::{Backtrace, Location, Snafu};
use std::{fmt::Display, sync::Arc};
use std::fmt::Display;
pub mod object_store;
pub mod query;
pub mod server;
mod storage_api;
#[cfg(test)]
mod test;
pub type QueryResult<T> = Result<T, QueryError>;
pub(crate) type SelectGetObjectReader = <SelectStore as rustfs_storage_api::ObjectIO>::GetObjectReader;
pub(crate) type SelectObjectInfo = <SelectStore as rustfs_storage_api::ObjectOperations>::ObjectInfo;
pub(crate) type SelectObjectOptions = <SelectStore as rustfs_storage_api::ObjectOperations>::ObjectOptions;
pub(crate) fn resolve_select_object_store_handle() -> Option<Arc<SelectStore>> {
resolve_select_object_store_handle_from_backend()
}
pub(crate) fn select_is_err_bucket_not_found(err: &SelectStorageError) -> bool {
select_is_err_bucket_not_found_from_backend(err)
}
pub(crate) fn select_is_err_object_not_found(err: &SelectStorageError) -> bool {
select_is_err_object_not_found_from_backend(err)
}
pub(crate) fn select_is_err_version_not_found(err: &SelectStorageError) -> bool {
select_is_err_version_not_found_from_backend(err)
}
pub(crate) use storage_api::{
SELECT_DEFAULT_READ_BUFFER_SIZE, SelectGetObjectReader, SelectObjectInfo, SelectObjectOptions, SelectStorageError,
SelectStore, resolve_select_object_store_handle, select_is_err_bucket_not_found, select_is_err_object_not_found,
select_is_err_version_not_found,
};
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
+2 -1
View File
@@ -30,7 +30,6 @@ use futures_core::stream::BoxStream;
use http::{HeaderMap, HeaderValue, header::HeaderName};
use pin_project_lite::pin_project;
use rustfs_common::DEFAULT_DELIMITER;
use rustfs_storage_api::{HTTPRangeSpec, ObjectIO as _, ObjectOperations as _};
use s3s::S3Result;
use s3s::dto::SelectObjectContentInput;
use s3s::header::{
@@ -49,6 +48,8 @@ use tokio::io::{AsyncRead, ReadBuf};
use tokio_util::io::ReaderStream;
use transform_stream::AsyncTryStream;
use crate::storage_api::{HTTPRangeSpec, ObjectIO as _, ObjectOperations as _};
fn select_default_read_buffer_size_u64() -> u64 {
u64::try_from(SELECT_DEFAULT_READ_BUFFER_SIZE).unwrap_or(u64::MAX)
}
+46
View File
@@ -0,0 +1,46 @@
// Copyright 2024 RustFS Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use std::sync::Arc;
pub(crate) use rustfs_ecstore::api::error::StorageError as SelectStorageError;
use rustfs_ecstore::api::error::{
is_err_bucket_not_found as select_is_err_bucket_not_found_from_backend,
is_err_object_not_found as select_is_err_object_not_found_from_backend,
is_err_version_not_found as select_is_err_version_not_found_from_backend,
};
use rustfs_ecstore::api::global::resolve_object_store_handle as resolve_select_object_store_handle_from_backend;
pub(crate) use rustfs_ecstore::api::set_disk::DEFAULT_READ_BUFFER_SIZE as SELECT_DEFAULT_READ_BUFFER_SIZE;
pub(crate) use rustfs_ecstore::api::storage::ECStore as SelectStore;
pub(crate) use rustfs_storage_api::{HTTPRangeSpec, ObjectIO, ObjectOperations};
pub(crate) type SelectGetObjectReader = <SelectStore as rustfs_storage_api::ObjectIO>::GetObjectReader;
pub(crate) type SelectObjectInfo = <SelectStore as rustfs_storage_api::ObjectOperations>::ObjectInfo;
pub(crate) type SelectObjectOptions = <SelectStore as rustfs_storage_api::ObjectOperations>::ObjectOptions;
pub(crate) fn resolve_select_object_store_handle() -> Option<Arc<SelectStore>> {
resolve_select_object_store_handle_from_backend()
}
pub(crate) fn select_is_err_bucket_not_found(err: &SelectStorageError) -> bool {
select_is_err_bucket_not_found_from_backend(err)
}
pub(crate) fn select_is_err_object_not_found(err: &SelectStorageError) -> bool {
select_is_err_object_not_found_from_backend(err)
}
pub(crate) fn select_is_err_version_not_found(err: &SelectStorageError) -> bool {
select_is_err_version_not_found_from_backend(err)
}