ComputeParityData computes the parity data for the files.
()
| 89 | |
| 90 | // ComputeParityData computes the parity data for the files. |
| 91 | func (e *Encoder) ComputeParityData() error { |
| 92 | shards := e.buildShards() |
| 93 | |
| 94 | rs, err := reedsolomon.New(len(e.fileData), e.volumeCount, reedsolomon.WithPAR1Matrix()) |
| 95 | if err != nil { |
| 96 | return err |
| 97 | } |
| 98 | |
| 99 | err = rs.Encode(shards) |
| 100 | if err != nil { |
| 101 | return err |
| 102 | } |
| 103 | |
| 104 | e.parityData = shards[len(e.fileData):] |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | func (e *Encoder) Write(indexPath string) error { |
| 109 | var entries []fileEntry |