Xuanwo opened a new pull request, #8947:
URL: https://github.com/apache/opendal/pull/8947

   # Which issue does this PR close?
   
   None.
   
   # Rationale for this change
   
   `OpendalStorage::list` previously wrapped each entry's `opendal::Metadata` 
directly into `OpendalMetadata`. On OpenDAL backends whose lister omits full 
file metadata — returning either `EntryMode::Unknown` (leaving `is_file() == 
false` and `len() == 0`) or file entries without `last_modified` (causing 
`OpendalMetadata::modified()` to fail even when `stat` can provide it, as on 
backends refined by `CompleteLayer` or partial listers) — FTP `LIST` and `MLSD` 
reported incomplete metadata inconsistent with `storage.metadata()` 
(`SIZE`/`MDTM`).
   
   # What changes are included in this PR?
   
   - Update `OpendalStorage::list` in `integrations/unftp-sbe/src/lib.rs` to 
fall back to `self.op.stat(&path).await` for non-directory entries with 
incomplete metadata (`!metadata.is_file() || 
metadata.last_modified().is_none()`) when `self.op.info().capability().stat` is 
enabled:
     - Replace the entry's metadata with the `stat` result on `Ok(stat_meta)`.
     - Skip entries that vanished concurrently (`ErrorKind::NotFound`) instead 
of failing the listing.
     - Fall back to the lister's metadata when `stat` returns 
`ErrorKind::Unsupported`.
     - Propagate other unexpected errors via `convert_err`.
     - Skip extra `stat` calls for directories (`metadata.is_dir()`), backends 
without `stat` capability, and backends whose lister already returns complete 
file metadata (`metadata.is_file() && metadata.last_modified().is_some()`).
   - Add integration tests in `integrations/unftp-sbe/tests/storage_backend.rs` 
covering:
     - `services::Memory` `list` and `list_fmt` populating file mode, size, and 
`modified()` without stat'ing directories.
     - `services::Fs` issuing zero extra `stat` calls when listed metadata is 
already complete, and stat'ing only files when `last_modified` is omitted.
     - Concurrent `NotFound` skipping, `Unsupported` fallback, missing `stat` 
capability skipping, and error propagation for unexpected `stat` errors.
   
   # Are there any user-facing changes?
   
   Yes: FTP `LIST` and `MLSD` backed by `unftp-sbe-opendal` now populate 
missing file metadata via `stat` on backends with partial listers, while 
skipping concurrently deleted entries cleanly and avoiding extra `stat` calls 
for directories or complete listers.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: pi
   - Model: Gemini 4 Neon
   - Effort: high
   - Role: Implemented the `stat` metadata fallback in `OpendalStorage::list`, 
added integration tests in `integrations/unftp-sbe/tests/storage_backend.rs` 
covering `services::Memory`, `services::Fs`, and error/capability edge cases, 
and ran formatting, clippy, test, and rustdoc checks for 
`integrations/unftp-sbe`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to