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

Method FileCounts

par1/decoder.go:333–362  ·  view source on GitHub ↗

FileCounts returns a FileCounts object for the current file set.

()

Source from the content-addressed store, hash-verified

331
332// FileCounts returns a FileCounts object for the current file set.
333func (d *Decoder) FileCounts() FileCounts {
334 usableDataFileCount := 0
335 unusableDataFileCount := 0
336
337 for _, data := range d.fileData {
338 if data == nil {
339 unusableDataFileCount++
340 } else {
341 usableDataFileCount++
342 }
343 }
344
345 usableParityFileCount := 0
346 unusableParityFileCount := 0
347
348 for _, data := range d.parityData {
349 if data == nil {
350 unusableParityFileCount++
351 } else {
352 usableParityFileCount++
353 }
354 }
355
356 return FileCounts{
357 UsableDataFileCount: usableDataFileCount,
358 UnusableDataFileCount: unusableDataFileCount,
359 UsableParityFileCount: usableParityFileCount,
360 UnusableParityFileCount: unusableParityFileCount,
361 }
362}
363
364// VerifyAllData checks and returns whether all data and parity files
365// contain correct data. Note that this is worth calling only when

Callers 2

verifyFunction · 0.80
testFileCountsFunction · 0.80

Calls

no outgoing calls

Tested by 1

testFileCountsFunction · 0.64