Skip to content

feat: add zstd and lz4 compression formats (#3, #4)#128

Open
Chris-Wolfgang wants to merge 6 commits into
vNextfrom
feat/zstd-lz4-formats
Open

feat: add zstd and lz4 compression formats (#3, #4)#128
Chris-Wolfgang wants to merge 6 commits into
vNextfrom
feat/zstd-lz4-formats

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Closes #3, closes #4.

What

Adds Zstandard and LZ4 as compression formats, following the existing strategy pattern.

Format --format Single Bundle Library
Zstandard zstd / zst .zst .tar.zst ZstdSharp.Port
LZ4 lz4 .lz4 .tar.lz4 K4os.Compression.LZ4.Streams

Both are pure-managed and cross-platform. Each maps the framework CompressionLevel (fastest/optimal/smallest) onto the format's native level scale.

Changes

  • New ZstdCompressionStrategy / Lz4CompressionStrategy; CompressionFormat enum + factory + SharedOptions parsing/validation/help all updated.
  • Tests: round-trip (single + tar bundle), empty-stream, per-level mapping, factory dispatch, format parse/build. 203 unit + 14 integration pass; new code 100% covered; 0 warnings.
  • README: five-format listing, CLI --format values, architecture section (also documents the already-shipped --include/--exclude glob filters).

Acceptance criteria (both issues)

  • logc compress x.log --format zstd.zst; --format lz4.lz4
  • logc bundle ./logs --format zstd.tar.zst; lz4.tar.lz4
  • ✅ Unit tests for both strategies
  • ⏭️ "Benchmark comparison chart" → handled in Add compression algorithm comparison chart to README #5 (depends on this)

No protected files.

Closes #3, closes #4.

- ZstdCompressionStrategy (ZstdSharp.Port) — .zst single / .tar.zst bundle.
- Lz4CompressionStrategy (K4os.Compression.LZ4.Streams) — .lz4 / .tar.lz4.
- CompressionFormat enum gains Zstd, Lz4; CompressionStrategyFactory dispatches them.
- SharedOptions accepts --format zst|zstd|lz4 (description + error message updated).
- Both strategies map the framework CompressionLevel onto the native level scale
  (Fastest/Optimal/SmallestSize), following the existing GZip/Brotli tar+stream pattern.
- Tests: round-trip (single + tar bundle), empty stream, per-level mapping, factory
  dispatch, and format parsing/build-options. 203 unit + 14 integration pass; new
  code at 100% coverage; 0 build warnings.
- README: formats list (now five), CLI --format values, and architecture section
  updated (also documents the already-shipped --include/--exclude glob filters).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Chris-Wolfgang and others added 3 commits June 16, 2026 20:18
…exclude, #12)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds the two new formats to CompressionBenchmarks [Params] + Setup and to the
CompressionRatioBenchmarks comparison table, so benchmark/ratio runs cover all
five formats (feeds the #5 comparison chart).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Chris-Wolfgang and others added 2 commits June 28, 2026 12:19
Per PR #128 review thread: zstd has no true "store" level (valid range
is 1..22), so NoCompression collapses to the same value as Fastest.
Comment updated to explain the rationale so the next reader doesn't
re-ask.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add LZ4 compression format Add Zstandard (zstd) compression format

1 participant