From c299f78fbff7a0df2c1452c509da23f3360a6447 Mon Sep 17 00:00:00 2001 From: Dave Kwon Date: Wed, 18 Sep 2024 15:56:39 -0700 Subject: [PATCH] Hide dynamic versions of AnyPatch::patchIfTypeIs and AnyPatch::ensureAndPatch Summary: use the same badge Reviewed By: Mizuchi Differential Revision: D62903158 fbshipit-source-id: 8466e1f7dbedbfcf00d88d4079af6860a701031e --- thrift/lib/thrift/detail/AnyPatch.h | 14 ++++++++++++-- thrift/lib/thrift/detail/DynamicPatch.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/thrift/lib/thrift/detail/AnyPatch.h b/thrift/lib/thrift/detail/AnyPatch.h index 2f6a0bf79db..cd730f52868 100644 --- a/thrift/lib/thrift/detail/AnyPatch.h +++ b/thrift/lib/thrift/detail/AnyPatch.h @@ -29,6 +29,14 @@ namespace apache { namespace thrift { +namespace protocol { +namespace detail { + +struct PatchBadgeFactory; +using Badge = folly::badge; + +} // namespace detail +} // namespace protocol namespace op { namespace detail { @@ -219,7 +227,8 @@ class AnyPatch : public BaseClearPatch> { // The provided type MUST match with the value type of patch stored in // provided patch as Thrift Any. - void patchIfTypeIs(type::Type type, type::AnyStruct patch) { + void patchIfTypeIs( + protocol::detail::Badge, type::Type type, type::AnyStruct patch) { if (!type.isValid()) { throwTypeNotValid(type); } @@ -231,7 +240,8 @@ class AnyPatch : public BaseClearPatch> { // The provided type in ensureAny MUST match with the value type of patch // stored in provided patch as Thrift Any. - void ensureAndPatch(type::AnyStruct ensure, type::AnyStruct patch) { + void ensureAndPatch( + protocol::detail::Badge, type::AnyStruct ensure, type::AnyStruct patch) { throwIfInvalidOrUnsupportedAny(ensure); throwIfInvalidOrUnsupportedAny(patch); type::Type type = ensure.type().value(); diff --git a/thrift/lib/thrift/detail/DynamicPatch.cpp b/thrift/lib/thrift/detail/DynamicPatch.cpp index 9aed52345ba..e53ac6cffaf 100644 --- a/thrift/lib/thrift/detail/DynamicPatch.cpp +++ b/thrift/lib/thrift/detail/DynamicPatch.cpp @@ -932,7 +932,7 @@ op::AnyPatch DiffVisitorBase::diffAny( anySubPatch.data() = *serializeObject(subPatch.toObject()); anySubPatch.type() = detail::toPatchType(*src.type()); - patch.patchIfTypeIs(*src.type(), std::move(anySubPatch)); + patch.patchIfTypeIs(badge, *src.type(), std::move(anySubPatch)); } return patch;