Skip to content

Commit

Permalink
core: Replace boost-outcome with outcome. (y-scope#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 authored Jul 18, 2024
1 parent eebbf1e commit 24e4690
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
[submodule "components/core/submodules/log-surgeon"]
path = components/core/submodules/log-surgeon
url = https://github.com/y-scope/log-surgeon.git
[submodule "components/core/submodules/boost-outcome"]
path = components/core/submodules/boost-outcome
url = https://github.com/boostorg/outcome.git
[submodule "components/core/submodules/simdjson"]
path = components/core/submodules/simdjson
url = https://github.com/simdjson/simdjson.git
Expand All @@ -26,3 +23,6 @@
[submodule "tools/yscope-dev-utils"]
path = tools/yscope-dev-utils
url = https://github.com/y-scope/yscope-dev-utils.git
[submodule "components/core/submodules/outcome"]
path = components/core/submodules/outcome
url = https://github.com/ned14/outcome.git
2 changes: 1 addition & 1 deletion components/core/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ IncludeCategories:
# Library headers. Update when adding new libraries.
# NOTE: clang-format retains leading white-space on a line in violation of the YAML spec.
- Regex: "<(absl|antlr4|archive|boost|bsoncxx|catch2|curl|date|fmt|json|log_surgeon|mariadb\
|mongocxx|msgpack|simdjson|spdlog|sqlite3|string_utils|yaml-cpp|zstd)"
|mongocxx|msgpack|outcome|simdjson|spdlog|sqlite3|string_utils|yaml-cpp|zstd)"
Priority: 3
# C system headers
- Regex: "^<.+\\.h>"
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 @@ -10,9 +10,9 @@
#include <system_error>
#include <vector>

#include <boost-outcome/include/boost/outcome/std_result.hpp>
#include <json/single_include/nlohmann/json.hpp>
#include <msgpack.hpp>
#include <outcome/single-header/outcome.hpp>

#include "../../ir/types.hpp"
#include "../../time_types.hpp"
Expand Down Expand Up @@ -235,7 +235,7 @@ auto serialize_value_array(

template <typename encoded_variable_t>
auto Serializer<encoded_variable_t>::create(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<Serializer<encoded_variable_t>> {
) -> OUTCOME_V2_NAMESPACE::std_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 @@ -493,9 +493,9 @@ auto Serializer<encoded_variable_t>::serialize_val(
// Explicitly declare template specializations so that we can define the template methods in this
// file
template auto Serializer<eight_byte_encoded_variable_t>::create(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<Serializer<eight_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<Serializer<eight_byte_encoded_variable_t>>;
template auto Serializer<four_byte_encoded_variable_t>::create(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<Serializer<four_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_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 @@ -6,8 +6,8 @@
#include <string>
#include <vector>

#include <boost-outcome/include/boost/outcome/std_result.hpp>
#include <msgpack.hpp>
#include <outcome/single-header/outcome.hpp>

#include "../../time_types.hpp"
#include "../SchemaTree.hpp"
Expand Down Expand Up @@ -44,7 +44,7 @@ class Serializer {
* - std::errc::protocol_error on failure to serialize the preamble.
*/
[[nodiscard]] static auto create(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<Serializer<encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<Serializer<encoded_variable_t>>;

// Disable copy constructor/assignment operator
Serializer(Serializer const&) = delete;
Expand Down
13 changes: 7 additions & 6 deletions components/core/src/clp/ir/LogEventDeserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <vector>

#include <json/single_include/nlohmann/json.hpp>
#include <outcome/single-header/outcome.hpp>
#include <string_utils/string_utils.hpp>

#include "../ffi/ir_stream/decoding_methods.hpp"
Expand All @@ -12,7 +13,7 @@
namespace clp::ir {
template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
ffi::ir_stream::encoded_tag_t metadata_type{0};
std::vector<int8_t> metadata;
auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata);
Expand Down Expand Up @@ -68,7 +69,7 @@ auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader

template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
// Process any packets before the log event
ffi::ir_stream::encoded_tag_t tag{};
while (true) {
Expand Down Expand Up @@ -129,11 +130,11 @@ auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event(
// Explicitly declare template specializations so that we can define the template methods in this
// file
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<eight_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<four_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<four_byte_encoded_variable_t>>;
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
} // namespace clp::ir
6 changes: 3 additions & 3 deletions components/core/src/clp/ir/LogEventDeserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <optional>

#include <boost-outcome/include/boost/outcome/std_result.hpp>
#include <outcome/single-header/outcome.hpp>

#include "../ReaderInterface.hpp"
#include "../time_types.hpp"
Expand Down Expand Up @@ -35,7 +35,7 @@ class LogEventDeserializer {
* or uses an unsupported version
*/
static auto create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>>;

// Delete copy constructor and assignment
LogEventDeserializer(LogEventDeserializer const&) = delete;
Expand All @@ -62,7 +62,7 @@ class LogEventDeserializer {
* - std::errc::protocol_error if the IR stream is corrupted
*/
[[nodiscard]] auto deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>>;

private:
// Constructors
Expand Down
13 changes: 7 additions & 6 deletions components/core/src/glt/ir/LogEventDeserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <vector>

#include <json/single_include/nlohmann/json.hpp>
#include <outcome/single-header/outcome.hpp>
#include <string_utils/string_utils.hpp>

#include "../ffi/ir_stream/decoding_methods.hpp"
Expand All @@ -11,7 +12,7 @@
namespace glt::ir {
template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
ffi::ir_stream::encoded_tag_t metadata_type{0};
std::vector<int8_t> metadata;
auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata);
Expand Down Expand Up @@ -67,7 +68,7 @@ auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader

template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
epoch_time_ms_t timestamp_or_timestamp_delta{};
std::string logtype;
std::vector<std::string> dict_vars;
Expand Down Expand Up @@ -106,11 +107,11 @@ auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event(
// Explicitly declare template specializations so that we can define the template methods in this
// file
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<eight_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<four_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<four_byte_encoded_variable_t>>;
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
} // namespace glt::ir
6 changes: 3 additions & 3 deletions components/core/src/glt/ir/LogEventDeserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <optional>

#include <boost-outcome/include/boost/outcome/std_result.hpp>
#include <outcome/single-header/outcome.hpp>

#include "../ReaderInterface.hpp"
#include "../TimestampPattern.hpp"
Expand Down Expand Up @@ -34,7 +34,7 @@ class LogEventDeserializer {
* or uses an unsupported version
*/
static auto create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>>;

// Delete copy constructor and assignment
LogEventDeserializer(LogEventDeserializer const&) = delete;
Expand All @@ -59,7 +59,7 @@ class LogEventDeserializer {
* - std::errc::result_out_of_range if the IR stream is corrupted
*/
[[nodiscard]] auto deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>>;
) -> OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>>;

private:
// Constructors
Expand Down
1 change: 0 additions & 1 deletion components/core/submodules/boost-outcome
Submodule boost-outcome deleted from 39500a
1 change: 1 addition & 0 deletions components/core/submodules/outcome
Submodule outcome added at 571f9c
10 changes: 0 additions & 10 deletions components/core/tools/scripts/deps-download/boost-outcome.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ if [ -e "$project_root_dir/.git" ] ; then
git submodule update --init --recursive
else
python3 "${script_dir}/download-dep.py" "${script_dir}/abseil-cpp.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/boost-outcome.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/Catch2.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/date.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/json.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/log-surgeon.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/outcome.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/simdjson.json"
python3 "${script_dir}/download-dep.py" "${script_dir}/yaml-cpp.json"
fi
10 changes: 10 additions & 0 deletions components/core/tools/scripts/deps-download/outcome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"url": "https://github.com/ned14/outcome/archive/refs/tags/v2.2.9.zip",
"unzip": true,
"targets": [
{
"source": "outcome-2.2.9",
"destination": "submodules/outcome"
}
]
}

0 comments on commit 24e4690

Please sign in to comment.