Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify MaxChunks applies to ODS #227

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion codecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type Codec interface {
// Decode decodes sparse original + parity data, automatically extracting share size.
// Missing shares must be nil. Returns original + parity data.
Decode(data [][]byte) ([][]byte, error)
// MaxChunks returns the max. number of chunks each code supports in a 2D square.
// MaxChunks returns the max number of chunks this codec supports in a 2D
// original data square.
MaxChunks() int
// Name returns the name of the codec.
Name() string
Expand Down
10 changes: 9 additions & 1 deletion leopard.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,16 @@ func (l *LeoRSCodec) loadOrInitEncoder(dataLen int) (reedsolomon.Encoder, error)
return enc.(reedsolomon.Encoder), nil
}

// MaxChunks returns the max number of chunks this codec supports in a 2D
// original data square.
func (l *LeoRSCodec) MaxChunks() int {
return 32768 * 32768
// klauspost/reedsolomon supports an EDS width of 65536. See:
// https://github.com/klauspost/reedsolomon/blob/523164698be98f1603cf1235f5a1de17728b2091/leopard.go#L42C31-L42C36
maxEDSWidth := 65536
// An EDS width of 65536 is an ODS width of 32768.
maxODSWidth := maxEDSWidth / 2
// The max number of chunks in a 2D original data square is 32768 * 32768.
return maxODSWidth * maxODSWidth
}

func (l *LeoRSCodec) Name() string {
Expand Down