chore(zip): trim the unused extract and create surface (#6210)

rustfs-zip has one workspace consumer, and it uses only
CompressionFormat::{from_extension, extension, get_decoder} and
ArchiveLimits. Remove the tar/zip extract, zip create, and in-memory
compress helpers together with the types and dependencies that only
served them. Trimming public API is semver-major once the stable tag is
cut, so it costs least now.
This commit is contained in:
Zhengchao An
2026-08-18 18:27:01 +08:00
committed by GitHub
parent 382ae9529e
commit a38743caf5
5 changed files with 58 additions and 2118 deletions
+12 -42
View File
@@ -1,9 +1,9 @@
[![RustFS](https://rustfs.com/images/rustfs-github.png)](https://rustfs.com)
# RustFS Zip - Archive And Compression Primitives
# RustFS Zip - Archive Format Detection And Stream Decoding
<p align="center">
<strong>High-performance compression and archiving for RustFS object storage</strong>
<strong>Archive format detection and async stream decoders for RustFS object storage</strong>
</p>
<p align="center">
@@ -17,53 +17,23 @@
## 📖 Overview
**RustFS Zip** provides archive and compression primitives for the [RustFS](https://rustfs.com) distributed object storage system. Today it is primarily used by RustFS archive extract flows to:
**RustFS Zip** provides the archive primitives used by the [RustFS](https://rustfs.com) archive extract flow:
- identify archive/compression formats by extension
- stream tar and tar+compression inputs through async decoders
- provide small ZIP read/write helpers for local archive workflows
- identify a compression format from an archive extension
- wrap an async reader in the matching stream decoder
- carry the shared default archive guardrails
## Current Features
- A clearer type model with:
- `CompressionCodec` for stream codecs
- `ArchiveKind` for container families
- `ArchiveFormat` for concrete archive/container combinations
- Async stream codecs for `gzip`, `bzip2`, `zlib`, `xz`, and `zstd`
- Tar archive iteration over async readers through `read_archive_entries()` / `extract_tar_entries()`
- Archive guardrails through `ArchiveLimits` for entry count, entry size, total unpacked size, and path length
- In-memory compression helpers for payload round-trip workflows
- Blocking ZIP create/extract helpers for local archive files
- ZIP helper metadata via `ZipEntry`, including:
- `compression_method`
- `archive_kind`
- `format`
- `unix_mode`
- ZIP helper options via `ZipWriteOptions`, including:
- `compression_level`
- `create_directory_entries`
## Compatibility
- `CompressionFormat` is retained as a compatibility layer for existing callers
- New code should prefer `ArchiveFormat`, `ArchiveKind`, and `CompressionCodec` when expressing archive semantics
## ZIP Helper Scope
The file-based ZIP helper APIs are best suited for:
- local archive import/export flows
- admin-side packaging helpers
- test fixtures and tooling
They are not intended to be a remote streaming ZIP access engine.
- `CompressionFormat::from_extension()` for extension-based format detection, including tar-family suffixes such as `tgz`, `tbz2`, `txz`, and `tzst`
- `CompressionFormat::get_decoder()` for async stream decoding of `gzip`, `bzip2`, `zlib`, `xz`, and `zstd`, plus a pass-through reader for plain `tar`
- `ArchiveLimits` with the default entry count, entry size, total unpacked size, and path length guardrails
## Current Boundaries
- ZIP is supported via file-based helper APIs, not the tar-family async stream APIs
- Tar-family stream APIs are intended for `tar`, `tar.gz`, `tar.bz2`, `tar.xz`, `tar.zst`, and similar compressed tar flows
- Default archive guardrails are intentionally conservative and do not replace higher-level RustFS object-path validation
- This crate does not currently implement a general-purpose parallel archive engine
- ZIP has no stream decoder: `get_decoder()` rejects `CompressionFormat::Zip`, because ZIP needs central-directory semantics that a forward-only stream cannot provide
- This crate detects formats and hands back decoders; archive iteration, entry writing, and extraction to disk belong to the caller
- `ArchiveLimits` carries the values only; enforcement and the resulting protocol error belong to the caller
- Archive extraction safety policy remains the responsibility of the RustFS caller for object-store flows
## 📚 Documentation