Skip to content

Expose reusable block encoder and decoder APIs - #150

Open
thomhurst wants to merge 4 commits into
brantburnett:mainfrom
thomhurst:reusable-block-codec-api
Open

thomhurst wants to merge 4 commits into
brantburnett:mainfrom
thomhurst:reusable-block-codec-api

Conversation

@thomhurst

@thomhurst thomhurst commented Aug 31, 2026 •

Copy link
Copy Markdown

Stack

Depends on #149. This branch is the second layer of the local gh stack:

  1. Refactor block decompression to use OperationStatus #149 — internal OperationStatus refactoring
  2. this PR — public reusable block codec API

GitHub native stack linking does not support cross-fork PRs. Until #149 merges, the focused second-layer diff is available in this branch comparison. Once #149 lands, this PR's GitHub diff will automatically contain only this public API layer.

Summary

  • add public sealed SnappyBlockEncoder with span and sequence-to-writer compression
  • add public sealed SnappyBlockDecoder with incremental OperationStatus decompression
  • support NeedMoreData, DestinationTooSmall, Done, and persistent InvalidData states
  • require explicit Reset() between incremental blocks; sequence-to-writer calls reset automatically
  • document ownership, disposal, and non-concurrent use
  • add reusable-codec benchmarks and lifecycle/status tests

This is the public API follow-up discussed in #148 while leaving SnappyCompressor and SnappyDecompressor internal.

Validation

  • dotnet build Snappier.slnx --configuration Release: 0 warnings/errors
  • net48: 283/283 tests passed
  • net8.0, net9.0, net10.0: 299/299 tests passed on each target
  • package API compatibility passes with next-version metadata (1.3.2)

Prepare internal block decoding for a streaming public API while keeping the public surface unchanged.
Copilot AI lite review requested due to automatic review settings August 31, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Preserve consumed offsets when tag decoding fails and reject literals that exceed the declared output length.
Expose stable encoder and decoder wrappers while keeping codec internals free to evolve.

Refs brantburnett#148
Track the maximum used range across Reset calls so pooled buffers never retain prior plaintext after a smaller block.

This branch has not been deployed

No deployments
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.

2 participants