From 3ea110bb89a7f666de25f8a128fa8bbb231e304f Mon Sep 17 00:00:00 2001 From: kchheda3 Date: Tue, 27 Feb 2024 14:24:43 -0500 Subject: [PATCH] rgw/notification: Make the Replication events to be aws compatible. Signed-off-by: kchheda3 --- doc/radosgw/s3-notification-compatibility.rst | 8 ++++++++ src/rgw/driver/rados/rgw_cr_rados.cc | 11 +++++++---- src/rgw/rgw_notify_event_type.cc | 16 ++++++++++++++++ src/rgw/rgw_notify_event_type.h | 6 +++++- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/doc/radosgw/s3-notification-compatibility.rst b/doc/radosgw/s3-notification-compatibility.rst index b29989977b231..31b218456bd8e 100644 --- a/doc/radosgw/s3-notification-compatibility.rst +++ b/doc/radosgw/s3-notification-compatibility.rst @@ -113,6 +113,14 @@ Event Types +--------------------------------------------------------+-----------------------------------------+ | ``s3:ObjectSynced:DeletionMarkerCreated`` | Defined, Ceph extension (not generated) | +--------------------------------------------------------+-----------------------------------------+ +| ``s3:Replication:*`` | Supported | ++--------------------------------------------------------+-----------------------------------------+ +| ``s3:Replication:Create`` | Supported | ++--------------------------------------------------------+-----------------------------------------+ +| ``s3:Replication:Delete`` | Defined, Supported (not generated) | ++--------------------------------------------------------+-----------------------------------------+ +| ``s3:Replication:DeletionMarkerCreated`` | Defined, Supported (not generated) | ++--------------------------------------------------------+-----------------------------------------+ | ``s3:ObjectRestore:Post`` | Not applicable | +--------------------------------------------------------+-----------------------------------------+ | ``s3:ObjectRestore:Complete`` | Not applicable | diff --git a/src/rgw/driver/rados/rgw_cr_rados.cc b/src/rgw/driver/rados/rgw_cr_rados.cc index a6d4719e71864..7e4164ff7dde5 100644 --- a/src/rgw/driver/rados/rgw_cr_rados.cc +++ b/src/rgw/driver/rados/rgw_cr_rados.cc @@ -806,15 +806,18 @@ int RGWAsyncFetchRemoteObj::_send_request(const DoutPrefixProvider *dpp) std::string tenant(dest_bucket.get_tenant()); std::unique_ptr notify = - store->get_notification( - dpp, &dest_obj, nullptr, {rgw::notify::ObjectSyncedCreate}, - &dest_bucket, user_id, tenant, req_id, null_yield); + store->get_notification(dpp, &dest_obj, nullptr, + {rgw::notify::ObjectSyncedCreate, + rgw::notify::ReplicationCreate}, + &dest_bucket, user_id, tenant, req_id, + null_yield); auto notify_res = static_cast(notify.get()) ->get_reservation(); int ret = rgw::notify::publish_reserve( - dpp, *store->svc()->site, {rgw::notify::ObjectSyncedCreate}, + dpp, *store->svc()->site, + {rgw::notify::ObjectSyncedCreate, rgw::notify::ReplicationCreate}, notify_res, &obj_tags); if (ret < 0) { ldpp_dout(dpp, 1) diff --git a/src/rgw/rgw_notify_event_type.cc b/src/rgw/rgw_notify_event_type.cc index d36e10c9c2d3b..9baa5df798bda 100644 --- a/src/rgw/rgw_notify_event_type.cc +++ b/src/rgw/rgw_notify_event_type.cc @@ -58,6 +58,14 @@ namespace rgw::notify { return "s3:LifecycleExpiration:DeleteMarkerCreated"; case LifecycleTransition: return "s3:LifecycleTransition"; + case Replication: + return "s3:Replication:*"; + case ReplicationCreate: + return "s3:Replication:Create"; + case ReplicationDelete: + return "s3:Replication:Delete"; + case ReplicationDeletionMarkerCreated: + return "s3:Replication:DeletionMarkerCreated"; case UnknownEvent: return "s3:UnknownEvent"; } @@ -119,6 +127,14 @@ namespace rgw::notify { return LifecycleExpirationDeleteMarkerCreated; if (s == "s3:LifecycleTransition") return LifecycleTransition; + if (s == "s3:Replication:*") + return Replication; + if (s == "s3:Replication:Create") + return ReplicationCreate; + if (s == "s3:Replication:Delete") + return ReplicationDelete; + if (s == "s3:Replication:DeletionMarkerCreated") + return ReplicationDeletionMarkerCreated; return UnknownEvent; } diff --git a/src/rgw/rgw_notify_event_type.h b/src/rgw/rgw_notify_event_type.h index d7f70682d1627..34a73d2299799 100644 --- a/src/rgw/rgw_notify_event_type.h +++ b/src/rgw/rgw_notify_event_type.h @@ -33,7 +33,11 @@ namespace rgw::notify { LifecycleExpirationDelete = 0x100000, LifecycleExpirationDeleteMarkerCreated = 0x200000, LifecycleTransition = 0xF000000, - UnknownEvent = 0x10000000 + Replication = 0xF0000000, + ReplicationCreate = 0x10000000, + ReplicationDelete = 0x20000000, + ReplicationDeletionMarkerCreated = 0x40000000, + UnknownEvent = 0x100000000 }; using EventTypeList = std::vector; -- 2.39.5