ShardCounts returns a ShardCounts object for the current shard set.
()
| 613 | |
| 614 | // ShardCounts returns a ShardCounts object for the current shard set. |
| 615 | func (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 |
no outgoing calls