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

Method ShardCounts

par2/decoder.go:615–646  ·  view source on GitHub ↗

ShardCounts returns a ShardCounts object for the current shard set.

()

Source from the content-addressed store, hash-verified

613
614// ShardCounts returns a ShardCounts object for the current shard set.
615func (d *Decoder) ShardCounts() ShardCounts {
616 usableDataShardCount := 0
617 unusableDataShardCount := 0
618
619 for _, info := range d.fileIntegrityInfos {
620 for _, shardInfo := range info.shardInfos {
621 if shardInfo.data == nil {
622 unusableDataShardCount++
623 } else {
624 usableDataShardCount++
625 }
626 }
627 }
628
629 usableParityShardCount := 0
630 unusableParityShardCount := 0
631
632 for _, shard := range d.parityShards {
633 if shard == nil {
634 unusableParityShardCount++
635 } else {
636 usableParityShardCount++
637 }
638 }
639
640 return ShardCounts{
641 UsableDataShardCount: usableDataShardCount,
642 UnusableDataShardCount: unusableDataShardCount,
643 UsableParityShardCount: usableParityShardCount,
644 UnusableParityShardCount: unusableParityShardCount,
645 }
646}
647
648// Repair tries to repair any missing or corrupt data, using the
649// parity volumes. Returns a list of paths to files that were

Callers 6

testCreateFunction · 0.80
verifyFunction · 0.80
testWriteParityFunction · 0.80
testShardCountsFunction · 0.80
testDecoderVerifyFunction · 0.80
TestSetIDMismatchFunction · 0.80

Calls

no outgoing calls

Tested by 5

testCreateFunction · 0.64
testWriteParityFunction · 0.64
testShardCountsFunction · 0.64
testDecoderVerifyFunction · 0.64
TestSetIDMismatchFunction · 0.64