EC volume supports expiration and displays expiration message when executing volume.list (#5895)

* ec volume expire

* volume.list show DestroyTime

* comments

* code optimization

---------

Co-authored-by: xuwenfeng <xuwenfeng1@zto.com>
This commit is contained in:
augustazz
2024-08-16 15:20:00 +08:00
committed by GitHub
parent 8f1f1730e9
commit 0b00706454
14 changed files with 1189 additions and 1082 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
"github.com/seaweedfs/seaweedfs/weed/storage/types"
"github.com/seaweedfs/seaweedfs/weed/storage/volume_info"
"time"
)
func (v *Volume) GetVolumeInfo() *volume_server_pb.VolumeInfo {
@@ -72,6 +73,12 @@ func (v *Volume) LoadRemoteFile() error {
func (v *Volume) SaveVolumeInfo() error {
tierFileName := v.FileName(".vif")
if v.Ttl != nil {
ttlSeconds := v.Ttl.ToSeconds()
if ttlSeconds > 0 {
v.volumeInfo.DestroyTime = uint64(time.Now().Unix()) + ttlSeconds //calculated destroy time from the ec volume was created
}
}
return volume_info.SaveVolumeInfo(tierFileName, v.volumeInfo)