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

@@ -103,6 +103,26 @@ func (t *TTL) String() string {
return ""
}
func (t *TTL) ToSeconds() uint64 {
switch t.Unit {
case Empty:
return 0
case Minute:
return uint64(t.Count) * 60
case Hour:
return uint64(t.Count) * 60 * 60
case Day:
return uint64(t.Count) * 60 * 24 * 60
case Week:
return uint64(t.Count) * 60 * 24 * 7 * 60
case Month:
return uint64(t.Count) * 60 * 24 * 30 * 60
case Year:
return uint64(t.Count) * 60 * 24 * 365 * 60
}
return 0
}
func toStoredByte(readableUnitByte byte) byte {
switch readableUnitByte {
case 'm':