Browse Source

refactor: use EcShardConfig message instead of separate fields

pull/7396/head
chrislu 1 month ago
parent
commit
7515c6d910
  1. 9
      weed/pb/volume_server.proto
  2. 520
      weed/pb/volume_server_pb/volume_server.pb.go
  3. 6
      weed/server/volume_grpc_erasure_coding.go

9
weed/pb/volume_server.proto

@ -525,8 +525,13 @@ message VolumeInfo {
int64 dat_file_size = 5; // store the original dat file size
uint64 expire_at_sec = 6; // expiration time of ec volume
bool read_only = 7;
uint32 data_shards_count = 8; // EC data shards (0 = use default 10)
uint32 parity_shards_count = 9; // EC parity shards (0 = use default 4)
EcShardConfig ec_shard_config = 8; // EC shard configuration (optional, null = use default 10+4)
}
// EcShardConfig specifies erasure coding shard configuration
message EcShardConfig {
uint32 data_shards = 1; // Number of data shards (e.g., 10)
uint32 parity_shards = 2; // Number of parity shards (e.g., 4)
}
message OldVersionVolumeInfo {
repeated RemoteFile files = 1;

520
weed/pb/volume_server_pb/volume_server.pb.go
File diff suppressed because it is too large
View File

6
weed/server/volume_grpc_erasure_coding.go

@ -90,8 +90,10 @@ func (vs *VolumeServer) VolumeEcShardsGenerate(ctx context.Context, req *volume_
volumeInfo.DatFileSize = int64(datSize)
// Save EC configuration to VolumeInfo
volumeInfo.DataShardsCount = uint32(ecCtx.DataShards)
volumeInfo.ParityShardsCount = uint32(ecCtx.ParityShards)
volumeInfo.EcShardConfig = &volume_server_pb.EcShardConfig{
DataShards: uint32(ecCtx.DataShards),
ParityShards: uint32(ecCtx.ParityShards),
}
if err := volume_info.SaveVolumeInfo(baseFileName+".vif", volumeInfo); err != nil {
return nil, fmt.Errorf("SaveVolumeInfo %s: %v", baseFileName, err)

Loading…
Cancel
Save