pub async fn upload_dir_and_prune(
local_root: &Path,
key_prefix: &str,
crate_name: &str,
version: &str,
docs_storage: &DocsStorage,
) -> Result<(), DocsError>Expand description
Upload every regular file under local_root to docs_storage under the
{crate_name}/{version}/{key_prefix}/ prefix, then delete any pre-existing
key under {crate_name}/{version}/ that wasn’t just uploaded.
Symlinks are never followed, so only files that were actually written into
local_root can end up in the docs storage.
Upload-then-prune (not delete-then-upload) so a partial/failed upload never leaves a doc version with zero pages.
key_prefix lets the auto-generation queue (which walks target/doc
directly) and the manual-upload path (whose zip already contains a
top-level doc/ folder) both land under {crate}/{version}/doc/...,
matching the layout compute_doc_url expects. Pass "" when local_root
already contains the full relative structure.