Repository navigation
Conversation
Add the shared coding library for the /stripe/rs/0 scheme: streaming interleaved encode, piece lengths and the cell size rule, range-read planning, and rebuilding pieces from k others. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unchecked layout arithmetic can overflow, causing division-by-zero panics for accepted configurations and incorrect final-row range lengths.
2 open issues
What changed in this PR
Adds a shared Reed–Solomon stripe library so Ingot, repair, and other clients can produce compatible pieces. No callers are integrated yet.
Changes:
- Implements streaming encoding and piece reconstruction.
- Calculates piece lengths and supports byte-range reads.
- Adds RFC-vector tests, round-trip coverage, and an encoding benchmark.
| File | Description |
|---|---|
| go.sum | Records Reed–Solomon dependency checksums. |
| go.mod | Adds the Reed–Solomon dependency. |
| erasure/layout.go | Defines layout validation, piece lengths, and range calculations. |
| erasure/erasure_test.go | Tests encoding, reconstruction, ranges, and invalid inputs. |
| erasure/code.go | Implements streaming encoding, range reading, and reconstruction. |
Review effort: Balanced
| // k is 1: a cell longer than the chunk holds no more than the chunk. | ||
| cellSize = size | ||
| } | ||
| return Layout{size: size, k: int(k), m: int(m), cell: cellSize}, nil |
| return Range{}, fmt.Errorf("erasure: rows %d to %d are outside a stripe of %d rows", first, last, l.Rows()) | ||
| } | ||
| start := l.before(slot, first*l.rowSize()) | ||
| end := l.before(slot, min((last+1)*l.rowSize(), l.size)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Adds the shared library that codes and decodes stripes, as the erasure coding RFC defines them, so Ingot, and later repair and other clients, produce identical pieces. Nothing uses it yet. Story: sc-1582.
The Reed-Solomon arithmetic comes from
klauspost/reedsolomon, a new dependency, which is the library the RFC names.🤖 Generated with Claude Code