Files
seaweedfs/weed/storage/erasure_coding/ec_volume_info.go
T
ef4c9d9178 filter volume by local or remote storage name (#10946)
* filter volume by local or remote storage name

Signed-off-by: lou <alex1988@outlook.com>

* fix SelectsEverything

Signed-off-by: lou <alex1988@outlook.com>

* keep the proto sync out of this change

The branch copied weed/pb/*.proto over their seaweed-volume and Java
counterparts and regenerated every .pb.go with a different protoc and
protoc-gen-go-grpc. DiskStatus.error arriving that way broke the Rust
build, and the rest is toolchain churn in files this change has nothing
to say about.

---------

Signed-off-by: lou <alex1988@outlook.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Chris Lu <chris.lu@gmail.com>
2026-08-25 13:05:33 -07:00

70 lines
2.2 KiB
Go

package erasure_coding
import (
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
)
// data structure used in master
type EcVolumeInfo struct {
VolumeId needle.VolumeId
Collection string
DiskType string
DiskId uint32 // ID of the disk this EC volume is on
ExpireAtSec uint64 // ec volume destroy time, calculated from the ec volume was created
ShardsInfo *ShardsInfo
FileCount uint64 // live needle count for this EC volume (same on every node holding shards)
DeleteCount uint64 // tombstoned needle count for this EC volume
EncodeTsNs int64 // encode-run identity (unix nanos); one value per (volume, disk)
}
// DataShardsOrDefault returns how many of this volume's shards hold data; shard
// ids below it are data, the rest are parity. Open-source SeaweedFS always uses
// the fixed 10+4 layout, so this returns DataShardsCount. It is a per-volume
// accessor, like EcShardsVolumeDataShards, so callers stay correct on builds
// that derive the ratio per volume.
func (ecInfo *EcVolumeInfo) DataShardsOrDefault() int {
return DataShardsCount
}
func (ecInfo *EcVolumeInfo) Minus(other *EcVolumeInfo) *EcVolumeInfo {
return &EcVolumeInfo{
VolumeId: ecInfo.VolumeId,
Collection: ecInfo.Collection,
ShardsInfo: ecInfo.ShardsInfo.Minus(other.ShardsInfo),
DiskType: ecInfo.DiskType,
DiskId: ecInfo.DiskId,
ExpireAtSec: ecInfo.ExpireAtSec,
FileCount: ecInfo.FileCount,
DeleteCount: ecInfo.DeleteCount,
EncodeTsNs: ecInfo.EncodeTsNs,
}
}
func (evi *EcVolumeInfo) ToVolumeEcShardInformationMessage() (ret *master_pb.VolumeEcShardInformationMessage) {
return &master_pb.VolumeEcShardInformationMessage{
Id: uint32(evi.VolumeId),
EcIndexBits: evi.ShardsInfo.Bitmap(),
ShardSizes: evi.ShardsInfo.SizesInt64(),
Collection: evi.Collection,
DiskType: evi.DiskType,
ExpireAtSec: evi.ExpireAtSec,
DiskId: evi.DiskId,
FileCount: evi.FileCount,
DeleteCount: evi.DeleteCount,
EncodeTsNs: evi.EncodeTsNs,
}
}
func (evi *EcVolumeInfo) GetCollection() string {
return evi.Collection
}
func (evi *EcVolumeInfo) GetVolumeId() needle.VolumeId {
return evi.VolumeId
}
func (evi *EcVolumeInfo) GetRemoteStorageName() string {
return ""
}