|
21 | 21 | #include "absl/base/nullability.h" |
22 | 22 | #include "absl/status/status.h" |
23 | 23 | #include "absl/status/statusor.h" |
24 | | -#include "absl/strings/cord.h" |
25 | 24 | #include "absl/strings/str_cat.h" |
26 | 25 | #include "absl/strings/string_view.h" |
27 | | -#include "absl/strings/strip.h" |
28 | 26 | #include "absl/types/optional.h" |
29 | | -#include "common/any.h" |
30 | 27 | #include "common/legacy_value.h" |
31 | 28 | #include "common/memory.h" |
32 | 29 | #include "common/type.h" |
@@ -173,39 +170,6 @@ LegacyTypeProvider::NewStructValueBuilder(cel::ValueFactory& value_factory, |
173 | 170 | return nullptr; |
174 | 171 | } |
175 | 172 |
|
176 | | -absl::StatusOr<absl::optional<cel::Value>> |
177 | | -LegacyTypeProvider::DeserializeValueImpl(cel::ValueFactory& value_factory, |
178 | | - absl::string_view type_url, |
179 | | - const absl::Cord& value) const { |
180 | | - auto type_name = absl::StripPrefix(type_url, cel::kTypeGoogleApisComPrefix); |
181 | | - if (auto type_info = ProvideLegacyTypeInfo(type_name); |
182 | | - type_info.has_value()) { |
183 | | - if (auto type_adapter = ProvideLegacyType(type_name); |
184 | | - type_adapter.has_value()) { |
185 | | - const auto* mutation_apis = type_adapter->mutation_apis(); |
186 | | - if (mutation_apis == nullptr) { |
187 | | - return absl::FailedPreconditionError(absl::StrCat( |
188 | | - "LegacyTypeMutationApis missing for type: ", type_name)); |
189 | | - } |
190 | | - CEL_ASSIGN_OR_RETURN(auto builder, mutation_apis->NewInstance( |
191 | | - value_factory.GetMemoryManager())); |
192 | | - if (!builder.message_ptr()->ParsePartialFromCord(value)) { |
193 | | - return absl::UnknownError("failed to parse protocol buffer message"); |
194 | | - } |
195 | | - CEL_ASSIGN_OR_RETURN( |
196 | | - auto legacy_value, |
197 | | - mutation_apis->AdaptFromWellKnownType( |
198 | | - value_factory.GetMemoryManager(), std::move(builder))); |
199 | | - cel::Value modern_value; |
200 | | - CEL_RETURN_IF_ERROR(ModernValue(cel::extensions::ProtoMemoryManagerArena( |
201 | | - value_factory.GetMemoryManager()), |
202 | | - legacy_value, modern_value)); |
203 | | - return modern_value; |
204 | | - } |
205 | | - } |
206 | | - return absl::nullopt; |
207 | | -} |
208 | | - |
209 | 173 | absl::StatusOr<absl::optional<cel::Type>> LegacyTypeProvider::FindTypeImpl( |
210 | 174 | absl::string_view name) const { |
211 | 175 | if (auto type_info = ProvideLegacyTypeInfo(name); type_info.has_value()) { |
|
0 commit comments