MCPcopy Create free account
hub / github.com/akalin/gopar / ComputeParityData

Method ComputeParityData

par1/encoder.go:91–106  ·  view source on GitHub ↗

ComputeParityData computes the parity data for the files.

()

Source from the content-addressed store, hash-verified

89
90// ComputeParityData computes the parity data for the files.
91func (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
108func (e *Encoder) Write(indexPath string) error {
109 var entries []fileEntry

Callers 3

createFunction · 0.45
TestEncodeParityFunction · 0.45
testWriteParityFunction · 0.45

Calls 1

buildShardsMethod · 0.95

Tested by 2

TestEncodeParityFunction · 0.36
testWriteParityFunction · 0.36