klauspost / reedsolomon

Reed-Solomon Erasure Coding in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider allowing reconstructSome to compute parity shards

walldiss opened this issue · comments

commented

Context

Based on doc, currently ReconstructSome allows to reconstruct only data shards:

// ReconstructSome will recreate only requested data shards, if possible.
//
// Given a list of shards, some of which contain data, fills in the
// data shards indicated by true values in the "required" parameter.
// The length of "required" array must be equal to DataShards.

While using it, I've found that function api is well suited to compute parity shards also. So limitation comes mostly from doc and some underlying implementation params.

ReconstructSome(shards [][]byte, required []bool) error

Proposal

Functionality of ReconstructSome might be extended to allow to compute parity shards as well as data shards. It would consume required array, that might contain indexes of parity shards.
There will be no need to change function signature, so backwards compatibility will remain.