SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Fix https://github.com/chrislusf/seaweedfs/issues/861
chenwanlifd27ed775591
diff --git a/weed/storage/volume_ttl.go b/weed/storage/volume_ttl.goindex 4318bb0487..0989e7a496 100644--- a/weed/storage/volume_ttl.go+++ b/weed/storage/volume_ttl.go@@ -16,8 +16,8 @@ const ()type TTL struct {- count byte- unit byte+ Count byte+ Unit byte}var EMPTY_TTL = &TTL{}@@ -43,12 +43,12 @@ func ReadTTL(ttlString string) (*TTL, error) {}count, err := strconv.Atoi(string(countBytes))unit := toStoredByte(unitByte)- return &TTL{count: byte(count), unit: unit}, err+ return &TTL{Count: byte(count), Unit: unit}, err}// read stored bytes to a ttlfunc LoadTTLFromBytes(input []byte) (t *TTL) {- return &TTL{count: input[0], unit: input[1]}+ return &TTL{Count: input[0], Unit: input[1]}}// read stored bytes to a ttl@@ -61,25 +61,25 @@ func LoadTTLFromUint32(ttl uint32) (t *TTL) {// save stored bytes to an output with 2 bytesfunc (t *TTL) ToBytes(output []byte) {- output[0] = t.count- output[1] = t.unit+ output[0] = t.Count+ output[1] = t.Unit}func (t *TTL) ToUint32() (output uint32) {- output = uint32(t.count) << 8- output += uint32(t.unit)+ output = uint32(t.Count) << 8+ output += uint32(t.Unit)return output}func (t *TTL) String() string {- if t == nil || t.count == 0 {+ if t == nil || t.Count == 0 {return ""}- if t.unit == Empty {+ if t.Unit == Empty {return ""}- countString := strconv.Itoa(int(t.count))- switch t.unit {+ countString := strconv.Itoa(int(t.Count))+ switch t.Unit {case Minute:return countString + "m"case Hour:@@ -115,21 +115,21 @@ func toStoredByte(readableUnitByte byte) byte {}func (t TTL) Minutes() uint32 {- switch t.unit {+ switch t.Unit {case Empty:return 0case Minute:- return uint32(t.count)+ return uint32(t.Count)case Hour:- return uint32(t.count) * 60+ return uint32(t.Count) * 60case Day:- return uint32(t.count) * 60 * 24+ return uint32(t.Count) * 60 * 24case Week:- return uint32(t.count) * 60 * 24 * 7+ return uint32(t.Count) * 60 * 24 * 7case Month:- return uint32(t.count) * 60 * 24 * 31+ return uint32(t.Count) * 60 * 24 * 31case Year:- return uint32(t.count) * 60 * 24 * 365+ return uint32(t.Count) * 60 * 24 * 365}return 0}