rename proto field from DestroyTime to expire_at_sec

For TTL volume converted into EC volume, this change may leave the volumes staying.
This commit is contained in:
chrislu
2024-10-24 21:35:11 -07:00
parent 1c2b10303a
commit ae5bd0667a
25 changed files with 2052 additions and 2578 deletions

View File

@@ -72,19 +72,16 @@ func (vs *VolumeServer) VolumeEcShardsGenerate(ctx context.Context, req *volume_
}
// write .vif files
var destroyTime uint64
var expireAtSec uint64
if v.Ttl != nil {
ttlMills := v.Ttl.ToSeconds()
if ttlMills > 0 {
destroyTime = uint64(time.Now().Unix()) + v.Ttl.ToSeconds() //calculated destroy time from the ec volume was created
ttlSecond := v.Ttl.ToSeconds()
if ttlSecond > 0 {
expireAtSec = uint64(time.Now().Unix()) + ttlSecond //calculated expiration time
}
}
volumeInfo := &volume_server_pb.VolumeInfo{Version: uint32(v.Version())}
if destroyTime == 0 {
glog.Warningf("gen ec volume,cal ec volume destory time fail,set time to 0,ttl:%v", v.Ttl)
} else {
volumeInfo.DestroyTime = destroyTime
}
volumeInfo.ExpireAtSec = expireAtSec
datSize, _, _ := v.FileStat()
volumeInfo.DatFileSize = int64(datSize)
if err := volume_info.SaveVolumeInfo(baseFileName+".vif", volumeInfo); err != nil {