lifecycle: Send delete notification when deleting objects (#8416)

master
Anis Elleuch 5 years ago committed by kannappanr
parent 4e63e0e372
commit 26ed9e81b1
  1. 24
      cmd/daily-lifecycle-ops.go

@ -21,6 +21,7 @@ import (
"time" "time"
"github.com/minio/minio/cmd/logger" "github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/lifecycle" "github.com/minio/minio/pkg/lifecycle"
) )
@ -150,8 +151,29 @@ func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error {
// Do nothing, for now. // Do nothing, for now.
} }
} }
// Deletes a list of objects. // Deletes a list of objects.
objAPI.DeleteObjects(ctx, bucket.Name, objects) deleteErrs, err := objAPI.DeleteObjects(ctx, bucket.Name, objects)
if err != nil {
logger.LogIf(ctx, err)
} else {
for i := range deleteErrs {
if deleteErrs[i] != nil {
logger.LogIf(ctx, deleteErrs[i])
continue
}
// Notify object deleted event.
sendEvent(eventArgs{
EventName: event.ObjectRemovedDelete,
BucketName: bucket.Name,
Object: ObjectInfo{
Name: objects[i],
},
Host: "Internal: [ILM-EXPIRY]",
})
}
}
if !res.IsTruncated { if !res.IsTruncated {
// We are done here, proceed to next bucket. // We are done here, proceed to next bucket.
break break

Loading…
Cancel
Save