worm grace period and retention time support (#6404)

Signed-off-by: lou <alex1988@outlook.com>
This commit is contained in:
Guang Jiong Lou
2025-01-01 10:41:43 +08:00
committed by GitHub
parent 0e8e6122d5
commit 3b1ac77e1f
14 changed files with 831 additions and 707 deletions

View File

@@ -38,11 +38,12 @@ type Entry struct {
// the following is for files
Chunks []*filer_pb.FileChunk `json:"chunks,omitempty"`
HardLinkId HardLinkId
HardLinkCounter int32
Content []byte
Remote *filer_pb.RemoteEntry
Quota int64
HardLinkId HardLinkId
HardLinkCounter int32
Content []byte
Remote *filer_pb.RemoteEntry
Quota int64
WORMEnforcedAtTsNs int64
}
func (entry *Entry) Size() uint64 {
@@ -98,6 +99,7 @@ func (entry *Entry) ToExistingProtoEntry(message *filer_pb.Entry) {
message.Content = entry.Content
message.RemoteEntry = entry.Remote
message.Quota = entry.Quota
message.WormEnforcedAtTsNs = entry.WORMEnforcedAtTsNs
}
func FromPbEntryToExistingEntry(message *filer_pb.Entry, fsEntry *Entry) {
@@ -110,6 +112,7 @@ func FromPbEntryToExistingEntry(message *filer_pb.Entry, fsEntry *Entry) {
fsEntry.Remote = message.RemoteEntry
fsEntry.Quota = message.Quota
fsEntry.FileSize = FileSize(message)
fsEntry.WORMEnforcedAtTsNs = message.WormEnforcedAtTsNs
}
func (entry *Entry) ToProtoFullEntry() *filer_pb.FullEntry {

View File

@@ -190,6 +190,12 @@ func mergePathConf(a, b *filer_pb.FilerConf_PathConf) {
a.DataNode = util.Nvl(b.DataNode, a.DataNode)
a.DisableChunkDeletion = b.DisableChunkDeletion || a.DisableChunkDeletion
a.Worm = b.Worm || a.Worm
if b.WormRetentionTimeSeconds > 0 {
a.WormRetentionTimeSeconds = b.WormRetentionTimeSeconds
}
if b.WormGracePeriodSeconds > 0 {
a.WormGracePeriodSeconds = b.WormGracePeriodSeconds
}
}
func (fc *FilerConf) ToProto() *filer_pb.FilerConf {