|
|
@ -51,6 +51,11 @@ func startDailyLifecycle(ctx context.Context, objAPI ObjectLayer) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error { |
|
|
|
func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error { |
|
|
|
|
|
|
|
// No action is expected when WORM is enabled
|
|
|
|
|
|
|
|
if globalWORMEnabled { |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
buckets, err := objAPI.ListBuckets(ctx) |
|
|
|
buckets, err := objAPI.ListBuckets(ctx) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
@ -63,6 +68,8 @@ func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error { |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, bucketHasLockConfig := globalBucketObjectLockConfig.Get(bucket.Name) |
|
|
|
|
|
|
|
|
|
|
|
// Calculate the common prefix of all lifecycle rules
|
|
|
|
// Calculate the common prefix of all lifecycle rules
|
|
|
|
var prefixes []string |
|
|
|
var prefixes []string |
|
|
|
for _, rule := range l.Rules { |
|
|
|
for _, rule := range l.Rules { |
|
|
@ -85,9 +92,11 @@ func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error { |
|
|
|
// Reached maximum delete requests, attempt a delete for now.
|
|
|
|
// Reached maximum delete requests, attempt a delete for now.
|
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Find the action that need to be executed
|
|
|
|
// Find the action that need to be executed
|
|
|
|
if l.ComputeAction(obj.Name, obj.UserTags, obj.ModTime) == lifecycle.DeleteAction { |
|
|
|
if l.ComputeAction(obj.Name, obj.UserTags, obj.ModTime) == lifecycle.DeleteAction { |
|
|
|
|
|
|
|
if bucketHasLockConfig && enforceRetentionForLifecycle(ctx, obj) { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
objects = append(objects, obj.Name) |
|
|
|
objects = append(objects, obj.Name) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|