diff --git a/CMakeLists.txt b/CMakeLists.txt index 19685032..44f0556f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,11 @@ boost_${CLP_FFI_JS_BOOST_ARCHIVE_VERSION_PART}.tar.gz" URL_MD5 "53aeccc3167909ee770e34469f8dd592" ) message(STATUS "Fetching Boost.") -FetchContent_MakeAvailable(Boost) +set(FETCHCONTENT_QUIET OFF) +FetchContent_Declare( + Boost + URL "${CMAKE_FIND_PACKAGE_REDIRECTS_DIR/boost_1_85_0.tar.gz}" +) message("Boost sources successfully fetched into ${boost_SOURCE_DIR}") set(CMAKE_EXECUTABLE_SUFFIX ".js" CACHE STRING "Binary type to be generated by Emscripten.") diff --git a/src/clp_ffi_js/ir/StreamReader.cpp b/src/clp_ffi_js/ir/StreamReader.cpp index caf27422..2c96c95a 100644 --- a/src/clp_ffi_js/ir/StreamReader.cpp +++ b/src/clp_ffi_js/ir/StreamReader.cpp @@ -148,8 +148,8 @@ EMSCRIPTEN_BINDINGS(ClpStreamReader) { .function("deserializeStream", &clp_ffi_js::ir::StreamReader::deserialize_stream) .function("decodeRange", &clp_ffi_js::ir::StreamReader::decode_range) .function( - "getLogEventIdxByTimestamp", - &clp_ffi_js::ir::StreamReader::get_log_event_idx_by_timestamp + "getLogEventIdxWithNearestTimestamp", + &clp_ffi_js::ir::StreamReader::get_log_event_idx_with_nearest_timestamp ); } } // namespace diff --git a/src/clp_ffi_js/ir/StreamReader.hpp b/src/clp_ffi_js/ir/StreamReader.hpp index b03decc6..8d82109c 100644 --- a/src/clp_ffi_js/ir/StreamReader.hpp +++ b/src/clp_ffi_js/ir/StreamReader.hpp @@ -126,15 +126,15 @@ class StreamReader { [[nodiscard]] virtual auto decode_range(size_t begin_idx, size_t end_idx, bool use_filter) const -> DecodedResultsTsType = 0; /** - * Finds the index of the last log event that matches or next to the given timestamp. - * - * @param timestamp The timestamp to search for, in milliseconds since the Unix epoch. - * @return The last index of the log event whose timestamp is smaller than or equal to the - * `timestamp`. - * @return `0` if all log event timestamps are larger than the target. + * Finds the log event with the timestamp that's nearest to the `target_ts`. + * @param target_ts + * @return The index of the log event with: + * - the largest timestamp less than or equal to `target_ts`, + * - or the index `0` if all timestamps are greater than `target_ts`. * @return null if no log event exists in the stream. */ - [[nodiscard]] virtual auto get_log_event_idx_by_timestamp(clp::ir::epoch_time_ms_t timestamp + [[nodiscard]] virtual auto get_log_event_idx_with_nearest_timestamp( + clp::ir::epoch_time_ms_t target_ts ) -> LogEventIdxTsType = 0; protected: @@ -187,7 +187,7 @@ class StreamReader { ) -> void; /** - * Templated implementation of `get_log_event_idx_by_timestamp`. + * Templated implementation of `get_log_event_idx_with_nearest_timestamp`. * * @tparam LogEvent * @param log_events @@ -195,7 +195,7 @@ class StreamReader { * @return the best matched log event index. */ template - auto generic_get_log_event_idx_by_timestamp( + auto generic_get_log_event_idx_with_nearest_timestamp( LogEvents const& log_events, clp::ir::epoch_time_ms_t timestamp ) -> LogEventIdxTsType; @@ -287,7 +287,7 @@ auto StreamReader::generic_filter_log_events( } template -auto StreamReader::generic_get_log_event_idx_by_timestamp( +auto StreamReader::generic_get_log_event_idx_with_nearest_timestamp( LogEvents const& log_events, clp::ir::epoch_time_ms_t timestamp ) -> LogEventIdxTsType { diff --git a/src/clp_ffi_js/ir/StructuredIrStreamReader.cpp b/src/clp_ffi_js/ir/StructuredIrStreamReader.cpp index 6bd8c425..a684bc04 100644 --- a/src/clp_ffi_js/ir/StructuredIrStreamReader.cpp +++ b/src/clp_ffi_js/ir/StructuredIrStreamReader.cpp @@ -148,10 +148,10 @@ auto StructuredIrStreamReader::decode_range(size_t begin_idx, size_t end_idx, bo ); } -auto StructuredIrStreamReader::get_log_event_idx_by_timestamp( - clp::ir::epoch_time_ms_t const timestamp +auto StructuredIrStreamReader::get_log_event_idx_with_nearest_timestamp( + clp::ir::epoch_time_ms_t const target_ts ) -> LogEventIdxTsType { - return generic_get_log_event_idx_by_timestamp(*m_deserialized_log_events, timestamp); + return generic_get_log_event_idx_with_nearest_timestamp(*m_deserialized_log_events, target_ts); } StructuredIrStreamReader::StructuredIrStreamReader( diff --git a/src/clp_ffi_js/ir/StructuredIrStreamReader.hpp b/src/clp_ffi_js/ir/StructuredIrStreamReader.hpp index 8abb5223..38db17a2 100644 --- a/src/clp_ffi_js/ir/StructuredIrStreamReader.hpp +++ b/src/clp_ffi_js/ir/StructuredIrStreamReader.hpp @@ -75,7 +75,7 @@ class StructuredIrStreamReader : public StreamReader { [[nodiscard]] auto decode_range(size_t begin_idx, size_t end_idx, bool use_filter) const -> DecodedResultsTsType override; - [[nodiscard]] auto get_log_event_idx_by_timestamp(clp::ir::epoch_time_ms_t timestamp + [[nodiscard]] auto get_log_event_idx_with_nearest_timestamp(clp::ir::epoch_time_ms_t target_ts ) -> LogEventIdxTsType override; private: diff --git a/src/clp_ffi_js/ir/UnstructuredIrStreamReader.cpp b/src/clp_ffi_js/ir/UnstructuredIrStreamReader.cpp index 727b10b7..19d4c403 100644 --- a/src/clp_ffi_js/ir/UnstructuredIrStreamReader.cpp +++ b/src/clp_ffi_js/ir/UnstructuredIrStreamReader.cpp @@ -158,10 +158,10 @@ auto UnstructuredIrStreamReader::decode_range(size_t begin_idx, size_t end_idx, ); } -auto UnstructuredIrStreamReader::get_log_event_idx_by_timestamp( - clp::ir::epoch_time_ms_t const timestamp +auto UnstructuredIrStreamReader::get_log_event_idx_with_nearest_timestamp( + clp::ir::epoch_time_ms_t const target_ts ) -> LogEventIdxTsType { - return generic_get_log_event_idx_by_timestamp(m_encoded_log_events, timestamp); + return generic_get_log_event_idx_with_nearest_timestamp(m_encoded_log_events, target_ts); } UnstructuredIrStreamReader::UnstructuredIrStreamReader( diff --git a/src/clp_ffi_js/ir/UnstructuredIrStreamReader.hpp b/src/clp_ffi_js/ir/UnstructuredIrStreamReader.hpp index 2fb8bc26..7a104097 100644 --- a/src/clp_ffi_js/ir/UnstructuredIrStreamReader.hpp +++ b/src/clp_ffi_js/ir/UnstructuredIrStreamReader.hpp @@ -71,7 +71,7 @@ class UnstructuredIrStreamReader : public StreamReader { [[nodiscard]] auto decode_range(size_t begin_idx, size_t end_idx, bool use_filter) const -> DecodedResultsTsType override; - [[nodiscard]] auto get_log_event_idx_by_timestamp(clp::ir::epoch_time_ms_t timestamp + [[nodiscard]] auto get_log_event_idx_with_nearest_timestamp(clp::ir::epoch_time_ms_t target_ts ) -> LogEventIdxTsType override; private: