Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <utility>
#include <vector>

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

#include "../../ErrorCode.hpp"
#include "../../ir/EncodedTextAst.hpp"
Expand Down Expand Up @@ -53,7 +53,7 @@ using Schema = std::vector<SchemaTree::Node::id_t>;
* @return Forwards `deserialize_and_decode_schema_tree_node_id`'s return values.
*/
[[nodiscard]] auto deserialize_schema_tree_node_parent_id(ReaderInterface& reader)
-> OUTCOME_V2_NAMESPACE::std_result<std::pair<bool, SchemaTree::Node::id_t>>;
-> ystdlib::error_handling::Result<std::pair<bool, SchemaTree::Node::id_t>>;

/**
* Deserializes the key name of a schema tree node.
Expand Down Expand Up @@ -112,7 +112,7 @@ deserialize_string(ReaderInterface& reader, encoded_tag_t tag, std::string& dese
[[nodiscard]] auto deserialize_auto_gen_node_id_value_pairs_and_user_gen_schema(
ReaderInterface& reader,
encoded_tag_t& tag
) -> OUTCOME_V2_NAMESPACE::std_result<std::pair<KeyValuePairLogEvent::NodeIdValuePairs, Schema>>;
) -> ystdlib::error_handling::Result<std::pair<KeyValuePairLogEvent::NodeIdValuePairs, Schema>>;

/**
* Deserializes the next value and pushes the result into `node_id_value_pairs`.
Expand Down Expand Up @@ -209,7 +209,7 @@ auto schema_tree_node_tag_to_type(encoded_tag_t tag) -> std::optional<SchemaTree
}

auto deserialize_schema_tree_node_parent_id(ReaderInterface& reader)
-> OUTCOME_V2_NAMESPACE::std_result<std::pair<bool, SchemaTree::Node::id_t>> {
-> ystdlib::error_handling::Result<std::pair<bool, SchemaTree::Node::id_t>> {
encoded_tag_t tag{};
if (auto const err{deserialize_tag(reader, tag)}; IRErrorCode::IRErrorCode_Success != err) {
return ir_error_code_to_errc(err);
Expand Down Expand Up @@ -301,7 +301,7 @@ auto deserialize_string(ReaderInterface& reader, encoded_tag_t tag, std::string&
auto deserialize_auto_gen_node_id_value_pairs_and_user_gen_schema(
ReaderInterface& reader,
encoded_tag_t& tag
) -> OUTCOME_V2_NAMESPACE::std_result<std::pair<KeyValuePairLogEvent::NodeIdValuePairs, Schema>> {
) -> ystdlib::error_handling::Result<std::pair<KeyValuePairLogEvent::NodeIdValuePairs, Schema>> {
KeyValuePairLogEvent::NodeIdValuePairs auto_gen_node_id_value_pairs;
Schema user_gen_schema;

Expand Down Expand Up @@ -567,7 +567,7 @@ auto deserialize_ir_unit_schema_tree_node_insertion(
ReaderInterface& reader,
encoded_tag_t tag,
std::string& key_name
) -> OUTCOME_V2_NAMESPACE::std_result<std::pair<bool, SchemaTree::NodeLocator>> {
) -> ystdlib::error_handling::Result<std::pair<bool, SchemaTree::NodeLocator>> {
auto const type{schema_tree_node_tag_to_type(tag)};
if (false == type.has_value()) {
return ir_error_code_to_errc(IRErrorCode::IRErrorCode_Corrupted_IR);
Expand All @@ -588,7 +588,7 @@ auto deserialize_ir_unit_schema_tree_node_insertion(
}

auto deserialize_ir_unit_utc_offset_change(ReaderInterface& reader)
-> OUTCOME_V2_NAMESPACE::std_result<UtcOffset> {
-> ystdlib::error_handling::Result<UtcOffset> {
UtcOffset utc_offset{0};
if (auto const err{deserialize_utc_offset_change(reader, utc_offset)};
IRErrorCode::IRErrorCode_Success != err)
Expand All @@ -604,7 +604,7 @@ auto deserialize_ir_unit_kv_pair_log_event(
std::shared_ptr<SchemaTree> auto_gen_keys_schema_tree,
std::shared_ptr<SchemaTree> user_gen_keys_schema_tree,
UtcOffset utc_offset
) -> OUTCOME_V2_NAMESPACE::std_result<KeyValuePairLogEvent> {
) -> ystdlib::error_handling::Result<KeyValuePairLogEvent> {
auto auto_gen_node_id_value_pairs_and_user_gen_schema_result{
deserialize_auto_gen_node_id_value_pairs_and_user_gen_schema(reader, tag)
};
Expand Down
Loading