Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ add_executable(unitTest
)
target_include_directories(unitTest
PRIVATE
${CLP_OUTCOME_INCLUDE_DIRECTORY}
${CLP_SQLITE3_INCLUDE_DIRECTORY}
)
target_link_libraries(unitTest
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/clg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ add_executable(clg ${CLG_SOURCES})
target_compile_features(clg PRIVATE cxx_std_20)
target_include_directories(clg
PRIVATE
"${CLP_OUTCOME_INCLUDE_DIRECTORY}"
"${CLP_SQLITE3_INCLUDE_DIRECTORY}"
)
target_link_libraries(clg
Expand All @@ -144,6 +143,7 @@ target_link_libraries(clg
clp::string_utils
yaml-cpp
ystdlib::containers
ystdlib::error_handling
ZStd::ZStd
)
# Put the built executable at the root of the build directory
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/clo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ add_executable(clo ${CLO_SOURCES} ${REDUCER_SOURCES})
target_compile_features(clo PRIVATE cxx_std_20)
target_include_directories(clo
PRIVATE
"${CLP_OUTCOME_INCLUDE_DIRECTORY}"
"${CLP_SQLITE3_INCLUDE_DIRECTORY}"
)
target_link_libraries(clo
Expand All @@ -172,6 +171,7 @@ target_link_libraries(clo
${STD_FS_LIBS}
clp::string_utils
ystdlib::containers
ystdlib::error_handling
ZStd::ZStd
)
# Put the built executable at the root of the build directory
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/clp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ add_executable(clp ${CLP_SOURCES})
target_compile_features(clp PRIVATE cxx_std_20)
target_include_directories(clp
PRIVATE
"${CLP_OUTCOME_INCLUDE_DIRECTORY}"
"${CLP_SQLITE3_INCLUDE_DIRECTORY}"
)
target_link_libraries(clp
Expand All @@ -186,6 +185,7 @@ target_link_libraries(clp
${STD_FS_LIBS}
clp::string_utils
yaml-cpp
ystdlib::error_handling
ystdlib::containers
ZStd::ZStd
)
Expand Down
18 changes: 9 additions & 9 deletions components/core/src/clp/ffi/KeyValuePairLogEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>
#include <outcome/outcome.hpp>
#include <ystdlib/error_handling/Result.hpp>

#include "../ir/EncodedTextAst.hpp"
#include "../time_types.hpp"
Expand Down Expand Up @@ -166,7 +166,7 @@ class JsonSerializationIterator {
[[nodiscard]] auto get_schema_subtree_bitmap(
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs,
SchemaTree const& schema_tree
) -> OUTCOME_V2_NAMESPACE::std_result<vector<bool>>;
) -> ystdlib::error_handling::Result<vector<bool>>;

/**
* Inserts the given key-value pair into the JSON object (map).
Expand Down Expand Up @@ -203,7 +203,7 @@ class JsonSerializationIterator {
SchemaTree const& schema_tree,
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs,
vector<bool> const& schema_subtree_bitmap
) -> OUTCOME_V2_NAMESPACE::std_result<nlohmann::json>;
) -> ystdlib::error_handling::Result<nlohmann::json>;

/**
* @param node A non-root schema tree node.
Expand Down Expand Up @@ -334,7 +334,7 @@ auto is_leaf_node(
auto get_schema_subtree_bitmap(
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs,
SchemaTree const& schema_tree
) -> OUTCOME_V2_NAMESPACE::std_result<vector<bool>> {
) -> ystdlib::error_handling::Result<vector<bool>> {
vector<bool> schema_subtree_bitmap(schema_tree.get_size(), false);
for (auto const& [node_id, val] : node_id_value_pairs) {
if (node_id >= schema_subtree_bitmap.size()) {
Expand Down Expand Up @@ -431,7 +431,7 @@ auto serialize_node_id_value_pairs_to_json(
SchemaTree const& schema_tree,
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs,
vector<bool> const& schema_subtree_bitmap
) -> OUTCOME_V2_NAMESPACE::std_result<nlohmann::json> {
) -> ystdlib::error_handling::Result<nlohmann::json> {
if (node_id_value_pairs.empty()) {
return nlohmann::json::object();
}
Expand Down Expand Up @@ -531,7 +531,7 @@ auto KeyValuePairLogEvent::create(
NodeIdValuePairs auto_gen_node_id_value_pairs,
NodeIdValuePairs user_gen_node_id_value_pairs,
UtcOffset utc_offset
) -> OUTCOME_V2_NAMESPACE::std_result<KeyValuePairLogEvent> {
) -> ystdlib::error_handling::Result<KeyValuePairLogEvent> {
if (nullptr == auto_gen_keys_schema_tree || nullptr == user_gen_keys_schema_tree) {
return std::errc::invalid_argument;
}
Expand Down Expand Up @@ -564,17 +564,17 @@ auto KeyValuePairLogEvent::create(
}

auto KeyValuePairLogEvent::get_auto_gen_keys_schema_subtree_bitmap() const
-> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>> {
-> ystdlib::error_handling::Result<std::vector<bool>> {
return get_schema_subtree_bitmap(m_auto_gen_node_id_value_pairs, *m_auto_gen_keys_schema_tree);
}

auto KeyValuePairLogEvent::get_user_gen_keys_schema_subtree_bitmap() const
-> outcome_v2::std_result<std::vector<bool>> {
-> ystdlib::error_handling::Result<std::vector<bool>> {
return get_schema_subtree_bitmap(m_user_gen_node_id_value_pairs, *m_user_gen_keys_schema_tree);
}

auto KeyValuePairLogEvent::serialize_to_json() const
-> OUTCOME_V2_NAMESPACE::std_result<std::pair<nlohmann::json, nlohmann::json>> {
-> ystdlib::error_handling::Result<std::pair<nlohmann::json, nlohmann::json>> {
auto const auto_gen_keys_schema_subtree_bitmap_result{
get_auto_gen_keys_schema_subtree_bitmap()
};
Expand Down
10 changes: 5 additions & 5 deletions components/core/src/clp/ffi/KeyValuePairLogEvent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <vector>

#include <nlohmann/json_fwd.hpp>
#include <outcome/outcome.hpp>
#include <ystdlib/error_handling/Result.hpp>

#include "../time_types.hpp"
#include "SchemaTree.hpp"
Expand Down Expand Up @@ -48,7 +48,7 @@ class KeyValuePairLogEvent {
NodeIdValuePairs auto_gen_node_id_value_pairs,
NodeIdValuePairs user_gen_node_id_value_pairs,
UtcOffset utc_offset
) -> OUTCOME_V2_NAMESPACE::std_result<KeyValuePairLogEvent>;
) -> ystdlib::error_handling::Result<KeyValuePairLogEvent>;

// Disable copy constructor and assignment operator
KeyValuePairLogEvent(KeyValuePairLogEvent const&) = delete;
Expand Down Expand Up @@ -86,7 +86,7 @@ class KeyValuePairLogEvent {
* - Forwards `get_schema_subtree_bitmap`'s return values.
*/
[[nodiscard]] auto get_auto_gen_keys_schema_subtree_bitmap() const
-> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>>;
-> ystdlib::error_handling::Result<std::vector<bool>>;

/**
* @return A result containing a bitmap where every bit corresponds to the ID of a node in the
Expand All @@ -96,7 +96,7 @@ class KeyValuePairLogEvent {
* - Forwards `get_schema_subtree_bitmap`'s return values.
*/
[[nodiscard]] auto get_user_gen_keys_schema_subtree_bitmap() const
-> OUTCOME_V2_NAMESPACE::std_result<std::vector<bool>>;
-> ystdlib::error_handling::Result<std::vector<bool>>;

[[nodiscard]] auto get_utc_offset() const -> UtcOffset { return m_utc_offset; }

Expand All @@ -111,7 +111,7 @@ class KeyValuePairLogEvent {
* - Forwards `serialize_node_id_value_pairs_to_json`'s return values on failure.
*/
[[nodiscard]] auto serialize_to_json() const
-> OUTCOME_V2_NAMESPACE::std_result<std::pair<nlohmann::json, nlohmann::json>>;
-> ystdlib::error_handling::Result<std::pair<nlohmann::json, nlohmann::json>>;

private:
// Constructor
Expand Down
36 changes: 20 additions & 16 deletions components/core/src/clp/ffi/ir_stream/Deserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>
#include <outcome/outcome.hpp>
#include <ystdlib/error_handling/Result.hpp>

#include "../../ReaderInterface.hpp"
#include "../../time_types.hpp"
Expand Down Expand Up @@ -56,7 +56,7 @@ class Deserializer {
* - Forwards `create_generic`'s return values.
*/
[[nodiscard]] static auto create(ReaderInterface& reader, IrUnitHandlerType ir_unit_handler)
-> OUTCOME_V2_NAMESPACE::std_result<Deserializer>
-> ystdlib::error_handling::Result<Deserializer>
requires std::is_same_v<QueryHandlerType, search::EmptyQueryHandler>
{
return create_generic(reader, std::move(ir_unit_handler), {});
Expand All @@ -75,7 +75,7 @@ class Deserializer {
[[nodiscard]] static auto
create(ReaderInterface& reader,
IrUnitHandlerType ir_unit_handler,
QueryHandlerType query_handler) -> OUTCOME_V2_NAMESPACE::std_result<Deserializer>
QueryHandlerType query_handler) -> ystdlib::error_handling::Result<Deserializer>
requires search::IsNonEmptyQueryHandler<QueryHandlerType>::value
{
return create_generic(reader, std::move(ir_unit_handler), std::move(query_handler));
Expand Down Expand Up @@ -138,7 +138,7 @@ class Deserializer {
* unit handling failure.
*/
[[nodiscard]] auto deserialize_next_ir_unit(ReaderInterface& reader)
-> OUTCOME_V2_NAMESPACE::std_result<IrUnitType>;
-> ystdlib::error_handling::Result<IrUnitType>;

/**
* @return Whether the stream has completed. A stream is considered completed if an
Expand Down Expand Up @@ -176,7 +176,7 @@ class Deserializer {
ReaderInterface& reader,
IrUnitHandlerType ir_unit_handler,
QueryHandlerType query_handler
) -> OUTCOME_V2_NAMESPACE::std_result<Deserializer>;
) -> ystdlib::error_handling::Result<Deserializer>;

// Constructor
Deserializer(
Expand Down Expand Up @@ -206,7 +206,7 @@ class Deserializer {
*/
template <IrUnitHandlerReq IrUnitHandler>
[[nodiscard]] auto make_deserializer(ReaderInterface& reader, IrUnitHandler ir_unit_handler)
-> OUTCOME_V2_NAMESPACE::std_result<Deserializer<IrUnitHandler>>;
-> ystdlib::error_handling::Result<Deserializer<IrUnitHandler>>;

/**
* Wrapper for `Deserializer`'s factory function to enable automatic type deduction.
Expand All @@ -220,14 +220,14 @@ template <IrUnitHandlerReq IrUnitHandler, search::QueryHandlerReq QueryHandlerTy
ReaderInterface& reader,
IrUnitHandler ir_unit_handler,
QueryHandlerType query_handler
) -> OUTCOME_V2_NAMESPACE::std_result<Deserializer<IrUnitHandler, QueryHandlerType>>;
) -> ystdlib::error_handling::Result<Deserializer<IrUnitHandler, QueryHandlerType>>;

template <IrUnitHandlerReq IrUnitHandlerType, search::QueryHandlerReq QueryHandlerType>
auto Deserializer<IrUnitHandlerType, QueryHandlerType>::create_generic(
ReaderInterface& reader,
IrUnitHandlerType ir_unit_handler,
QueryHandlerType query_handler
) -> OUTCOME_V2_NAMESPACE::std_result<Deserializer> {
) -> ystdlib::error_handling::Result<Deserializer> {
bool is_four_byte_encoded{};
if (auto const err{get_encoding_type(reader, is_four_byte_encoded)};
IRErrorCode::IRErrorCode_Success != err)
Expand Down Expand Up @@ -278,7 +278,7 @@ auto Deserializer<IrUnitHandlerType, QueryHandlerType>::create_generic(
template <IrUnitHandlerReq IrUnitHandler, search::QueryHandlerReq QueryHandlerType>
auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
ReaderInterface& reader
) -> OUTCOME_V2_NAMESPACE::std_result<IrUnitType> {
) -> ystdlib::error_handling::Result<IrUnitType> {
if (is_stream_completed()) {
return std::errc::operation_not_permitted;
}
Expand All @@ -296,7 +296,7 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
auto const ir_unit_type{optional_ir_unit_type.value()};
switch (ir_unit_type) {
case IrUnitType::LogEvent: {
auto log_event{OUTCOME_TRYX(deserialize_ir_unit_kv_pair_log_event(
auto log_event{YSTDLIB_ERROR_HANDLING_TRYX(deserialize_ir_unit_kv_pair_log_event(
reader,
tag,
m_auto_gen_keys_schema_tree,
Expand All @@ -306,7 +306,9 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(

if constexpr (search::IsNonEmptyQueryHandler<QueryHandlerType>::value) {
if (search::AstEvaluationResult::True
!= OUTCOME_TRYX(m_query_handler.evaluate_kv_pair_log_event(log_event)))
!= YSTDLIB_ERROR_HANDLING_TRYX(
m_query_handler.evaluate_kv_pair_log_event(log_event)
))
{
break;
}
Expand All @@ -322,7 +324,7 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(

case IrUnitType::SchemaTreeNodeInsertion: {
std::string key_name;
auto const [is_auto_generated, node_locator]{OUTCOME_TRYX(
auto const [is_auto_generated, node_locator]{YSTDLIB_ERROR_HANDLING_TRYX(
deserialize_ir_unit_schema_tree_node_insertion(reader, tag, key_name)
)};
auto& schema_tree_to_insert{
Expand All @@ -336,7 +338,7 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
auto const node_id{schema_tree_to_insert->insert_node(node_locator)};

if constexpr (search::IsNonEmptyQueryHandler<QueryHandlerType>::value) {
OUTCOME_TRYV(m_query_handler.update_partially_resolved_columns(
YSTDLIB_ERROR_HANDLING_TRYV(m_query_handler.update_partially_resolved_columns(
is_auto_generated,
node_locator,
node_id
Expand All @@ -356,7 +358,9 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(
}

case IrUnitType::UtcOffsetChange: {
auto const new_utc_offset{OUTCOME_TRYX(deserialize_ir_unit_utc_offset_change(reader))};
auto const new_utc_offset{
YSTDLIB_ERROR_HANDLING_TRYX(deserialize_ir_unit_utc_offset_change(reader))
};
if (auto const err{
m_ir_unit_handler.handle_utc_offset_change(m_utc_offset, new_utc_offset)
};
Expand Down Expand Up @@ -388,7 +392,7 @@ auto Deserializer<IrUnitHandler, QueryHandlerType>::deserialize_next_ir_unit(

template <IrUnitHandlerReq IrUnitHandlerType>
[[nodiscard]] auto make_deserializer(ReaderInterface& reader, IrUnitHandlerType ir_unit_handler)
-> OUTCOME_V2_NAMESPACE::std_result<Deserializer<IrUnitHandlerType>> {
-> ystdlib::error_handling::Result<Deserializer<IrUnitHandlerType>> {
return Deserializer<IrUnitHandlerType>::create(reader, std::move(ir_unit_handler));
}

Expand All @@ -397,7 +401,7 @@ template <IrUnitHandlerReq IrUnitHandlerType, search::QueryHandlerReq QueryHandl
ReaderInterface& reader,
IrUnitHandlerType ir_unit_handler,
QueryHandlerType query_handler
) -> OUTCOME_V2_NAMESPACE::std_result<Deserializer<IrUnitHandlerType, QueryHandlerType>> {
) -> ystdlib::error_handling::Result<Deserializer<IrUnitHandlerType, QueryHandlerType>> {
return Deserializer<IrUnitHandlerType, QueryHandlerType>::create(
reader,
std::move(ir_unit_handler),
Expand Down
8 changes: 4 additions & 4 deletions components/core/src/clp/ffi/ir_stream/Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <msgpack.hpp>
#include <nlohmann/json.hpp>
#include <outcome/outcome.hpp>
#include <ystdlib/error_handling/Result.hpp>

#include "../../ir/types.hpp"
#include "../../time_types.hpp"
Expand Down Expand Up @@ -524,7 +524,7 @@ template <
template <typename encoded_variable_t>
auto Serializer<encoded_variable_t>::create(
std::optional<nlohmann::json> optional_user_defined_metadata
) -> OUTCOME_V2_NAMESPACE::std_result<Serializer<encoded_variable_t>> {
) -> ystdlib::error_handling::Result<Serializer<encoded_variable_t>> {
static_assert(
std::is_same_v<encoded_variable_t, eight_byte_encoded_variable_t>
|| std::is_same_v<encoded_variable_t, four_byte_encoded_variable_t>
Expand Down Expand Up @@ -796,10 +796,10 @@ auto Serializer<encoded_variable_t>::serialize_schema_tree_node(
// file
template auto Serializer<eight_byte_encoded_variable_t>::create(
std::optional<nlohmann::json> optional_user_defined_metadata
) -> OUTCOME_V2_NAMESPACE::std_result<Serializer<eight_byte_encoded_variable_t>>;
) -> ystdlib::error_handling::Result<Serializer<eight_byte_encoded_variable_t>>;
template auto Serializer<four_byte_encoded_variable_t>::create(
std::optional<nlohmann::json> optional_user_defined_metadata
) -> OUTCOME_V2_NAMESPACE::std_result<Serializer<four_byte_encoded_variable_t>>;
) -> ystdlib::error_handling::Result<Serializer<four_byte_encoded_variable_t>>;

template auto Serializer<eight_byte_encoded_variable_t>::change_utc_offset(UtcOffset utc_offset)
-> void;
Expand Down
4 changes: 2 additions & 2 deletions components/core/src/clp/ffi/ir_stream/Serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <msgpack.hpp>
#include <nlohmann/json.hpp>
#include <outcome/outcome.hpp>
#include <ystdlib/error_handling/Result.hpp>

#include "../../time_types.hpp"
#include "../SchemaTree.hpp"
Expand Down Expand Up @@ -49,7 +49,7 @@ class Serializer {
*/
[[nodiscard]] static auto create(
std::optional<nlohmann::json> optional_user_defined_metadata = std::nullopt
) -> OUTCOME_V2_NAMESPACE::std_result<Serializer<encoded_variable_t>>;
) -> ystdlib::error_handling::Result<Serializer<encoded_variable_t>>;

// Disable copy constructor/assignment operator
Serializer(Serializer const&) = delete;
Expand Down
Loading