mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
defaulting file ttl to volume ttl
fix https://github.com/chrislusf/seaweedfs/issues/992
This commit is contained in:
parent
06140f9313
commit
c2960c7a86
|
@ -48,6 +48,9 @@ func ReadTTL(ttlString string) (*TTL, error) {
|
|||
|
||||
// read stored bytes to a ttl
|
||||
func LoadTTLFromBytes(input []byte) (t *TTL) {
|
||||
if input[0] == 0 && input[1] == 0 {
|
||||
return EMPTY_TTL
|
||||
}
|
||||
return &TTL{Count: input[0], Unit: input[1]}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,11 @@ func (v *Volume) writeNeedle(n *needle.Needle) (offset uint64, size uint32, isUn
|
|||
return
|
||||
}
|
||||
|
||||
if n.Ttl == needle.EMPTY_TTL && v.Ttl != needle.EMPTY_TTL {
|
||||
n.SetHasTtl()
|
||||
n.Ttl = v.Ttl
|
||||
}
|
||||
|
||||
n.AppendAtNs = uint64(time.Now().UnixNano())
|
||||
if offset, size, _, err = n.Append(v.dataFile, v.Version()); err != nil {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue