diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go
index 9aa01f655..ebd6084ee 100644
--- a/cmd/data-scanner.go
+++ b/cmd/data-scanner.go
@@ -1322,7 +1322,7 @@ func applyExpiryOnNonTransitionedObjects(ctx context.Context, objLayer ObjectLay
case lifecycle.DeleteAllVersionsAction:
eventName = event.ObjectRemovedDeleteAllVersions
case lifecycle.DelMarkerDeleteAllVersionsAction:
- eventName = event.ILMDelMarkerExpirationDelete
+ eventName = event.ILMDelObjExpirationDelete
}
// Notify object deleted event.
sendEvent(eventArgs{
diff --git a/cmd/data-scanner_test.go b/cmd/data-scanner_test.go
index 325131e49..ad69f14ec 100644
--- a/cmd/data-scanner_test.go
+++ b/cmd/data-scanner_test.go
@@ -146,7 +146,7 @@ func TestApplyNewerNoncurrentVersionsLimit(t *testing.T) {
}
func TestEvalActionFromLifecycle(t *testing.T) {
- // Tests cover only ExpiredObjectDeleteAllVersions and DelMarkerExpiration actions
+ // Tests cover only ExpiredObjectDeleteAllVersions and DeletedObjectExpiration actions
obj := ObjectInfo{
Name: "foo",
ModTime: time.Now().Add(-31 * 24 * time.Hour),
@@ -177,12 +177,12 @@ func TestEvalActionFromLifecycle(t *testing.T) {
`
delMarkerILM := `
- DelMarkerExpiration
+ DeletedObjectExpiration
Enabled
-
+
60
-
+
`
deleteAllLc, err := lifecycle.ParseLifecycleConfig(strings.NewReader(deleteAllILM))
diff --git a/internal/bucket/lifecycle/delmarker-expiration.go b/internal/bucket/lifecycle/delmarker-expiration.go
index db22d2917..b8e5d8262 100644
--- a/internal/bucket/lifecycle/delmarker-expiration.go
+++ b/internal/bucket/lifecycle/delmarker-expiration.go
@@ -22,23 +22,23 @@ import (
"time"
)
-var errInvalidDaysDelMarkerExpiration = Errorf("Days must be a positive integer with DelMarkerExpiration")
+var errInvalidDaysDeletedObjExpiration = Errorf("Days must be a positive integer with DeletedObjectExpiration")
-// DelMarkerExpiration used to xml encode/decode ILM action by the same name
-type DelMarkerExpiration struct {
- XMLName xml.Name `xml:"DelMarkerExpiration"`
+// DeletedObjectExpiration used to xml encode/decode ILM action by the same name
+type DeletedObjectExpiration struct {
+ XMLName xml.Name `xml:"DeletedObjectExpiration"`
Days int `xml:"Days,omitempty"`
}
-// Empty returns if a DelMarkerExpiration XML element is empty.
-// Used to detect if lifecycle.Rule contained a DelMarkerExpiration element.
-func (de DelMarkerExpiration) Empty() bool {
+// Empty returns if a DeletedObjectExpiration XML element is empty.
+// Used to detect if lifecycle.Rule contained a DeletedObjectExpiration element.
+func (de DeletedObjectExpiration) Empty() bool {
return de.Days == 0
}
-// UnmarshalXML decodes a single XML element into a DelMarkerExpiration value
-func (de *DelMarkerExpiration) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
- type delMarkerExpiration DelMarkerExpiration
+// UnmarshalXML decodes a single XML element into a DeletedObjectExpiration value
+func (de *DeletedObjectExpiration) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
+ type delMarkerExpiration DeletedObjectExpiration
var dexp delMarkerExpiration
err := dec.DecodeElement(&dexp, &start)
if err != nil {
@@ -46,26 +46,26 @@ func (de *DelMarkerExpiration) UnmarshalXML(dec *xml.Decoder, start xml.StartEle
}
if dexp.Days <= 0 {
- return errInvalidDaysDelMarkerExpiration
+ return errInvalidDaysDeletedObjExpiration
}
- *de = DelMarkerExpiration(dexp)
+ *de = DeletedObjectExpiration(dexp)
return nil
}
-// MarshalXML encodes a DelMarkerExpiration value into an XML element
-func (de DelMarkerExpiration) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
+// MarshalXML encodes a DeletedObjectExpiration value into an XML element
+func (de DeletedObjectExpiration) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
if de.Empty() {
return nil
}
- type delMarkerExpiration DelMarkerExpiration
+ type delMarkerExpiration DeletedObjectExpiration
return enc.EncodeElement(delMarkerExpiration(de), start)
}
-// NextDue returns upcoming DelMarkerExpiration date for obj if
+// NextDue returns upcoming DeletedObjectExpiration date for obj if
// applicable, returns false otherwise.
-func (de DelMarkerExpiration) NextDue(obj ObjectOpts) (time.Time, bool) {
+func (de DeletedObjectExpiration) NextDue(obj ObjectOpts) (time.Time, bool) {
if !obj.IsLatest || !obj.DeleteMarker {
return time.Time{}, false
}
diff --git a/internal/bucket/lifecycle/delmarker-expiration_test.go b/internal/bucket/lifecycle/delmarker-expiration_test.go
index 8cba948c7..b0a25400f 100644
--- a/internal/bucket/lifecycle/delmarker-expiration_test.go
+++ b/internal/bucket/lifecycle/delmarker-expiration_test.go
@@ -23,24 +23,24 @@ import (
"testing"
)
-func TestDelMarkerExpParseAndValidate(t *testing.T) {
+func TestDelObjExpParseAndValidate(t *testing.T) {
tests := []struct {
xml string
err error
}{
{
- xml: ` 1 `,
+ xml: ` 1 `,
err: nil,
},
{
- xml: ` -1 `,
- err: errInvalidDaysDelMarkerExpiration,
+ xml: ` -1 `,
+ err: errInvalidDaysDeletedObjExpiration,
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("TestDelMarker-%d", i), func(t *testing.T) {
- var dexp DelMarkerExpiration
+ var dexp DeletedObjectExpiration
var fail bool
err := xml.Unmarshal([]byte(test.xml), &dexp)
if test.err == nil {
diff --git a/internal/bucket/lifecycle/lifecycle.go b/internal/bucket/lifecycle/lifecycle.go
index d6ba7ae11..83d0e78ff 100644
--- a/internal/bucket/lifecycle/lifecycle.go
+++ b/internal/bucket/lifecycle/lifecycle.go
@@ -385,9 +385,9 @@ func (lc Lifecycle) eval(obj ObjectOpts, now time.Time) Event {
}
}
- // DelMarkerExpiration
- if obj.IsLatest && obj.DeleteMarker && !rule.DelMarkerExpiration.Empty() {
- if due, ok := rule.DelMarkerExpiration.NextDue(obj); ok && (now.IsZero() || now.After(due)) {
+ // DeletedObjectExpiration
+ if obj.IsLatest && obj.DeleteMarker && !rule.DeletedObjectExpiration.Empty() {
+ if due, ok := rule.DeletedObjectExpiration.NextDue(obj); ok && (now.IsZero() || now.After(due)) {
events = append(events, Event{
Action: DelMarkerDeleteAllVersionsAction,
RuleID: rule.ID,
@@ -396,7 +396,7 @@ func (lc Lifecycle) eval(obj ObjectOpts, now time.Time) Event {
}
// No other conflicting actions in this rule can apply to an object with current version as DEL marker
// Note: There could be other rules with earlier expiration which need to be considered.
- // See TestDelMarkerExpiration
+ // See TestDeletedObjectExpiration
continue
}
diff --git a/internal/bucket/lifecycle/lifecycle_test.go b/internal/bucket/lifecycle/lifecycle_test.go
index 258d77ed2..ac304de64 100644
--- a/internal/bucket/lifecycle/lifecycle_test.go
+++ b/internal/bucket/lifecycle/lifecycle_test.go
@@ -121,14 +121,14 @@ func TestParseAndValidateLifecycleConfig(t *testing.T) {
},
// Lifecycle with delmarker expiration
{
- inputConfig: `ruleEnabled5`,
+ inputConfig: `ruleEnabled5`,
expectedParsingErr: nil,
expectedValidationErr: nil,
},
// Lifecycle with empty delmarker expiration
{
- inputConfig: `ruleEnabled`,
- expectedParsingErr: errInvalidDaysDelMarkerExpiration,
+ inputConfig: `ruleEnabled`,
+ expectedParsingErr: errInvalidDaysDeletedObjExpiration,
expectedValidationErr: nil,
},
}
@@ -609,15 +609,15 @@ func TestEval(t *testing.T) {
expectedAction: DeleteVersionAction,
},
{
- // DelMarkerExpiration is preferred since object age is past both transition and expiration days.
+ // DeletedObjectExpiration is preferred since object age is past both transition and expiration days.
inputConfig: `
- DelMarkerExpiration with Transition
+ DeletedObjectExpiration with Transition
Enabled
-
+
60
-
+
WARM-1
30
@@ -630,16 +630,16 @@ func TestEval(t *testing.T) {
expectedAction: DelMarkerDeleteAllVersionsAction,
},
{
- // NoneAction since object doesn't qualify for DelMarkerExpiration yet.
+ // NoneAction since object doesn't qualify for DeletedObjectExpiration yet.
// Note: TransitionAction doesn't apply to DEL marker
inputConfig: `
- DelMarkerExpiration with Transition
+ DeletedObjectExpiration with Transition
Enabled
-
+
60
-
+
WARM-1
30
@@ -654,12 +654,12 @@ func TestEval(t *testing.T) {
{
inputConfig: `
- DelMarkerExpiration with non DEL-marker object
+ DeletedObjectExpiration with non DEL-marker object
Enabled
-
+
60
-
+
`,
objectName: "obj-1",
@@ -669,12 +669,12 @@ func TestEval(t *testing.T) {
{
inputConfig: `
- DelMarkerExpiration with noncurrent DEL-marker
+ DeletedObjectExpiration with noncurrent DEL-marker
Enabled
-
+
60
-
+
`,
objectName: "obj-1",
@@ -1381,7 +1381,7 @@ func TestFilterRules(t *testing.T) {
// TestDeleteAllVersions tests ordering among events, especially ones which
// expire all versions like ExpiredObjectDeleteAllVersions and
-// DelMarkerExpiration
+// DeletedObjectExpiration
func TestDeleteAllVersions(t *testing.T) {
// ExpiredObjectDeleteAllVersions
lc := Lifecycle{
@@ -1424,20 +1424,20 @@ func TestDeleteAllVersions(t *testing.T) {
t.Fatalf("Expected due %v but got %v, ruleID=%v", exp, event.Due, event.RuleID)
}
- // DelMarkerExpiration
+ // DeletedObjectExpiration
lc = Lifecycle{
Rules: []Rule{
{
ID: "delmarker-exp-20",
Status: "Enabled",
- DelMarkerExpiration: DelMarkerExpiration{
+ DeletedObjectExpiration: DeletedObjectExpiration{
Days: 20,
},
},
{
ID: "delmarker-exp-10",
Status: "Enabled",
- DelMarkerExpiration: DelMarkerExpiration{
+ DeletedObjectExpiration: DeletedObjectExpiration{
Days: 10,
},
},
diff --git a/internal/bucket/lifecycle/rule.go b/internal/bucket/lifecycle/rule.go
index 67e026b1b..f7d317c53 100644
--- a/internal/bucket/lifecycle/rule.go
+++ b/internal/bucket/lifecycle/rule.go
@@ -33,24 +33,24 @@ const (
// Rule - a rule for lifecycle configuration.
type Rule struct {
- XMLName xml.Name `xml:"Rule"`
- ID string `xml:"ID,omitempty"`
- Status Status `xml:"Status"`
- Filter Filter `xml:"Filter,omitempty"`
- Prefix Prefix `xml:"Prefix,omitempty"`
- Expiration Expiration `xml:"Expiration,omitempty"`
- Transition Transition `xml:"Transition,omitempty"`
- DelMarkerExpiration DelMarkerExpiration `xml:"DelMarkerExpiration,omitempty"`
+ XMLName xml.Name `xml:"Rule"`
+ ID string `xml:"ID,omitempty"`
+ Status Status `xml:"Status"`
+ Filter Filter `xml:"Filter,omitempty"`
+ Prefix Prefix `xml:"Prefix,omitempty"`
+ Expiration Expiration `xml:"Expiration,omitempty"`
+ Transition Transition `xml:"Transition,omitempty"`
+ DeletedObjectExpiration DeletedObjectExpiration `xml:"DeletedObjectExpiration,omitempty"`
// FIXME: add a type to catch unsupported AbortIncompleteMultipartUpload AbortIncompleteMultipartUpload `xml:"AbortIncompleteMultipartUpload,omitempty"`
NoncurrentVersionExpiration NoncurrentVersionExpiration `xml:"NoncurrentVersionExpiration,omitempty"`
NoncurrentVersionTransition NoncurrentVersionTransition `xml:"NoncurrentVersionTransition,omitempty"`
}
var (
- errInvalidRuleID = Errorf("ID length is limited to 255 characters")
- errEmptyRuleStatus = Errorf("Status should not be empty")
- errInvalidRuleStatus = Errorf("Status must be set to either Enabled or Disabled")
- errInvalidRuleDelMarkerExpiration = Errorf("Rule with DelMarkerExpiration cannot have tags based filtering")
+ errInvalidRuleID = Errorf("ID length is limited to 255 characters")
+ errEmptyRuleStatus = Errorf("Status should not be empty")
+ errInvalidRuleStatus = Errorf("Status must be set to either Enabled or Disabled")
+ errInvalidRuleDelObjExpiration = Errorf("Rule with DeletedObjectExpiration cannot have tags based filtering")
)
// validateID - checks if ID is valid or not.
@@ -160,10 +160,10 @@ func (r Rule) Validate() error {
if err := r.validateNoncurrentTransition(); err != nil {
return err
}
- if (!r.Filter.Tag.IsEmpty() || len(r.Filter.And.Tags) != 0) && !r.DelMarkerExpiration.Empty() {
- return errInvalidRuleDelMarkerExpiration
+ if (!r.Filter.Tag.IsEmpty() || len(r.Filter.And.Tags) != 0) && !r.DeletedObjectExpiration.Empty() {
+ return errInvalidRuleDelObjExpiration
}
- if !r.Expiration.set && !r.Transition.set && !r.NoncurrentVersionExpiration.set && !r.NoncurrentVersionTransition.set && r.DelMarkerExpiration.Empty() {
+ if !r.Expiration.set && !r.Transition.set && !r.NoncurrentVersionExpiration.set && !r.NoncurrentVersionTransition.set && r.DeletedObjectExpiration.Empty() {
return errXMLNotWellFormed
}
return nil
diff --git a/internal/bucket/lifecycle/rule_test.go b/internal/bucket/lifecycle/rule_test.go
index f6f139174..2a2a97fb1 100644
--- a/internal/bucket/lifecycle/rule_test.go
+++ b/internal/bucket/lifecycle/rule_test.go
@@ -107,28 +107,28 @@ func TestInvalidRules(t *testing.T) {
},
{
inputXML: `
- Rule with a tag and DelMarkerExpiration
+ Rule with a tag and DeletedObjectExpiration
k1v1
-
+
365
-
+
Enabled
`,
- expectedErr: errInvalidRuleDelMarkerExpiration,
+ expectedErr: errInvalidRuleDelObjExpiration,
},
{
inputXML: `
- Rule with multiple tags and DelMarkerExpiration
+ Rule with multiple tags and DeletedObjectExpiration
k1v1
k2v2
-
+
365
-
+
Enabled
`,
- expectedErr: errInvalidRuleDelMarkerExpiration,
+ expectedErr: errInvalidRuleDelObjExpiration,
},
}
diff --git a/internal/event/name.go b/internal/event/name.go
index 184c10383..12900c3e4 100644
--- a/internal/event/name.go
+++ b/internal/event/name.go
@@ -63,7 +63,7 @@ const (
ObjectManyVersions
ObjectLargeVersions
PrefixManyFolders
- ILMDelMarkerExpirationDelete
+ ILMDelObjExpirationDelete
objectSingleTypesEnd
// Start Compound types that require expansion:
@@ -200,8 +200,8 @@ func (name Name) String() string {
return "s3:ObjectRemoved:NoOP"
case ObjectRemovedDeleteAllVersions:
return "s3:ObjectRemoved:DeleteAllVersions"
- case ILMDelMarkerExpirationDelete:
- return "s3:LifecycleDelMarkerExpiration:Delete"
+ case ILMDelObjExpirationDelete:
+ return "s3:LifecycleDeletedObjectExpiration:Delete"
case ObjectReplicationAll:
return "s3:Replication:*"
case ObjectReplicationFailed:
@@ -327,8 +327,8 @@ func ParseName(s string) (Name, error) {
return ObjectRemovedNoOP, nil
case "s3:ObjectRemoved:DeleteAllVersions":
return ObjectRemovedDeleteAllVersions, nil
- case "s3:LifecycleDelMarkerExpiration:Delete":
- return ILMDelMarkerExpirationDelete, nil
+ case "s3:LifecycleDeletedObjectExpiration:Delete":
+ return ILMDelObjExpirationDelete, nil
case "s3:Replication:*":
return ObjectReplicationAll, nil
case "s3:Replication:OperationFailedReplication":
diff --git a/internal/event/name_test.go b/internal/event/name_test.go
index 7bafa2ee9..66d5e7389 100644
--- a/internal/event/name_test.go
+++ b/internal/event/name_test.go
@@ -69,7 +69,7 @@ func TestNameString(t *testing.T) {
{ObjectRemovedAll, "s3:ObjectRemoved:*"},
{ObjectRemovedDelete, "s3:ObjectRemoved:Delete"},
{ObjectRemovedDeleteAllVersions, "s3:ObjectRemoved:DeleteAllVersions"},
- {ILMDelMarkerExpirationDelete, "s3:LifecycleDelMarkerExpiration:Delete"},
+ {ILMDelObjExpirationDelete, "s3:LifecycleDeletedObjectExpiration:Delete"},
{ObjectRemovedNoOP, "s3:ObjectRemoved:NoOP"},
{ObjectCreatedPutRetention, "s3:ObjectCreated:PutRetention"},
{ObjectCreatedPutLegalHold, "s3:ObjectCreated:PutLegalHold"},
@@ -221,7 +221,7 @@ func TestParseName(t *testing.T) {
{"s3:ObjectAccessed:*", ObjectAccessedAll, false},
{"s3:ObjectRemoved:Delete", ObjectRemovedDelete, false},
{"s3:ObjectRemoved:NoOP", ObjectRemovedNoOP, false},
- {"s3:LifecycleDelMarkerExpiration:Delete", ILMDelMarkerExpirationDelete, false},
+ {"s3:LifecycleDeletedObjectExpiration:Delete", ILMDelObjExpirationDelete, false},
{"", blankName, true},
}