]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgwlc: harmonize lifecycle notifications with the others
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 22 Dec 2021 18:33:52 +0000 (13:33 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Tue, 4 Jan 2022 14:26:16 +0000 (09:26 -0500)
After working with notification configurations, it seemed to make
more sense to organize the different lifecycle notification sub-types
along the same lines as the official AWS ones.  So, there are now
ObjectExpirationCurrent and ObjectExpirationNoncurrent types, and
an ObjectExpiration wildcard.  Similarly, ObjectTransition
contains Current and Noncurrent sub-types.

Note that I have defined an ObjectExpirationAbortMPU notification
sub-type, but do not currently generate it--this is to avoid changing
the rgw::sal interface, but most likely we would support this in
future.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
doc/radosgw/s3-notification-compatibility.rst
src/rgw/rgw_lc.cc
src/rgw/rgw_notify_event_type.cc
src/rgw/rgw_notify_event_type.h

index bb2cfb31393b3533b95b20231d824667ae7a98a3..d0259d1bb20f73265683726e75c3faefb067b629 100644 (file)
@@ -79,31 +79,43 @@ However, the following fields may be sent empty, under the different deployment
 Event Types
 -----------
 
-+----------------------------------------------+-----------------+-------------------------------------------+
-| Event                                        | Notification    | PubSub                                    |
-+==============================================+=================+===========================================+
-| ``s3:ObjectCreated:*``                       | Supported                                                   |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectCreated:Put``                     | Supported       | Supported at ``s3:ObjectCreated:*`` level |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectCreated:Post``                    | Supported       | Not Supported                             |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectCreated:Copy``                    | Supported       | Supported at ``s3:ObjectCreated:*`` level |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectCreated:CompleteMultipartUpload`` | Supported       | Supported at ``s3:ObjectCreated:*`` level |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectRemoved:*``                       | Supported       | Supported only the specific events below  |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectRemoved:Delete``                  | Supported                                                   |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectRemoved:DeleteMarkerCreated``     | Supported                                                   |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectRestore:Post``                    | Not applicable to Ceph                                      |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ObjectRestore:Complete``                | Not applicable to Ceph                                      |
-+----------------------------------------------+-----------------+-------------------------------------------+
-| ``s3:ReducedRedundancyLostObject``           | Not applicable to Ceph                                      |
-+----------------------------------------------+-----------------+-------------------------------------------+
++------------------------------------------------+-----------------+-------------------------------------------+
+| Event                                          | Notification    | PubSub                                    |
++================================================+=================+===========================================+
+| ``s3:ObjectCreated:*``                         | Supported                                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectCreated:Put``                       | Supported       | Supported at ``s3:ObjectCreated:*`` level |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectCreated:Post``                      | Supported       | Not Supported                             |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectCreated:Copy``                      | Supported       | Supported at ``s3:ObjectCreated:*`` level |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectCreated:CompleteMultipartUpload``   | Supported       | Supported at ``s3:ObjectCreated:*`` level |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectRemoved:*``                         | Supported       | Supported only the specific events below  |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectRemoved:Delete``                    | Supported                                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectRemoved:DeleteMarkerCreated``       | Supported                                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectLifecycle:Expiration:Current``      | Supported, Ceph extension                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectLifecycle:Expiration:NonCurrent``   | Supported, Ceph extension                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectLifecycle:Expiration:DeleteMarker`` | Supported, Ceph extension                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectLifecycle:Expiration:AbortMultipartUpload`` | Defined, Ceph extension (not generated)             |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectLifecycle:Transition:Current``      | Supported, Ceph extension                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectLifecycle:Transition:NonCurrent``   | Supported, Ceph extension                                   |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectRestore:Post``                      | Not applicable to Ceph                                      |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ObjectRestore:Complete``                  | Not applicable to Ceph                                      |
++------------------------------------------------+-----------------+-------------------------------------------+
+| ``s3:ReducedRedundancyLostObject``             | Not applicable to Ceph                                      |
++----------------------------------------------+-----------------+---------------------------------------------+
 
 .. note:: 
 
index 2f8d381ddf50e438c278f0a1feea6da1ee3f43f0..9af8422d6f290cf08428447fbd1c8e0638d1f49f 100644 (file)
@@ -1117,7 +1117,7 @@ public:
     int r;
     if (o.is_delete_marker()) {
       r = remove_expired_obj(oc.dpp, oc, true,
-                            rgw::notify::ObjectDeleteMarkerExpiration);
+                            rgw::notify::ObjectExpirationDeleteMarker);
       if (r < 0) {
        ldpp_dout(oc.dpp, 0) << "ERROR: current is-dm remove_expired_obj "
                         << oc.bucket << ":" << o.key
@@ -1131,7 +1131,7 @@ public:
     } else {
       /* ! o.is_delete_marker() */
       r = remove_expired_obj(oc.dpp, oc, !oc.bucket->versioned(),
-                            rgw::notify::ObjectExpiration);
+                            rgw::notify::ObjectExpirationCurrent);
       if (r < 0) {
        ldpp_dout(oc.dpp, 0) << "ERROR: remove_expired_obj "
                         << oc.bucket << ":" << o.key
@@ -1179,7 +1179,7 @@ public:
   int process(lc_op_ctx& oc) {
     auto& o = oc.o;
     int r = remove_expired_obj(oc.dpp, oc, true,
-                              rgw::notify::ObjectNoncurrentExpiration);
+                              rgw::notify::ObjectExpirationNoncurrent);
     if (r < 0) {
       ldpp_dout(oc.dpp, 0) << "ERROR: remove_expired_obj (non-current expiration) " 
                       << oc.bucket << ":" << o.key
@@ -1224,7 +1224,7 @@ public:
   int process(lc_op_ctx& oc) {
     auto& o = oc.o;
     int r = remove_expired_obj(oc.dpp, oc, true,
-                              rgw::notify::ObjectDeleteMarkerExpiration);
+                              rgw::notify::ObjectExpirationDeleteMarker);
     if (r < 0) {
       ldpp_dout(oc.dpp, 0) << "ERROR: remove_expired_obj (delete marker expiration) "
                       << oc.bucket << ":" << o.key
index fd1dc8538f09aaea7d6394e1fad89fdb7e76f3b9..059cfc3469a8862e28108211c36177d2072bc04a 100644 (file)
@@ -24,12 +24,24 @@ namespace rgw::notify {
       return "s3:ObjectRemoved:Delete";
     case ObjectRemovedDeleteMarkerCreated:
       return "s3:ObjectRemoved:DeleteMarkerCreated";
+    case ObjectLifecycle:
+      return "s3:ObjectLifecycle:*";
     case ObjectExpiration:
-      return "s3:ObjectLifecycle:Expiration";
-    case ObjectNoncurrentExpiration:
-      return "s3:ObjectLifecycle:NoncurrentExpiration";
-    case ObjectDeleteMarkerExpiration:
-      return "s3:ObjectLifecycle:DeleteMarkerExpiration";
+      return "s3:ObjectLifecycle:Expiration:*";
+    case ObjectExpirationCurrent:
+      return "s3:ObjectLifecycle:Expiration:Current";
+    case ObjectExpirationNoncurrent:
+      return "s3:ObjectLifecycle:Expiration:Noncurrent";
+    case ObjectExpirationDeleteMarker:
+      return "s3:ObjectLifecycle:Expiration:DeleteMarker";
+    case ObjectExpirationAbortMPU:
+      return "s3:ObjectLifecycle:Expiration:AbortMPU";
+    case ObjectTransition:
+      return "s3:ObjectLifecycle:Transition:*";
+    case ObjectTransitionCurrent:
+      return "s3:ObjectLifecycle:Transition:Current";
+    case ObjectTransitionNoncurrent:
+      return "s3:ObjectLifecycle:Transition:Noncurrent";
     case UnknownEvent:
         return "s3:UnknownEvent";
     }
@@ -48,10 +60,18 @@ namespace rgw::notify {
       return "OBJECT_DELETE";
     case ObjectRemovedDeleteMarkerCreated:
       return "DELETE_MARKER_CREATE";
+    case ObjectLifecycle:
+      return "OBJECT_LIFECYCLE";
     case ObjectExpiration:
-    case ObjectNoncurrentExpiration:
-    case ObjectDeleteMarkerExpiration:
+    case ObjectExpirationCurrent:
+    case ObjectExpirationNoncurrent:
+    case ObjectExpirationDeleteMarker:
+    case ObjectExpirationAbortMPU:
       return "OBJECT_EXPIRATION";
+    case ObjectTransition:
+    case ObjectTransitionCurrent:
+    case ObjectTransitionNoncurrent:
+      return "OBJECT_TRANSITION";
     case ObjectRemoved:
     case UnknownEvent:
       return "UNKNOWN_EVENT";
@@ -80,6 +100,24 @@ namespace rgw::notify {
         return ObjectRemovedDelete;
     if (s == "s3:ObjectRemoved:DeleteMarkerCreated" || s == "DELETE_MARKER_CREATE")
         return ObjectRemovedDeleteMarkerCreated;
+    if (s == "s3:ObjectLifecycle:*")
+        return ObjectLifecycle;
+    if (s == "s3:ObjectLifecycle:Expiration:*" || s == "OBJECT_EXPIRATION")
+        return ObjectExpiration;
+    if (s == "s3:ObjectLifecycle:Expiration:Current")
+        return ObjectExpirationCurrent;
+    if (s == "s3:ObjectLifecycle:Expiration:Noncurrent")
+        return ObjectExpirationNoncurrent;
+    if (s == "s3:ObjectLifecycle:Expiration:DeleteMarker")
+        return ObjectExpirationDeleteMarker;
+    if (s == "s3:ObjectLifecycle:Expiration:AbortMultipartUpload")
+        return ObjectExpirationAbortMPU;
+    if (s == "s3:ObjectLifecycle:Transition:*" || s == "OBJECT_TRANSITION")
+        return ObjectTransition;
+    if (s == "s3:ObjectLifecycle:Transition:Current")
+        return ObjectTransitionCurrent;
+    if (s == "s3:ObjectLifecycle:Transition:Noncurrent")
+        return ObjectTransitionNoncurrent;
     return UnknownEvent;
   }
 
index 89e3e2545500a9af20f7a23088fea817595af486..bbfff88f5e169a2fc29918fc8e29ad7e40d97c92 100644 (file)
@@ -16,10 +16,16 @@ namespace rgw::notify {
     ObjectRemovedDelete                  = 0x10,
     ObjectRemovedDeleteMarkerCreated     = 0x20,
     // lifecycle events (RGW extension)
-    ObjectExpiration                     = 0x40,
-    ObjectNoncurrentExpiration           = 0x80,
-    ObjectDeleteMarkerExpiration         = 0x100,
-    UnknownEvent                         = 0x200
+    ObjectLifecycle                       = 0xFF00,
+    ObjectExpiration                     = 0xF00,
+    ObjectExpirationCurrent              = 0x100,
+    ObjectExpirationNoncurrent           = 0x200,
+    ObjectExpirationDeleteMarker         = 0x400,
+    ObjectExpirationAbortMPU             = 0x800,
+    ObjectTransition                     = 0xF000,
+    ObjectTransitionCurrent              = 0x1000,
+    ObjectTransitionNoncurrent           = 0x2000,
+    UnknownEvent                         = 0x10000
   };
 
   using EventTypeList = std::vector<EventType>;