diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-27 01:29:46 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-27 01:29:46 -0700 |
| commit | a4f3d82c57bca13321dca257891836ff36c7eca5 (patch) | |
| tree | f65ffa52266d7ecc0d867c7bcdc404202e59a0f4 /weed/storage/disk_location_ec.go | |
| parent | a463759edfbfafa04b3ae85ccb59ee27a6045ad4 (diff) | |
| download | seaweedfs-a4f3d82c57bca13321dca257891836ff36c7eca5.tar.xz seaweedfs-a4f3d82c57bca13321dca257891836ff36c7eca5.zip | |
convert needle id to ec intervals to read from
Diffstat (limited to 'weed/storage/disk_location_ec.go')
| -rw-r--r-- | weed/storage/disk_location_ec.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index 05acbb98b..e91c0f262 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -16,6 +16,17 @@ var ( re = regexp.MustCompile("\\.ec[0-9][0-9]") ) +func (l *DiskLocation) HasEcShard(vid needle.VolumeId) (erasure_coding.EcVolumeShards, bool) { + l.ecShardsLock.RLock() + defer l.ecShardsLock.RUnlock() + + ecShards, ok := l.ecShards[vid] + if ok { + return ecShards, true + } + return nil, false +} + func (l *DiskLocation) FindEcShard(vid needle.VolumeId, shardId erasure_coding.ShardId) (*erasure_coding.EcVolumeShard, bool) { l.ecShardsLock.RLock() defer l.ecShardsLock.RUnlock() |
