Implement RPC skeleton for regular/EC volumes scrubbing. (#8187)
* Implement RPC skeleton for regular/EC volumes scrubbing. See https://github.com/seaweedfs/seaweedfs/issues/8018 for details. * Minor proto improvements for `ScrubVolume()`, `ScrubEcVolume()`: - Add fields for scrubbing details in `ScrubVolumeResponse` and `ScrubEcVolumeResponse`, instead of reporting these through RPC errors. - Return a list of broken shards when scrubbing EC volumes, via `EcShardInfo'.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -395,6 +396,38 @@ func (l *DiskLocation) FindVolume(vid needle.VolumeId) (*Volume, bool) {
|
||||
return v, ok
|
||||
}
|
||||
|
||||
// Returns all regular volume IDs stored at this location.
|
||||
func (l *DiskLocation) VolumeIds() []needle.VolumeId {
|
||||
l.volumesLock.RLock()
|
||||
defer l.volumesLock.RUnlock()
|
||||
|
||||
vids := make([]needle.VolumeId, len(l.volumes))
|
||||
i := 0
|
||||
for vid := range l.volumes {
|
||||
vids[i] = vid
|
||||
i++
|
||||
}
|
||||
|
||||
slices.Sort(vids)
|
||||
return vids
|
||||
}
|
||||
|
||||
// Returns all EC volume IDs stored at this location.
|
||||
func (l *DiskLocation) EcVolumeIds() []needle.VolumeId {
|
||||
l.ecVolumesLock.RLock()
|
||||
defer l.ecVolumesLock.RUnlock()
|
||||
|
||||
vids := make([]needle.VolumeId, len(l.ecVolumes))
|
||||
i := 0
|
||||
for vid := range l.ecVolumes {
|
||||
vids[i] = vid
|
||||
i++
|
||||
}
|
||||
|
||||
slices.Sort(vids)
|
||||
return vids
|
||||
}
|
||||
|
||||
func (l *DiskLocation) VolumesLen() int {
|
||||
l.volumesLock.RLock()
|
||||
defer l.volumesLock.RUnlock()
|
||||
|
||||
Reference in New Issue
Block a user