keep sftp e2e tests buildable (#2897)

This commit is contained in:
houseme
2026-05-10 19:52:15 +08:00
committed by GitHub
parent 65c62ab2ea
commit 53ec1b95d8
10 changed files with 47 additions and 125 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
// limitations under the License.
//! SftpError type and the helpers that convert backend errors and
//! authorisation failures into SftpError, plus the success Status
//! authorization failures into SftpError, plus the success Status
//! payload constructor.
use super::constants::{http_error_codes, s3_error_codes};
+2 -2
View File
@@ -51,7 +51,7 @@
//! per-session watchdog that observes the SFTP-handler activity stamp
//! and the kernel TCP state for the connection. Sessions that fall
//! silent at the SFTP layer while the kernel reports CLOSE_WAIT are
//! cancelled on a bounded schedule. The watchdog backstops resource
//! canceled on a bounded schedule. The watchdog backstops resource
//! accumulation regardless of which layer stalled. On Linux the
//! detection latency is on the order of 45 seconds; on non-Linux
//! targets the watchdog falls back to an inactivity ceiling on the
@@ -63,7 +63,7 @@
//! the rest. Subsequent reads inside that window are served from
//! memory. Total cache memory across every live handle is bounded by
//! a shared atomic accumulator enforced against the process-wide
//! ceiling. On ceiling breach the populate is skipped and the read
//! ceiling. On ceiling breach the population is skipped and the read
//! serves correctly via a single backend call without storing the
//! bytes for re-use.
//!
+4 -4
View File
@@ -21,7 +21,7 @@ use rustfs_utils::path;
/// Prefix the input with "/" if it is empty or relative. SFTP paths are
/// addressed as absolute against the server root. Clients may submit a
/// relative form (e.g. "." or "foo/bar"). Both forms normalise to the
/// relative form (e.g. "." or "foo/bar"). Both forms normalize to the
/// same absolute starting point before any cleaning or splitting runs.
pub(super) fn ensure_absolute(path: &str) -> String {
if path.is_empty() || !path.starts_with('/') {
@@ -44,7 +44,7 @@ pub(super) fn last_path_component(s: &str) -> Option<&str> {
/// Extract the single filename component of full_key relative to prefix.
/// Returns None when full_key does not start with prefix, when the
/// residual is empty (key equalled prefix exactly), or when the residual
/// residual is empty (key equaled prefix exactly), or when the residual
/// contains a slash (entry belongs under a sub-prefix and should have
/// appeared via common_prefixes under delimiter="/").
pub(super) fn relative_filename<'a>(full_key: &'a str, prefix: &str) -> Option<&'a str> {
@@ -55,7 +55,7 @@ pub(super) fn relative_filename<'a>(full_key: &'a str, prefix: &str) -> Option<&
Some(residual)
}
/// Canonicalise an incoming SFTP path and split it into an optional bucket
/// Canonicalize an incoming SFTP path and split it into an optional bucket
/// and object key.
///
/// An empty input is treated as root ("/"). An input that does not start
@@ -75,7 +75,7 @@ pub(super) fn relative_filename<'a>(full_key: &'a str, prefix: &str) -> Option<&
/// rejected at this boundary so a path emitted on a tracing field
/// cannot inject a line into the operator log; downstream warn paths
/// (skip-abort, stat fallback, REMOVE refusal) emit the bucket and key
/// without further sanitisation.
/// without further sanitization.
pub(super) fn parse_s3_path(input: &str) -> Result<(String, Option<String>), SftpError> {
if input.contains(['\0', '\r', '\n']) {
return Err(SftpError::code(StatusCode::BadMessage));
+1 -1
View File
@@ -15,7 +15,7 @@
//! Write-side state machine: open_write, commit_write, the
//! write_dispatch chain that flushes a part once part_buffer reaches
//! part_size, abort_upload_with_auth, close_streaming, and
//! multipart_copy. Also the cancellation-safety primitives
//! multipart_copy. Also, the cancellation-safety primitives
//! (build_write_tombstone, should_abort_on_drop) that the Drop impl
//! in driver.rs consumes.