aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location_ec.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/disk_location_ec.go')
-rw-r--r--weed/storage/disk_location_ec.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go
index ee21eb803..5af354277 100644
--- a/weed/storage/disk_location_ec.go
+++ b/weed/storage/disk_location_ec.go
@@ -38,6 +38,22 @@ func (l *DiskLocation) DestroyEcVolume(vid needle.VolumeId) {
}
}
+func (l *DiskLocation) CollectEcShards(vid needle.VolumeId, shardFileNames []string) (ecVolume *erasure_coding.EcVolume, found bool) {
+ l.ecVolumesLock.RLock()
+ defer l.ecVolumesLock.RUnlock()
+
+ ecVolume, found = l.ecVolumes[vid]
+ if !found {
+ return
+ }
+ for _, ecShard := range ecVolume.Shards {
+ if ecShard.ShardId < erasure_coding.ShardId(len(shardFileNames)) {
+ shardFileNames[ecShard.ShardId] = erasure_coding.EcShardFileName(ecVolume.Collection, l.Directory, int(ecVolume.VolumeId)) + erasure_coding.ToExt(int(ecShard.ShardId))
+ }
+ }
+ return
+}
+
func (l *DiskLocation) FindEcShard(vid needle.VolumeId, shardId erasure_coding.ShardId) (*erasure_coding.EcVolumeShard, bool) {
l.ecVolumesLock.RLock()
defer l.ecVolumesLock.RUnlock()