11#ifndef CLP_FFI_IR_STREAM_DESERIALIZER_HPP
22#define CLP_FFI_IR_STREAM_DESERIALIZER_HPP
33
4- #include < concepts>
54#include < cstdint>
65#include < memory>
76#include < string>
109#include < vector>
1110
1211#include < nlohmann/json.hpp>
12+ #include < nlohmann/json_fwd.hpp>
1313#include < outcome/outcome.hpp>
1414
1515#include " ../../ReaderInterface.hpp"
1616#include " ../../time_types.hpp"
1717#include " ../SchemaTree.hpp"
18- #include " decoding_methods.hpp"
1918#include " ir_unit_deserialization_methods.hpp"
2019#include " IrUnitHandlerReq.hpp"
2120#include " IrUnitType.hpp"
2221#include " protocol_constants.hpp"
22+ #include " search/AstEvaluationResult.hpp"
2323#include " search/QueryHandlerReq.hpp"
2424#include " utils.hpp"
2525
26+ // This include has a circular dependency with the `.inc` file.
27+ // The following clang-tidy suppression should be removed once the circular dependency is resolved.
28+ // NOLINTNEXTLINE(misc-header-include-cycle)
29+ #include " decoding_methods.hpp"
30+
2631namespace clp ::ffi::ir_stream {
2732/* *
2833 * A deserializer for reading IR units from a CLP kv-pair IR stream. An IR unit handler should be
@@ -291,26 +296,23 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
291296 auto const ir_unit_type{optional_ir_unit_type.value ()};
292297 switch (ir_unit_type) {
293298 case IrUnitType::LogEvent: {
294- auto result{ deserialize_ir_unit_kv_pair_log_event (
299+ auto log_event{ OUTCOME_TRYX ( deserialize_ir_unit_kv_pair_log_event (
295300 reader,
296301 tag,
297302 m_auto_gen_keys_schema_tree,
298303 m_user_gen_keys_schema_tree,
299304 m_utc_offset
300- )};
301- if (result.has_error ()) {
302- return result.error ();
303- }
305+ ))};
304306
305307 if constexpr (search::IsNonEmptyQueryHandler<QueryHandlerType>::value) {
306308 if (search::AstEvaluationResult::True
307- != OUTCOME_TRYX (m_query_handler.evaluate_kv_pair_log_event (result. value () )))
309+ != OUTCOME_TRYX (m_query_handler.evaluate_kv_pair_log_event (log_event )))
308310 {
309311 break ;
310312 }
311313 }
312314
313- if (auto const err{m_ir_unit_handler.handle_log_event (std::move (result. value () ))};
315+ if (auto const err{m_ir_unit_handler.handle_log_event (std::move (log_event ))};
314316 IRErrorCode::IRErrorCode_Success != err)
315317 {
316318 return ir_error_code_to_errc (err);
@@ -320,14 +322,9 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
320322
321323 case IrUnitType::SchemaTreeNodeInsertion: {
322324 std::string key_name;
323- auto const result{
325+ auto const [is_auto_generated, node_locator]{ OUTCOME_TRYX (
324326 deserialize_ir_unit_schema_tree_node_insertion (reader, tag, key_name)
325- };
326- if (result.has_error ()) {
327- return result.error ();
328- }
329-
330- auto const & [is_auto_generated, node_locator]{result.value ()};
327+ )};
331328 auto & schema_tree_to_insert{
332329 is_auto_generated ? m_auto_gen_keys_schema_tree : m_user_gen_keys_schema_tree
333330 };
@@ -359,12 +356,7 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
359356 }
360357
361358 case IrUnitType::UtcOffsetChange: {
362- auto const result{deserialize_ir_unit_utc_offset_change (reader)};
363- if (result.has_error ()) {
364- return result.error ();
365- }
366-
367- auto const new_utc_offset{result.value ()};
359+ auto const new_utc_offset{OUTCOME_TRYX (deserialize_ir_unit_utc_offset_change (reader))};
368360 if (auto const err{
369361 m_ir_unit_handler.handle_utc_offset_change (m_utc_offset, new_utc_offset)
370362 };
0 commit comments