From 33aeb993677b31d19f51980e86dcd2cfd670bf42 Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Thu, 9 Jan 2025 12:23:05 -0500 Subject: [PATCH 1/2] Update to clang-format v19 --- components/core/src/clp/BoundedReader.hpp | 4 +- components/core/src/clp/BufferReader.cpp | 9 +-- components/core/src/clp/BufferReader.hpp | 13 ++--- .../core/src/clp/BufferedFileReader.cpp | 9 +-- .../core/src/clp/BufferedFileReader.hpp | 17 +++--- components/core/src/clp/FileDescriptor.cpp | 2 +- .../core/src/clp/FileDescriptorReader.hpp | 4 +- components/core/src/clp/Grep.cpp | 6 +- components/core/src/clp/NetworkReader.cpp | 12 ++-- components/core/src/clp/NetworkReader.hpp | 12 ++-- components/core/src/clp/Thread.hpp | 2 +- .../src/clp/aws/AwsAuthenticationSigner.cpp | 22 ++++---- .../src/clp/aws/AwsAuthenticationSigner.hpp | 11 ++-- .../core/src/clp/error_handling/ErrorCode.hpp | 14 ++--- .../core/src/clp/ffi/KeyValuePairLogEvent.cpp | 16 +++--- .../core/src/clp/ffi/KeyValuePairLogEvent.hpp | 12 ++-- components/core/src/clp/ffi/SchemaTree.hpp | 4 +- .../src/clp/ffi/ir_stream/Deserializer.hpp | 8 +-- .../core/src/clp/ffi/ir_stream/Serializer.cpp | 56 +++++++++---------- .../core/src/clp/ffi/ir_stream/Serializer.hpp | 8 +-- .../clp/ffi/ir_stream/decoding_methods.hpp | 4 +- .../clp/ffi/ir_stream/encoding_methods.cpp | 7 +-- .../ir_unit_deserialization_methods.cpp | 41 ++++++-------- .../ir_unit_deserialization_methods.hpp | 4 +- .../core/src/clp/ffi/ir_stream/utils.hpp | 20 +++---- .../core/src/clp/ffi/search/query_methods.cpp | 6 +- components/core/src/clp/ffi/utils.hpp | 8 +-- components/core/src/clp/hash_utils.hpp | 7 +-- components/core/src/clp/ir/EncodedTextAst.cpp | 8 +-- .../core/src/clp/ir/LogEventDeserializer.cpp | 24 ++++---- .../core/src/clp/ir/LogEventDeserializer.hpp | 8 +-- .../core/src/clp/ir/LogEventSerializer.cpp | 8 +-- .../core/src/clp/ir/LogEventSerializer.hpp | 4 +- .../RegexToWildcardTranslatorConfig.hpp | 2 +- .../core/src/clp/regex_utils/constants.hpp | 4 +- .../regex_utils/regex_translation_utils.hpp | 11 ++-- .../clp/streaming_archive/reader/Archive.cpp | 13 ++--- .../clp/streaming_archive/reader/Segment.hpp | 2 +- .../clp/streaming_archive/writer/Archive.cpp | 7 +-- components/core/src/clp/utf8_utils.hpp | 4 +- components/core/src/clp_s/ArchiveWriter.cpp | 7 +-- components/core/src/clp_s/ColumnReader.cpp | 24 +++----- components/core/src/clp_s/DictionaryEntry.cpp | 14 ++--- .../core/src/clp_s/DictionaryWriter.cpp | 6 +- components/core/src/clp_s/InputConfig.hpp | 8 +-- components/core/src/clp_s/JsonParser.cpp | 4 +- .../core/src/clp_s/PackedStreamReader.cpp | 7 +-- components/core/src/clp_s/SchemaReader.cpp | 7 +-- .../src/clp_s/TimestampDictionaryWriter.cpp | 14 ++--- components/core/src/clp_s/Utils.cpp | 7 +-- components/core/src/clp_s/Utils.hpp | 3 +- .../core/src/clp_s/search/BooleanLiteral.hpp | 2 +- .../core/src/clp_s/search/OutputHandler.hpp | 2 +- components/core/src/glt/BufferReader.cpp | 9 +-- components/core/src/glt/BufferReader.hpp | 13 ++--- .../core/src/glt/BufferedFileReader.cpp | 9 +-- .../core/src/glt/BufferedFileReader.hpp | 17 +++--- components/core/src/glt/Grep.cpp | 6 +- .../core/src/glt/ffi/search/query_methods.cpp | 6 +- .../core/src/glt/ir/LogEventDeserializer.cpp | 24 ++++---- .../core/src/glt/ir/LogEventDeserializer.hpp | 8 +-- .../glt/streaming_archive/reader/Archive.cpp | 7 +-- .../reader/LogtypeTableManager.hpp | 2 +- .../glt/streaming_archive/reader/Message.cpp | 7 +-- .../glt/streaming_archive/reader/Segment.hpp | 2 +- .../reader/SingleLogtypeTableManager.hpp | 3 +- .../glt/streaming_archive/writer/Archive.cpp | 7 +-- components/core/src/reducer/Pipeline.hpp | 2 +- components/core/tests/test-NetworkReader.cpp | 4 +- .../tests/test-ffi_IrUnitHandlerInterface.cpp | 16 +++--- .../tests/test-ffi_KeyValuePairLogEvent.cpp | 10 ++-- components/core/tests/test-utf8_utils.cpp | 4 +- lint-requirements.txt | 3 +- tools/yscope-dev-utils | 2 +- 74 files changed, 294 insertions(+), 405 deletions(-) diff --git a/components/core/src/clp/BoundedReader.hpp b/components/core/src/clp/BoundedReader.hpp index cfcb07422..c50d31aa1 100644 --- a/components/core/src/clp/BoundedReader.hpp +++ b/components/core/src/clp/BoundedReader.hpp @@ -61,8 +61,8 @@ class BoundedReader : public ReaderInterface { * @return ErrorCode_EndOfFile on EOF or trying to read after hitting checkpoint * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override; /** * This function is unsupported because BoundedReader can not delegate to a potentially diff --git a/components/core/src/clp/BufferReader.cpp b/components/core/src/clp/BufferReader.cpp index b116b8080..b0f8f2fb2 100644 --- a/components/core/src/clp/BufferReader.cpp +++ b/components/core/src/clp/BufferReader.cpp @@ -86,12 +86,9 @@ auto BufferReader::try_get_pos(size_t& pos) -> ErrorCode { return ErrorCode_Success; } -auto BufferReader::try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - std::string& str -) -> ErrorCode { +auto +BufferReader::try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) + -> ErrorCode { if (false == append) { str.clear(); } diff --git a/components/core/src/clp/BufferReader.hpp b/components/core/src/clp/BufferReader.hpp index 349697d34..108d52543 100644 --- a/components/core/src/clp/BufferReader.hpp +++ b/components/core/src/clp/BufferReader.hpp @@ -63,8 +63,8 @@ class BufferReader : public ReaderInterface { * @return ErrorCode_EndOfFile if the buffer doesn't contain any more data * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override; /** * Tries to seek to the given position, relative to the beginning of the buffer @@ -88,12 +88,9 @@ class BufferReader : public ReaderInterface { * @param str Returns the content read from the buffer * @return Same as BufferReader::try_read_to_delimiter(char, bool, std::string&, bool&, size_t&) */ - [[nodiscard]] auto try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - std::string& str - ) -> ErrorCode override; + [[nodiscard]] auto + try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) + -> ErrorCode override; private: // Methods diff --git a/components/core/src/clp/BufferedFileReader.cpp b/components/core/src/clp/BufferedFileReader.cpp index ad6636cef..34ee57182 100644 --- a/components/core/src/clp/BufferedFileReader.cpp +++ b/components/core/src/clp/BufferedFileReader.cpp @@ -265,12 +265,9 @@ auto BufferedFileReader::try_read(char* buf, size_t num_bytes_to_read, size_t& n return ErrorCode_Success; } -auto BufferedFileReader::try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - string& str -) -> ErrorCode { +auto +BufferedFileReader::try_read_to_delimiter(char delim, bool keep_delimiter, bool append, string& str) + -> ErrorCode { if (-1 == m_fd) { return ErrorCode_NotInit; } diff --git a/components/core/src/clp/BufferedFileReader.hpp b/components/core/src/clp/BufferedFileReader.hpp index dd55e658e..74cc8bdd1 100644 --- a/components/core/src/clp/BufferedFileReader.hpp +++ b/components/core/src/clp/BufferedFileReader.hpp @@ -127,8 +127,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_NotInit if the file is not opened * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_peek_buffered_data(char const*& buf, size_t& peek_size) const -> ErrorCode; + [[nodiscard]] auto try_peek_buffered_data(char const*& buf, size_t& peek_size) const + -> ErrorCode; /** * Peeks the remaining buffered content without advancing the read head. @@ -191,8 +191,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_EndOfFile on EOF * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override; /** * Tries to read up to an occurrence of the given delimiter @@ -206,12 +206,9 @@ class BufferedFileReader : public ReaderInterface { * @return Same as BufferReader::try_read_to_delimiter if it fails * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - std::string& str - ) -> ErrorCode override; + [[nodiscard]] auto + try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) + -> ErrorCode override; private: // Methods diff --git a/components/core/src/clp/FileDescriptor.cpp b/components/core/src/clp/FileDescriptor.cpp index 480859bd7..8bc466338 100644 --- a/components/core/src/clp/FileDescriptor.cpp +++ b/components/core/src/clp/FileDescriptor.cpp @@ -48,7 +48,7 @@ FileDescriptor::~FileDescriptor() { } auto FileDescriptor::get_size() const -> size_t { - struct stat stat_result {}; + struct stat stat_result{}; if (ErrorCode_Success != stat(stat_result)) { throw OperationFailed( diff --git a/components/core/src/clp/FileDescriptorReader.hpp b/components/core/src/clp/FileDescriptorReader.hpp index ca751471a..41b9eb501 100644 --- a/components/core/src/clp/FileDescriptorReader.hpp +++ b/components/core/src/clp/FileDescriptorReader.hpp @@ -65,8 +65,8 @@ class FileDescriptorReader : public ReaderInterface { * @return ErrorCode_EndOfFile on EOF * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override; /** * Tries to seek to the given position, relative to the beginning of the file. diff --git a/components/core/src/clp/Grep.cpp b/components/core/src/clp/Grep.cpp index c59e21ca1..a53679edf 100644 --- a/components/core/src/clp/Grep.cpp +++ b/components/core/src/clp/Grep.cpp @@ -890,10 +890,8 @@ bool Grep::get_bounds_of_next_potential_var( return (value_length != begin_pos); } -void Grep::calculate_sub_queries_relevant_to_file( - File const& compressed_file, - vector& queries -) { +void +Grep::calculate_sub_queries_relevant_to_file(File const& compressed_file, vector& queries) { for (auto& query : queries) { query.make_sub_queries_relevant_to_segment(compressed_file.get_segment_id()); } diff --git a/components/core/src/clp/NetworkReader.cpp b/components/core/src/clp/NetworkReader.cpp index 086b60681..f76ec56e7 100644 --- a/components/core/src/clp/NetworkReader.cpp +++ b/components/core/src/clp/NetworkReader.cpp @@ -108,8 +108,8 @@ extern "C" auto curl_progress_callback( * @return On success, the number of bytes processed. If this is less than `nmemb`, the download * will be aborted. */ -extern "C" auto -curl_write_callback(char* ptr, size_t size, size_t nmemb, void* reader_ptr) -> size_t { +extern "C" auto curl_write_callback(char* ptr, size_t size, size_t nmemb, void* reader_ptr) + -> size_t { return static_cast(reader_ptr)->buffer_downloaded_data({ptr, size * nmemb}); } } // namespace @@ -304,11 +304,9 @@ auto NetworkReader::get_filled_buffer() -> void { m_curr_reader_buf.emplace(next_reader_buffer); } -auto NetworkReader::read_from_filled_buffers( - size_t num_bytes_to_read, - size_t& num_bytes_read, - char* dst -) -> ErrorCode { +auto +NetworkReader::read_from_filled_buffers(size_t num_bytes_to_read, size_t& num_bytes_read, char* dst) + -> ErrorCode { num_bytes_read = 0; std::optional dst_view; if (nullptr != dst) { diff --git a/components/core/src/clp/NetworkReader.hpp b/components/core/src/clp/NetworkReader.hpp index 08be975ea..7cc2b0d90 100644 --- a/components/core/src/clp/NetworkReader.hpp +++ b/components/core/src/clp/NetworkReader.hpp @@ -132,8 +132,8 @@ class NetworkReader : public ReaderInterface { * @return ErrorCode_EndOfFile if there is no more buffered data. * @return ErrorCode_Success on success. */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override { + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override { return read_from_filled_buffers(num_bytes_to_read, num_bytes_read, buf); } @@ -306,11 +306,9 @@ class NetworkReader : public ReaderInterface { * @return ErrorCode_EndOfFile if the buffer doesn't contain any more data. * @return ErrorCode_Success on success. */ - [[nodiscard]] auto read_from_filled_buffers( - size_t num_bytes_to_read, - size_t& num_bytes_read, - char* dst - ) -> ErrorCode; + [[nodiscard]] auto + read_from_filled_buffers(size_t num_bytes_to_read, size_t& num_bytes_read, char* dst) + -> ErrorCode; /** * Sets the download completion status with the return code from curl. diff --git a/components/core/src/clp/Thread.hpp b/components/core/src/clp/Thread.hpp index f6d8ba15b..d505fdc6c 100644 --- a/components/core/src/clp/Thread.hpp +++ b/components/core/src/clp/Thread.hpp @@ -28,7 +28,7 @@ class Thread { }; // Constructors - Thread() : m_thread_running(false) {}; + Thread() : m_thread_running(false) {} // Destructor virtual ~Thread(); diff --git a/components/core/src/clp/aws/AwsAuthenticationSigner.cpp b/components/core/src/clp/aws/AwsAuthenticationSigner.cpp index ae4da33a2..0b2d6fdb9 100644 --- a/components/core/src/clp/aws/AwsAuthenticationSigner.cpp +++ b/components/core/src/clp/aws/AwsAuthenticationSigner.cpp @@ -43,8 +43,8 @@ namespace { * @param timestamp * @return The formatted date string. */ -[[nodiscard]] auto get_formatted_date_string(std::chrono::system_clock::time_point const& timestamp -) -> string; +[[nodiscard]] auto get_formatted_date_string(std::chrono::system_clock::time_point const& timestamp) + -> string; /** * Gets the string to sign required by AWS Signature Version 4 protocol. @@ -89,8 +89,8 @@ auto is_unreserved_characters(char c) -> bool { return is_alphabet(c) || is_decimal_digit(c) || c == '-' || c == '_' || c == '.' || c == '~'; } -auto get_formatted_timestamp_string(std::chrono::system_clock::time_point const& timestamp -) -> string { +auto get_formatted_timestamp_string(std::chrono::system_clock::time_point const& timestamp) + -> string { return fmt::format("{:%Y%m%dT%H%M%SZ}", timestamp); } @@ -203,10 +203,9 @@ S3Url::S3Url(string const& url) { m_host = fmt::format("{}.s3.{}.{}", m_bucket, m_region, m_end_point); } -auto AwsAuthenticationSigner::generate_presigned_url( - S3Url const& s3_url, - string& presigned_url -) const -> ErrorCode { +auto +AwsAuthenticationSigner::generate_presigned_url(S3Url const& s3_url, string& presigned_url) const + -> ErrorCode { auto const s3_region = s3_url.get_region(); auto const now = std::chrono::system_clock::now(); @@ -245,10 +244,9 @@ auto AwsAuthenticationSigner::generate_presigned_url( return ErrorCode_Success; } -auto AwsAuthenticationSigner::get_canonical_query_string( - string_view scope, - string_view timestamp -) const -> string { +auto +AwsAuthenticationSigner::get_canonical_query_string(string_view scope, string_view timestamp) const + -> string { auto const uri = fmt::format("{}/{}", m_access_key_id, scope); return fmt::format( "{}={}&{}={}&{}={}&{}={}&{}={}", diff --git a/components/core/src/clp/aws/AwsAuthenticationSigner.hpp b/components/core/src/clp/aws/AwsAuthenticationSigner.hpp index a0a82eb2a..293ffcd4c 100644 --- a/components/core/src/clp/aws/AwsAuthenticationSigner.hpp +++ b/components/core/src/clp/aws/AwsAuthenticationSigner.hpp @@ -82,8 +82,8 @@ class AwsAuthenticationSigner { * @return ErrorCode_Success on success. * @return Same as `get_sha256_hash` and `AwsAuthenticationSigner::get_signature` on failure. */ - [[nodiscard]] auto - generate_presigned_url(S3Url const& s3_url, std::string& presigned_url) const -> ErrorCode; + [[nodiscard]] auto generate_presigned_url(S3Url const& s3_url, std::string& presigned_url) const + -> ErrorCode; private: /** @@ -92,10 +92,9 @@ class AwsAuthenticationSigner { * @param timestamp * @return The canonical query string. */ - [[nodiscard]] auto get_canonical_query_string( - std::string_view scope, - std::string_view timestamp - ) const -> std::string; + [[nodiscard]] auto + get_canonical_query_string(std::string_view scope, std::string_view timestamp) const + -> std::string; /** * Gets the signature signing key for the request. diff --git a/components/core/src/clp/error_handling/ErrorCode.hpp b/components/core/src/clp/error_handling/ErrorCode.hpp index 2612e7768..bc309adcd 100644 --- a/components/core/src/clp/error_handling/ErrorCode.hpp +++ b/components/core/src/clp/error_handling/ErrorCode.hpp @@ -47,10 +47,9 @@ class ErrorCategory : public std::error_category { * @param condition * @return Whether the error condition of the given error matches the given condition. */ - [[nodiscard]] auto equivalent( - int error_num, - std::error_condition const& condition - ) const noexcept -> bool override { + [[nodiscard]] auto + equivalent(int error_num, std::error_condition const& condition) const noexcept + -> bool override { return equivalent(static_cast(error_num), condition); } @@ -69,10 +68,9 @@ class ErrorCategory : public std::error_category { * @param condition * @return Whether the error condition of the given error matches the given condition. */ - [[nodiscard]] auto equivalent( - ErrorCodeEnum error_enum, - std::error_condition const& condition - ) const noexcept -> bool; + [[nodiscard]] auto + equivalent(ErrorCodeEnum error_enum, std::error_condition const& condition) const noexcept + -> bool; }; /** diff --git a/components/core/src/clp/ffi/KeyValuePairLogEvent.cpp b/components/core/src/clp/ffi/KeyValuePairLogEvent.cpp index 8e8bb15f5..a02ce1c7e 100644 --- a/components/core/src/clp/ffi/KeyValuePairLogEvent.cpp +++ b/components/core/src/clp/ffi/KeyValuePairLogEvent.cpp @@ -119,8 +119,8 @@ class JsonSerializationIterator { * @param value * @return Whether the given schema tree node type matches the given value's type. */ -[[nodiscard]] auto -node_type_matches_value_type(SchemaTree::Node::Type type, Value const& value) -> bool; +[[nodiscard]] auto node_type_matches_value_type(SchemaTree::Node::Type type, Value const& value) + -> bool; /** * Validates whether the given node-ID value pairs are leaf nodes in the `SchemaTree` forming a @@ -560,18 +560,18 @@ auto KeyValuePairLogEvent::create( }; } -auto KeyValuePairLogEvent::get_auto_gen_keys_schema_subtree_bitmap( -) const -> OUTCOME_V2_NAMESPACE::std_result> { +auto KeyValuePairLogEvent::get_auto_gen_keys_schema_subtree_bitmap() const + -> OUTCOME_V2_NAMESPACE::std_result> { 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> { +auto KeyValuePairLogEvent::get_user_gen_keys_schema_subtree_bitmap() const + -> outcome_v2::std_result> { 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> { +auto KeyValuePairLogEvent::serialize_to_json() const + -> OUTCOME_V2_NAMESPACE::std_result> { auto const auto_gen_keys_schema_subtree_bitmap_result{get_auto_gen_keys_schema_subtree_bitmap() }; if (auto_gen_keys_schema_subtree_bitmap_result.has_error()) { diff --git a/components/core/src/clp/ffi/KeyValuePairLogEvent.hpp b/components/core/src/clp/ffi/KeyValuePairLogEvent.hpp index 2929c7498..02aa05843 100644 --- a/components/core/src/clp/ffi/KeyValuePairLogEvent.hpp +++ b/components/core/src/clp/ffi/KeyValuePairLogEvent.hpp @@ -85,8 +85,8 @@ class KeyValuePairLogEvent { * an error code indicating a failure: * - Forwards `get_schema_subtree_bitmap`'s return values. */ - [[nodiscard]] auto get_auto_gen_keys_schema_subtree_bitmap( - ) const -> OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto get_auto_gen_keys_schema_subtree_bitmap() const + -> OUTCOME_V2_NAMESPACE::std_result>; /** * @return A result containing a bitmap where every bit corresponds to the ID of a node in the @@ -95,8 +95,8 @@ class KeyValuePairLogEvent { * an error code indicating a failure: * - Forwards `get_schema_subtree_bitmap`'s return values. */ - [[nodiscard]] auto get_user_gen_keys_schema_subtree_bitmap( - ) const -> OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto get_user_gen_keys_schema_subtree_bitmap() const + -> OUTCOME_V2_NAMESPACE::std_result>; [[nodiscard]] auto get_utc_offset() const -> UtcOffset { return m_utc_offset; } @@ -110,8 +110,8 @@ class KeyValuePairLogEvent { * - Forwards `get_auto_gen_keys_schema_subtree_bitmap`'s return values on failure. * - Forwards `serialize_node_id_value_pairs_to_json`'s return values on failure. */ - [[nodiscard]] auto serialize_to_json( - ) const -> OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto serialize_to_json() const + -> OUTCOME_V2_NAMESPACE::std_result>; private: // Constructor diff --git a/components/core/src/clp/ffi/SchemaTree.hpp b/components/core/src/clp/ffi/SchemaTree.hpp index 4efbbf81e..067f573d0 100644 --- a/components/core/src/clp/ffi/SchemaTree.hpp +++ b/components/core/src/clp/ffi/SchemaTree.hpp @@ -272,8 +272,8 @@ class SchemaTree { * @return The node's ID if it exists. * @return std::nullopt otherwise. */ - [[nodiscard]] auto try_get_node_id(NodeLocator const& locator - ) const -> std::optional; + [[nodiscard]] auto try_get_node_id(NodeLocator const& locator) const + -> std::optional; /** * @param locator diff --git a/components/core/src/clp/ffi/ir_stream/Deserializer.hpp b/components/core/src/clp/ffi/ir_stream/Deserializer.hpp index d31699cd2..fd9db9fb6 100644 --- a/components/core/src/clp/ffi/ir_stream/Deserializer.hpp +++ b/components/core/src/clp/ffi/ir_stream/Deserializer.hpp @@ -95,8 +95,8 @@ class Deserializer { * - Forwards `handle_end_of_stream`'s return values from the user-defined IR unit handler on * unit handling failure. */ - [[nodiscard]] auto deserialize_next_ir_unit(ReaderInterface& reader - ) -> OUTCOME_V2_NAMESPACE::std_result; + [[nodiscard]] auto deserialize_next_ir_unit(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result; /** * @return Whether the stream has completed. A stream is considered completed if an @@ -165,8 +165,8 @@ auto Deserializer::create(ReaderInterface& reader, IrUnitHandler template requires(std::move_constructible) -auto Deserializer::deserialize_next_ir_unit(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result { +auto Deserializer::deserialize_next_ir_unit(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result { if (is_stream_completed()) { return std::errc::operation_not_permitted; } diff --git a/components/core/src/clp/ffi/ir_stream/Serializer.cpp b/components/core/src/clp/ffi/ir_stream/Serializer.cpp index 295ab356c..4ca24cc1c 100644 --- a/components/core/src/clp/ffi/ir_stream/Serializer.cpp +++ b/components/core/src/clp/ffi/ir_stream/Serializer.cpp @@ -82,8 +82,8 @@ class MsgpackMapIterator { * @return The corresponding schema-tree node type. * @return std::nullopt if the value doesn't match any of the supported schema-tree node types. */ -[[nodiscard]] auto get_schema_tree_node_type_from_msgpack_val(msgpack::object const& val -) -> optional; +[[nodiscard]] auto get_schema_tree_node_type_from_msgpack_val(msgpack::object const& val) + -> optional; /** * Serializes an empty object. @@ -140,11 +140,9 @@ serialize_value_string(string_view val, string& logtype_buf, vector& out * @return Whether serialization succeeded. */ template -[[nodiscard]] auto serialize_value_array( - msgpack::object const& val, - string& logtype_buf, - vector& output_buf -) -> bool; +[[nodiscard]] auto +serialize_value_array(msgpack::object const& val, string& logtype_buf, vector& output_buf) + -> bool; /** * Checks whether the given msgpack array can be serialized into the key-value pair IR format. @@ -156,8 +154,8 @@ template */ [[nodiscard]] auto is_msgpack_array_serializable(msgpack::object const& array) -> bool; -auto get_schema_tree_node_type_from_msgpack_val(msgpack::object const& val -) -> optional { +auto get_schema_tree_node_type_from_msgpack_val(msgpack::object const& val) + -> optional { optional ret_val; switch (val.type) { case msgpack::type::POSITIVE_INTEGER: @@ -231,11 +229,9 @@ auto serialize_value_string(string_view val, string& logtype_buf, vector } template -auto serialize_value_array( - msgpack::object const& val, - string& logtype_buf, - vector& output_buf -) -> bool { +auto +serialize_value_array(msgpack::object const& val, string& logtype_buf, vector& output_buf) + -> bool { if (false == is_msgpack_array_serializable(val)) { return false; } @@ -289,8 +285,8 @@ auto is_msgpack_array_serializable(msgpack::object const& array) -> bool { } // namespace template -auto Serializer::create( -) -> OUTCOME_V2_NAMESPACE::std_result> { +auto Serializer::create() + -> OUTCOME_V2_NAMESPACE::std_result> { static_assert( (std::is_same_v || std::is_same_v) @@ -331,8 +327,8 @@ auto Serializer::change_utc_offset(UtcOffset utc_offset) -> } template -auto Serializer::serialize_msgpack_map(msgpack::object_map const& msgpack_map -) -> bool { +auto Serializer::serialize_msgpack_map(msgpack::object_map const& msgpack_map) + -> bool { if (0 == msgpack_map.size) { serialize_value_empty_object(m_ir_buf); return true; @@ -554,15 +550,15 @@ auto Serializer::serialize_msgpack_map_using_dfs( // Explicitly declare template specializations so that we can define the template methods in this // file -template auto Serializer::create( -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto Serializer::create( -) -> OUTCOME_V2_NAMESPACE::std_result>; +template auto Serializer::create() + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto Serializer::create() + -> OUTCOME_V2_NAMESPACE::std_result>; -template auto Serializer::change_utc_offset(UtcOffset utc_offset -) -> void; -template auto Serializer::change_utc_offset(UtcOffset utc_offset -) -> void; +template auto Serializer::change_utc_offset(UtcOffset utc_offset) + -> void; +template auto Serializer::change_utc_offset(UtcOffset utc_offset) + -> void; template auto Serializer::serialize_msgpack_map( msgpack::object_map const& msgpack_map @@ -578,10 +574,10 @@ template auto Serializer::serialize_schema_tree_no SchemaTree::NodeLocator const& locator ) -> bool; -template auto Serializer::serialize_key(SchemaTree::Node::id_t id -) -> bool; -template auto Serializer::serialize_key(SchemaTree::Node::id_t id -) -> bool; +template auto Serializer::serialize_key(SchemaTree::Node::id_t id) + -> bool; +template auto Serializer::serialize_key(SchemaTree::Node::id_t id) + -> bool; template auto Serializer::serialize_val( msgpack::object const& val, diff --git a/components/core/src/clp/ffi/ir_stream/Serializer.hpp b/components/core/src/clp/ffi/ir_stream/Serializer.hpp index edc6bf0cb..43fb8e796 100644 --- a/components/core/src/clp/ffi/ir_stream/Serializer.hpp +++ b/components/core/src/clp/ffi/ir_stream/Serializer.hpp @@ -42,8 +42,8 @@ class Serializer { * @return A result containing the serializer or an error code indicating the failure: * - std::errc::protocol_error on failure to serialize the preamble. */ - [[nodiscard]] static auto create( - ) -> OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] static auto create() + -> OUTCOME_V2_NAMESPACE::std_result>; // Disable copy constructor/assignment operator Serializer(Serializer const&) = delete; @@ -121,8 +121,8 @@ class Serializer { * @param msgpack_map * @return Whether serialization succeeded. */ - [[nodiscard]] auto serialize_msgpack_map_using_dfs(msgpack::object_map const& msgpack_map - ) -> bool; + [[nodiscard]] auto serialize_msgpack_map_using_dfs(msgpack::object_map const& msgpack_map) + -> bool; UtcOffset m_curr_utc_offset{0}; Buffer m_ir_buf; diff --git a/components/core/src/clp/ffi/ir_stream/decoding_methods.hpp b/components/core/src/clp/ffi/ir_stream/decoding_methods.hpp index a9bc5c4fd..61333274a 100644 --- a/components/core/src/clp/ffi/ir_stream/decoding_methods.hpp +++ b/components/core/src/clp/ffi/ir_stream/decoding_methods.hpp @@ -205,8 +205,8 @@ IRErrorCode deserialize_utc_offset_change(ReaderInterface& reader, UtcOffset& ut * @return IRProtocolErrorCode::Invalid if the protocol version does not follow the SemVer * specification. */ -[[nodiscard]] auto validate_protocol_version(std::string_view protocol_version -) -> IRProtocolErrorCode; +[[nodiscard]] auto validate_protocol_version(std::string_view protocol_version) + -> IRProtocolErrorCode; namespace eight_byte_encoding { /** diff --git a/components/core/src/clp/ffi/ir_stream/encoding_methods.cpp b/components/core/src/clp/ffi/ir_stream/encoding_methods.cpp index 7c036de0d..adec02707 100644 --- a/components/core/src/clp/ffi/ir_stream/encoding_methods.cpp +++ b/components/core/src/clp/ffi/ir_stream/encoding_methods.cpp @@ -148,11 +148,8 @@ bool serialize_log_event( return true; } -bool serialize_message( - std::string_view message, - std::string& logtype, - std::vector& ir_buf -) { +bool +serialize_message(std::string_view message, std::string& logtype, std::vector& ir_buf) { auto encoded_var_handler = [&ir_buf](eight_byte_encoded_variable_t encoded_var) { ir_buf.push_back(cProtocol::Payload::VarEightByteEncoding); serialize_int(encoded_var, ir_buf); diff --git a/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp b/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp index cea4a1b84..3765d98d6 100644 --- a/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp +++ b/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp @@ -38,8 +38,8 @@ using Schema = std::vector; * @return The corresponding schema tree node type on success. * @return std::nullopt if the tag doesn't match to any defined schema tree node type. */ -[[nodiscard]] auto schema_tree_node_tag_to_type(encoded_tag_t tag -) -> std::optional; +[[nodiscard]] auto schema_tree_node_tag_to_type(encoded_tag_t tag) + -> std::optional; /** * Deserializes the parent ID of a schema tree node. @@ -52,8 +52,8 @@ using Schema = std::vector; * - Forwards `deserialize_tag`'s return values. * @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>; +[[nodiscard]] auto deserialize_schema_tree_node_parent_id(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; /** * Deserializes the key name of a schema tree node. @@ -63,10 +63,9 @@ using Schema = std::vector; * @return Forwards `deserialize_tag`'s return values on failure. * @return Forwards `deserialize_string`'s return values on failure. */ -[[nodiscard]] auto deserialize_schema_tree_node_key_name( - ReaderInterface& reader, - std::string& key_name -) -> IRErrorCode; +[[nodiscard]] auto +deserialize_schema_tree_node_key_name(ReaderInterface& reader, std::string& key_name) + -> IRErrorCode; /** * Deserializes an integer value packet. @@ -78,8 +77,8 @@ using Schema = std::vector; * @return IRErrorCode::IRErrorCode_Corrupted_IR if the given tag doesn't correspond to an integer * packet. */ -[[nodiscard]] auto -deserialize_int_val(ReaderInterface& reader, encoded_tag_t tag, value_int_t& val) -> IRErrorCode; +[[nodiscard]] auto deserialize_int_val(ReaderInterface& reader, encoded_tag_t tag, value_int_t& val) + -> IRErrorCode; /** * Deserializes a string packet. @@ -91,11 +90,9 @@ deserialize_int_val(ReaderInterface& reader, encoded_tag_t tag, value_int_t& val * @return IRErrorCode::IRErrorCode_Corrupted_IR if the given tag doesn't correspond to a string * packet. */ -[[nodiscard]] auto deserialize_string( - ReaderInterface& reader, - encoded_tag_t tag, - std::string& deserialized_str -) -> IRErrorCode; +[[nodiscard]] auto +deserialize_string(ReaderInterface& reader, encoded_tag_t tag, std::string& deserialized_str) + -> IRErrorCode; /** * Deserializes the IDs of all keys in a log event. @@ -142,8 +139,7 @@ deserialize_int_val(ReaderInterface& reader, encoded_tag_t tag, value_int_t& val * @return Forwards `deserialize_encoded_text_ast`'s return values on failure. */ template -requires(std::is_same_v - || std::is_same_v) +requires(std::is_same_v || std::is_same_v) [[nodiscard]] auto deserialize_encoded_text_ast_and_insert_to_node_id_value_pairs( ReaderInterface& reader, SchemaTree::Node::id_t node_id, @@ -202,8 +198,8 @@ auto schema_tree_node_tag_to_type(encoded_tag_t tag) -> std::optional OUTCOME_V2_NAMESPACE::std_result> { +auto deserialize_schema_tree_node_parent_id(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result> { encoded_tag_t tag{}; if (auto const err{deserialize_tag(reader, tag)}; IRErrorCode::IRErrorCode_Success != err) { return ir_error_code_to_errc(err); @@ -398,8 +394,7 @@ auto deserialize_value_and_insert_to_node_id_value_pairs( } template -requires(std::is_same_v - || std::is_same_v) +requires(std::is_same_v || std::is_same_v) [[nodiscard]] auto deserialize_encoded_text_ast_and_insert_to_node_id_value_pairs( ReaderInterface& reader, SchemaTree::Node::id_t node_id, @@ -537,8 +532,8 @@ auto deserialize_ir_unit_schema_tree_node_insertion( return SchemaTree::NodeLocator{parent_id, key_name, type.value()}; } -auto deserialize_ir_unit_utc_offset_change(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result { +auto deserialize_ir_unit_utc_offset_change(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result { UtcOffset utc_offset{0}; if (auto const err{deserialize_utc_offset_change(reader, utc_offset)}; IRErrorCode::IRErrorCode_Success != err) diff --git a/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.hpp b/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.hpp index 451f627db..a85c63e05 100644 --- a/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.hpp +++ b/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.hpp @@ -50,8 +50,8 @@ namespace clp::ffi::ir_stream { * - std::errc::result_out_of_range if the IR stream is truncated. * - Forwards `clp::ffi::ir_stream::deserialize_utc_offset_change`'s return values. */ -[[nodiscard]] auto deserialize_ir_unit_utc_offset_change(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result; +[[nodiscard]] auto deserialize_ir_unit_utc_offset_change(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result; /** * Deserializes a key-value pair log event IR unit. diff --git a/components/core/src/clp/ffi/ir_stream/utils.hpp b/components/core/src/clp/ffi/ir_stream/utils.hpp index 3e545c4fe..cde5cd860 100644 --- a/components/core/src/clp/ffi/ir_stream/utils.hpp +++ b/components/core/src/clp/ffi/ir_stream/utils.hpp @@ -29,8 +29,8 @@ namespace clp::ffi::ir_stream { * @param output_buf * @return Whether serialization succeeded. */ -[[nodiscard]] auto -serialize_metadata(nlohmann::json& metadata, std::vector& output_buf) -> bool; +[[nodiscard]] auto serialize_metadata(nlohmann::json& metadata, std::vector& output_buf) + -> bool; /** * Serializes the given integer into the IR stream. @@ -60,11 +60,9 @@ template * @return Whether serialization succeeded. */ template -[[nodiscard]] auto serialize_clp_string( - std::string_view str, - std::string& logtype, - std::vector& output_buf -) -> bool; +[[nodiscard]] auto +serialize_clp_string(std::string_view str, std::string& logtype, std::vector& output_buf) + -> bool; /** * Serializes a string. @@ -173,11 +171,9 @@ auto deserialize_int(ReaderInterface& reader, integer_t& value) -> bool { } template -[[nodiscard]] auto serialize_clp_string( - std::string_view str, - std::string& logtype, - std::vector& output_buf -) -> bool { +[[nodiscard]] auto +serialize_clp_string(std::string_view str, std::string& logtype, std::vector& output_buf) + -> bool { static_assert( (std::is_same_v || std::is_same_v) diff --git a/components/core/src/clp/ffi/search/query_methods.cpp b/components/core/src/clp/ffi/search/query_methods.cpp index 880b16e2e..a3cf3e614 100644 --- a/components/core/src/clp/ffi/search/query_methods.cpp +++ b/components/core/src/clp/ffi/search/query_methods.cpp @@ -66,10 +66,8 @@ static void tokenize_query( ); template -void generate_subqueries( - string_view wildcard_query, - vector>& sub_queries -) { +void +generate_subqueries(string_view wildcard_query, vector>& sub_queries) { if (wildcard_query.empty()) { throw QueryMethodFailed( ErrorCode_BadParam, diff --git a/components/core/src/clp/ffi/utils.hpp b/components/core/src/clp/ffi/utils.hpp index 26823da9c..768ffbe8f 100644 --- a/components/core/src/clp/ffi/utils.hpp +++ b/components/core/src/clp/ffi/utils.hpp @@ -13,8 +13,8 @@ namespace clp::ffi { * @return The escaped string on success. * @return std::nullopt if the string contains any non-UTF-8-encoded byte sequences. */ -[[nodiscard]] auto validate_and_escape_utf8_string(std::string_view raw -) -> std::optional; +[[nodiscard]] auto validate_and_escape_utf8_string(std::string_view raw) + -> std::optional; /** * Validates whether `src` is UTF-8 encoded, and appends `src` to `dst` while escaping any @@ -24,8 +24,8 @@ namespace clp::ffi { * @return Whether `src` is a valid UTF-8-encoded string. NOTE: Even if `src` is not UTF-8 encoded, * `dst` may be modified. */ -[[nodiscard]] auto -validate_and_append_escaped_utf8_string(std::string_view src, std::string& dst) -> bool; +[[nodiscard]] auto validate_and_append_escaped_utf8_string(std::string_view src, std::string& dst) + -> bool; } // namespace clp::ffi #endif // CLP_FFI_UTILS_HPP diff --git a/components/core/src/clp/hash_utils.hpp b/components/core/src/clp/hash_utils.hpp index 4606aed23..98255da55 100644 --- a/components/core/src/clp/hash_utils.hpp +++ b/components/core/src/clp/hash_utils.hpp @@ -69,9 +69,8 @@ class HashUtilsOperationFailed : public TraceableException { * @return Same as `EvpDigestContext::digest_final` if `EvpDigestContext::digest_final` fails. * @throw HashUtilsOperationFailed if an OpenSSL EVP digest couldn't be created. */ -[[nodiscard]] auto get_sha256_hash( - std::span input, - std::vector& hash -) -> ErrorCode; +[[nodiscard]] auto +get_sha256_hash(std::span input, std::vector& hash) + -> ErrorCode; } // namespace clp #endif // CLP_HASH_UTILS_HPP diff --git a/components/core/src/clp/ir/EncodedTextAst.cpp b/components/core/src/clp/ir/EncodedTextAst.cpp index 72a8f2729..148d74d08 100644 --- a/components/core/src/clp/ir/EncodedTextAst.cpp +++ b/components/core/src/clp/ir/EncodedTextAst.cpp @@ -50,8 +50,8 @@ auto EncodedTextAst::decode_and_unparse() const -> optional< // Explicitly declare template specializations so that we can define the template methods in this // file -template auto EncodedTextAst::decode_and_unparse( -) const -> optional; -template auto EncodedTextAst::decode_and_unparse( -) const -> optional; +template auto EncodedTextAst::decode_and_unparse() const + -> optional; +template auto EncodedTextAst::decode_and_unparse() const + -> optional; } // namespace clp::ir diff --git a/components/core/src/clp/ir/LogEventDeserializer.cpp b/components/core/src/clp/ir/LogEventDeserializer.cpp index 8a1064a78..a2bfc87db 100644 --- a/components/core/src/clp/ir/LogEventDeserializer.cpp +++ b/components/core/src/clp/ir/LogEventDeserializer.cpp @@ -13,8 +13,8 @@ namespace clp::ir { template -auto LogEventDeserializer::create(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result> { ffi::ir_stream::encoded_tag_t metadata_type{0}; std::vector metadata; auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata); @@ -69,8 +69,8 @@ auto LogEventDeserializer::create(ReaderInterface& reader } template -auto LogEventDeserializer::deserialize_log_event( -) -> OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result> { // Process any packets before the log event ffi::ir_stream::encoded_tag_t tag{}; while (true) { @@ -134,12 +134,12 @@ auto LogEventDeserializer::deserialize_log_event( // Explicitly declare template specializations so that we can define the template methods in this // file -template auto LogEventDeserializer::create(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::create(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event( -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event( -) -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result>; } // namespace clp::ir diff --git a/components/core/src/clp/ir/LogEventDeserializer.hpp b/components/core/src/clp/ir/LogEventDeserializer.hpp index a8bb4dc20..6a6bc049a 100644 --- a/components/core/src/clp/ir/LogEventDeserializer.hpp +++ b/components/core/src/clp/ir/LogEventDeserializer.hpp @@ -34,8 +34,8 @@ class LogEventDeserializer { * - std::errc::protocol_not_supported if the IR stream contains an unsupported metadata format * or uses an unsupported version */ - static auto create(ReaderInterface& reader - ) -> OUTCOME_V2_NAMESPACE::std_result>; + static auto create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; // Delete copy constructor and assignment LogEventDeserializer(LogEventDeserializer const&) = delete; @@ -61,8 +61,8 @@ class LogEventDeserializer { * - std::errc::result_out_of_range if the IR stream is truncated * - std::errc::protocol_error if the IR stream is corrupted */ - [[nodiscard]] auto deserialize_log_event( - ) -> OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result>; private: // Constructors diff --git a/components/core/src/clp/ir/LogEventSerializer.cpp b/components/core/src/clp/ir/LogEventSerializer.cpp index 13c94714c..3e8365541 100644 --- a/components/core/src/clp/ir/LogEventSerializer.cpp +++ b/components/core/src/clp/ir/LogEventSerializer.cpp @@ -139,10 +139,10 @@ auto LogEventSerializer::close_writer() -> void { // file template LogEventSerializer::~LogEventSerializer(); template LogEventSerializer::~LogEventSerializer(); -template auto LogEventSerializer::open(string const& file_path -) -> bool; -template auto LogEventSerializer::open(string const& file_path -) -> bool; +template auto LogEventSerializer::open(string const& file_path) + -> bool; +template auto LogEventSerializer::open(string const& file_path) + -> bool; template auto LogEventSerializer::flush() -> void; template auto LogEventSerializer::flush() -> void; template auto LogEventSerializer::close() -> void; diff --git a/components/core/src/clp/ir/LogEventSerializer.hpp b/components/core/src/clp/ir/LogEventSerializer.hpp index 635ecca9f..62c9c5835 100644 --- a/components/core/src/clp/ir/LogEventSerializer.hpp +++ b/components/core/src/clp/ir/LogEventSerializer.hpp @@ -87,8 +87,8 @@ class LogEventSerializer { * Serializes the given log event. * @return Whether the log event was successfully serialized. */ - [[nodiscard]] auto - serialize_log_event(epoch_time_ms_t timestamp, std::string_view message) -> bool; + [[nodiscard]] auto serialize_log_event(epoch_time_ms_t timestamp, std::string_view message) + -> bool; private: // Constants diff --git a/components/core/src/clp/regex_utils/RegexToWildcardTranslatorConfig.hpp b/components/core/src/clp/regex_utils/RegexToWildcardTranslatorConfig.hpp index e53963c2e..bfaca54eb 100644 --- a/components/core/src/clp/regex_utils/RegexToWildcardTranslatorConfig.hpp +++ b/components/core/src/clp/regex_utils/RegexToWildcardTranslatorConfig.hpp @@ -16,7 +16,7 @@ class RegexToWildcardTranslatorConfig { bool add_prefix_suffix_wildcards ) : m_case_insensitive_wildcard{case_insensitive_wildcard}, - m_add_prefix_suffix_wildcards{add_prefix_suffix_wildcards} {}; + m_add_prefix_suffix_wildcards{add_prefix_suffix_wildcards} {} /** * @return True if the final translated wildcard string will be fed into a case-insensitive diff --git a/components/core/src/clp/regex_utils/constants.hpp b/components/core/src/clp/regex_utils/constants.hpp index ff2eb5b10..c7cd922f3 100644 --- a/components/core/src/clp/regex_utils/constants.hpp +++ b/components/core/src/clp/regex_utils/constants.hpp @@ -14,8 +14,8 @@ constexpr size_t cCharBitarraySize = 128; * @param char_str A string that contains the characters to look up. * @return The lookup table as bit array. */ -[[nodiscard]] constexpr auto create_char_bit_array(std::string_view char_str -) -> std::array { +[[nodiscard]] constexpr auto create_char_bit_array(std::string_view char_str) + -> std::array { std::array bit_array{}; bit_array.fill(false); for (auto const ch : char_str) { diff --git a/components/core/src/clp/regex_utils/regex_translation_utils.hpp b/components/core/src/clp/regex_utils/regex_translation_utils.hpp index 8ca703403..8d33c7af7 100644 --- a/components/core/src/clp/regex_utils/regex_translation_utils.hpp +++ b/components/core/src/clp/regex_utils/regex_translation_utils.hpp @@ -17,8 +17,8 @@ namespace clp::regex_utils { * @param regex_str The regex string to be translated. * @return The translated wildcard string. */ -[[nodiscard]] auto regex_to_wildcard(std::string_view regex_str -) -> OUTCOME_V2_NAMESPACE::std_result; +[[nodiscard]] auto regex_to_wildcard(std::string_view regex_str) + -> OUTCOME_V2_NAMESPACE::std_result; /** * Translate a given regex string to wildcard with a custom configuration. @@ -26,10 +26,9 @@ namespace clp::regex_utils { * @param regex_str The regex string to be translated. * @return The translated wildcard string. */ -[[nodiscard]] auto regex_to_wildcard( - std::string_view regex_str, - RegexToWildcardTranslatorConfig const& config -) -> OUTCOME_V2_NAMESPACE::std_result; +[[nodiscard]] auto +regex_to_wildcard(std::string_view regex_str, RegexToWildcardTranslatorConfig const& config) + -> OUTCOME_V2_NAMESPACE::std_result; } // namespace clp::regex_utils diff --git a/components/core/src/clp/streaming_archive/reader/Archive.cpp b/components/core/src/clp/streaming_archive/reader/Archive.cpp index 141e5fce5..6bfa16776 100644 --- a/components/core/src/clp/streaming_archive/reader/Archive.cpp +++ b/components/core/src/clp/streaming_archive/reader/Archive.cpp @@ -161,11 +161,8 @@ bool Archive::get_next_message(File& file, Message& msg) { return file.get_next_message(msg); } -bool Archive::decompress_message( - File& file, - Message const& compressed_msg, - string& decompressed_msg -) { +bool +Archive::decompress_message(File& file, Message const& compressed_msg, string& decompressed_msg) { if (false == decompress_message_without_ts(compressed_msg, decompressed_msg)) { return false; } @@ -198,10 +195,8 @@ bool Archive::decompress_message( return true; } -bool Archive::decompress_message_without_ts( - Message const& compressed_msg, - string& decompressed_msg -) { +bool +Archive::decompress_message_without_ts(Message const& compressed_msg, string& decompressed_msg) { decompressed_msg.clear(); // Build original message content diff --git a/components/core/src/clp/streaming_archive/reader/Segment.hpp b/components/core/src/clp/streaming_archive/reader/Segment.hpp index cdcd51b4d..92ca25dde 100644 --- a/components/core/src/clp/streaming_archive/reader/Segment.hpp +++ b/components/core/src/clp/streaming_archive/reader/Segment.hpp @@ -20,7 +20,7 @@ namespace clp::streaming_archive::reader { class Segment { public: // Constructor - Segment() : m_segment_path({}) {}; + Segment() : m_segment_path({}) {} // Destructor ~Segment(); diff --git a/components/core/src/clp/streaming_archive/writer/Archive.cpp b/components/core/src/clp/streaming_archive/writer/Archive.cpp index 6804fac7a..3c52be2d1 100644 --- a/components/core/src/clp/streaming_archive/writer/Archive.cpp +++ b/components/core/src/clp/streaming_archive/writer/Archive.cpp @@ -289,11 +289,8 @@ void Archive::change_ts_pattern(TimestampPattern const* pattern) { m_file->change_ts_pattern(pattern); } -void Archive::write_msg( - epochtime_t timestamp, - string const& message, - size_t num_uncompressed_bytes -) { +void +Archive::write_msg(epochtime_t timestamp, string const& message, size_t num_uncompressed_bytes) { // Encode message and add components to dictionaries vector encoded_vars; vector var_ids; diff --git a/components/core/src/clp/utf8_utils.hpp b/components/core/src/clp/utf8_utils.hpp index fe9569b00..6973d8dd4 100644 --- a/components/core/src/clp/utf8_utils.hpp +++ b/components/core/src/clp/utf8_utils.hpp @@ -89,8 +89,8 @@ namespace utf8_utils_internal { * @param continuation_byte * @return The updated code point. */ -[[nodiscard]] auto -parse_continuation_byte(uint32_t code_point, uint8_t continuation_byte) -> uint32_t; +[[nodiscard]] auto parse_continuation_byte(uint32_t code_point, uint8_t continuation_byte) + -> uint32_t; } // namespace utf8_utils_internal template diff --git a/components/core/src/clp_s/ArchiveWriter.cpp b/components/core/src/clp_s/ArchiveWriter.cpp index 2a60013a9..63ec5277f 100644 --- a/components/core/src/clp_s/ArchiveWriter.cpp +++ b/components/core/src/clp_s/ArchiveWriter.cpp @@ -218,11 +218,8 @@ void ArchiveWriter::write_archive_header(FileWriter& archive_writer, size_t meta archive_writer.write(reinterpret_cast(&header), sizeof(header)); } -void ArchiveWriter::append_message( - int32_t schema_id, - Schema const& schema, - ParsedMessage& message -) { +void +ArchiveWriter::append_message(int32_t schema_id, Schema const& schema, ParsedMessage& message) { SchemaWriter* schema_writer; auto it = m_id_to_schema_writer.find(schema_id); if (it != m_id_to_schema_writer.end()) { diff --git a/components/core/src/clp_s/ColumnReader.cpp b/components/core/src/clp_s/ColumnReader.cpp index ded7a906d..5aa72b94a 100644 --- a/components/core/src/clp_s/ColumnReader.cpp +++ b/components/core/src/clp_s/ColumnReader.cpp @@ -19,10 +19,8 @@ void FloatColumnReader::load(BufferViewReader& reader, uint64_t num_messages) { m_values = reader.read_unaligned_span(num_messages); } -void Int64ColumnReader::extract_string_value_into_buffer( - uint64_t cur_message, - std::string& buffer -) { +void +Int64ColumnReader::extract_string_value_into_buffer(uint64_t cur_message, std::string& buffer) { buffer.append(std::to_string(m_values[cur_message])); } @@ -36,10 +34,8 @@ void BooleanColumnReader::load(BufferViewReader& reader, uint64_t num_messages) m_values = reader.read_unaligned_span(num_messages); } -void FloatColumnReader::extract_string_value_into_buffer( - uint64_t cur_message, - std::string& buffer -) { +void +FloatColumnReader::extract_string_value_into_buffer(uint64_t cur_message, std::string& buffer) { buffer.append(std::to_string(m_values[cur_message])); } @@ -55,10 +51,8 @@ void ClpStringColumnReader::load(BufferViewReader& reader, uint64_t num_messages m_encoded_vars = reader.read_unaligned_span(encoded_vars_length); } -void BooleanColumnReader::extract_string_value_into_buffer( - uint64_t cur_message, - std::string& buffer -) { +void +BooleanColumnReader::extract_string_value_into_buffer(uint64_t cur_message, std::string& buffer) { buffer.append(0 == m_values[cur_message] ? "false" : "true"); } @@ -70,10 +64,8 @@ std::variant ClpStringColumnReader::extra return message; } -void ClpStringColumnReader::extract_string_value_into_buffer( - uint64_t cur_message, - std::string& buffer -) { +void +ClpStringColumnReader::extract_string_value_into_buffer(uint64_t cur_message, std::string& buffer) { auto value = m_logtypes[cur_message]; int64_t logtype_id = ClpStringColumnWriter::get_encoded_log_dict_id(value); auto& entry = m_log_dict->get_entry(logtype_id); diff --git a/components/core/src/clp_s/DictionaryEntry.cpp b/components/core/src/clp_s/DictionaryEntry.cpp index 379753d7e..821f2139b 100644 --- a/components/core/src/clp_s/DictionaryEntry.cpp +++ b/components/core/src/clp_s/DictionaryEntry.cpp @@ -125,11 +125,8 @@ LogTypeDictionaryEntry::try_read_from_file(ZstdDecompressor& decompressor, uint6 return error_code; } -void LogTypeDictionaryEntry::read_from_file( - ZstdDecompressor& decompressor, - uint64_t id, - bool lazy -) { +void +LogTypeDictionaryEntry::read_from_file(ZstdDecompressor& decompressor, uint64_t id, bool lazy) { auto error_code = try_read_from_file(decompressor, id, lazy); if (ErrorCodeSuccess != error_code) { throw OperationFailed(error_code, __FILENAME__, __LINE__); @@ -244,11 +241,8 @@ ErrorCode VariableDictionaryEntry::try_read_from_file(ZstdDecompressor& decompre return error_code; } -void VariableDictionaryEntry::read_from_file( - ZstdDecompressor& decompressor, - uint64_t id, - bool lazy -) { +void +VariableDictionaryEntry::read_from_file(ZstdDecompressor& decompressor, uint64_t id, bool lazy) { auto error_code = try_read_from_file(decompressor, id); if (ErrorCodeSuccess != error_code) { throw OperationFailed(error_code, __FILENAME__, __LINE__); diff --git a/components/core/src/clp_s/DictionaryWriter.cpp b/components/core/src/clp_s/DictionaryWriter.cpp index 31a4ec430..9e4693fcf 100644 --- a/components/core/src/clp_s/DictionaryWriter.cpp +++ b/components/core/src/clp_s/DictionaryWriter.cpp @@ -35,10 +35,8 @@ bool VariableDictionaryWriter::add_entry(std::string const& value, uint64_t& id) return new_entry; } -bool LogTypeDictionaryWriter::add_entry( - LogTypeDictionaryEntry& logtype_entry, - uint64_t& logtype_id -) { +bool +LogTypeDictionaryWriter::add_entry(LogTypeDictionaryEntry& logtype_entry, uint64_t& logtype_id) { bool is_new_entry = false; std::string const& value = logtype_entry.get_value(); diff --git a/components/core/src/clp_s/InputConfig.hpp b/components/core/src/clp_s/InputConfig.hpp index 3672bb0ae..8c6afc2ea 100644 --- a/components/core/src/clp_s/InputConfig.hpp +++ b/components/core/src/clp_s/InputConfig.hpp @@ -89,8 +89,8 @@ get_input_archives_for_raw_path(std::string_view const path, std::vector& * @param archives Returned archives * @return true on success, false otherwise */ -[[nodiscard]] auto -get_input_archives_for_path(Path const& path, std::vector& archives) -> bool; +[[nodiscard]] auto get_input_archives_for_path(Path const& path, std::vector& archives) + -> bool; /** * Determines the archive id of an archive based on the archive path. @@ -98,8 +98,8 @@ get_input_archives_for_path(Path const& path, std::vector& archives) -> bo * @param archive_id Returned archive id * @return true on success, false otherwise */ -[[nodiscard]] auto -get_archive_id_from_path(Path const& archive_path, std::string& archive_id) -> bool; +[[nodiscard]] auto get_archive_id_from_path(Path const& archive_path, std::string& archive_id) + -> bool; } // namespace clp_s #endif // CLP_S_INPUTCONFIG_HPP diff --git a/components/core/src/clp_s/JsonParser.cpp b/components/core/src/clp_s/JsonParser.cpp index 21e3b0cfd..41fffda14 100644 --- a/components/core/src/clp_s/JsonParser.cpp +++ b/components/core/src/clp_s/JsonParser.cpp @@ -64,8 +64,8 @@ class IrUnitHandler { return IRErrorCode::IRErrorCode_Success; } - [[nodiscard]] auto get_deserialized_log_event( - ) const -> std::optional const& { + [[nodiscard]] auto get_deserialized_log_event() const + -> std::optional const& { return m_deserialized_log_event; } diff --git a/components/core/src/clp_s/PackedStreamReader.cpp b/components/core/src/clp_s/PackedStreamReader.cpp index 44eb94e96..45e62a24e 100644 --- a/components/core/src/clp_s/PackedStreamReader.cpp +++ b/components/core/src/clp_s/PackedStreamReader.cpp @@ -69,11 +69,8 @@ void PackedStreamReader::close() { m_state = PackedStreamReaderState::Uninitialized; } -void PackedStreamReader::read_stream( - size_t stream_id, - std::shared_ptr& buf, - size_t& buf_size -) { +void +PackedStreamReader::read_stream(size_t stream_id, std::shared_ptr& buf, size_t& buf_size) { constexpr size_t cDecompressorFileReadBufferCapacity = 64 * 1024; // 64 KB if (stream_id >= m_stream_metadata.size()) { throw OperationFailed(ErrorCodeCorrupt, __FILE__, __LINE__); diff --git a/components/core/src/clp_s/SchemaReader.cpp b/components/core/src/clp_s/SchemaReader.cpp index 8120ab323..6ab61e66a 100644 --- a/components/core/src/clp_s/SchemaReader.cpp +++ b/components/core/src/clp_s/SchemaReader.cpp @@ -44,11 +44,8 @@ int64_t SchemaReader::get_next_log_event_idx() const { return 0; } -void SchemaReader::load( - std::shared_ptr stream_buffer, - size_t offset, - size_t uncompressed_size -) { +void +SchemaReader::load(std::shared_ptr stream_buffer, size_t offset, size_t uncompressed_size) { m_stream_buffer = stream_buffer; BufferViewReader buffer_reader{m_stream_buffer.get() + offset, uncompressed_size}; for (auto& reader : m_columns) { diff --git a/components/core/src/clp_s/TimestampDictionaryWriter.cpp b/components/core/src/clp_s/TimestampDictionaryWriter.cpp index 952bc36db..c4550d568 100644 --- a/components/core/src/clp_s/TimestampDictionaryWriter.cpp +++ b/components/core/src/clp_s/TimestampDictionaryWriter.cpp @@ -89,11 +89,8 @@ epochtime_t TimestampDictionaryWriter::ingest_entry( return ret; } -void TimestampDictionaryWriter::ingest_entry( - std::string_view key, - int32_t node_id, - double timestamp -) { +void +TimestampDictionaryWriter::ingest_entry(std::string_view key, int32_t node_id, double timestamp) { auto entry = m_column_id_to_range.find(node_id); if (entry == m_column_id_to_range.end()) { TimestampEntry new_entry(key); @@ -104,11 +101,8 @@ void TimestampDictionaryWriter::ingest_entry( } } -void TimestampDictionaryWriter::ingest_entry( - std::string_view key, - int32_t node_id, - int64_t timestamp -) { +void +TimestampDictionaryWriter::ingest_entry(std::string_view key, int32_t node_id, int64_t timestamp) { auto entry = m_column_id_to_range.find(node_id); if (entry == m_column_id_to_range.end()) { TimestampEntry new_entry(key); diff --git a/components/core/src/clp_s/Utils.cpp b/components/core/src/clp_s/Utils.cpp index 19b564c03..acdfaa652 100644 --- a/components/core/src/clp_s/Utils.cpp +++ b/components/core/src/clp_s/Utils.cpp @@ -361,11 +361,8 @@ bool StringUtils::advance_tame_to_next_match( return true; } -bool StringUtils::wildcard_match_unsafe( - string_view tame, - string_view wild, - bool case_sensitive_match -) { +bool +StringUtils::wildcard_match_unsafe(string_view tame, string_view wild, bool case_sensitive_match) { if (case_sensitive_match) { return wildcard_match_unsafe_case_sensitive(tame, wild); } else { diff --git a/components/core/src/clp_s/Utils.hpp b/components/core/src/clp_s/Utils.hpp index 0181a6749..6be7bed0e 100644 --- a/components/core/src/clp_s/Utils.hpp +++ b/components/core/src/clp_s/Utils.hpp @@ -320,7 +320,8 @@ template class UnalignedMemSpan { public: UnalignedMemSpan() = default; - UnalignedMemSpan(char* begin, size_t size) : m_begin(begin), m_size(size) {}; + + UnalignedMemSpan(char* begin, size_t size) : m_begin(begin), m_size(size) {} size_t size() { return m_size; } diff --git a/components/core/src/clp_s/search/BooleanLiteral.hpp b/components/core/src/clp_s/search/BooleanLiteral.hpp index a22022b7b..5ea45ae0e 100644 --- a/components/core/src/clp_s/search/BooleanLiteral.hpp +++ b/components/core/src/clp_s/search/BooleanLiteral.hpp @@ -51,7 +51,7 @@ class BooleanLiteral : public Literal { // Constructors BooleanLiteral() = default; - explicit BooleanLiteral(bool v) : m_v(v) {}; + explicit BooleanLiteral(bool v) : m_v(v) {} }; } // namespace clp_s::search diff --git a/components/core/src/clp_s/search/OutputHandler.hpp b/components/core/src/clp_s/search/OutputHandler.hpp index f033d37e8..aeadf1f26 100644 --- a/components/core/src/clp_s/search/OutputHandler.hpp +++ b/components/core/src/clp_s/search/OutputHandler.hpp @@ -32,7 +32,7 @@ class OutputHandler { // Constructors explicit OutputHandler(bool should_output_metadata, bool should_marshal_records) : m_should_output_metadata(should_output_metadata), - m_should_marshal_records(should_marshal_records) {}; + m_should_marshal_records(should_marshal_records) {} // Destructor virtual ~OutputHandler() = default; diff --git a/components/core/src/glt/BufferReader.cpp b/components/core/src/glt/BufferReader.cpp index 073a928be..ec005500e 100644 --- a/components/core/src/glt/BufferReader.cpp +++ b/components/core/src/glt/BufferReader.cpp @@ -86,12 +86,9 @@ auto BufferReader::try_get_pos(size_t& pos) -> ErrorCode { return ErrorCode_Success; } -auto BufferReader::try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - std::string& str -) -> ErrorCode { +auto +BufferReader::try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) + -> ErrorCode { if (false == append) { str.clear(); } diff --git a/components/core/src/glt/BufferReader.hpp b/components/core/src/glt/BufferReader.hpp index aec2f53fe..3956b6360 100644 --- a/components/core/src/glt/BufferReader.hpp +++ b/components/core/src/glt/BufferReader.hpp @@ -63,8 +63,8 @@ class BufferReader : public ReaderInterface { * @return ErrorCode_EndOfFile if the buffer doesn't contain any more data * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override; /** * Tries to seek to the given position, relative to the beginning of the buffer @@ -88,12 +88,9 @@ class BufferReader : public ReaderInterface { * @param str Returns the content read from the buffer * @return Same as BufferReader::try_read_to_delimiter(char, bool, std::string&, bool&, size_t&) */ - [[nodiscard]] auto try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - std::string& str - ) -> ErrorCode override; + [[nodiscard]] auto + try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) + -> ErrorCode override; private: // Methods diff --git a/components/core/src/glt/BufferedFileReader.cpp b/components/core/src/glt/BufferedFileReader.cpp index 91bd3a6b8..21007d381 100644 --- a/components/core/src/glt/BufferedFileReader.cpp +++ b/components/core/src/glt/BufferedFileReader.cpp @@ -265,12 +265,9 @@ auto BufferedFileReader::try_read(char* buf, size_t num_bytes_to_read, size_t& n return ErrorCode_Success; } -auto BufferedFileReader::try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - string& str -) -> ErrorCode { +auto +BufferedFileReader::try_read_to_delimiter(char delim, bool keep_delimiter, bool append, string& str) + -> ErrorCode { if (-1 == m_fd) { return ErrorCode_NotInit; } diff --git a/components/core/src/glt/BufferedFileReader.hpp b/components/core/src/glt/BufferedFileReader.hpp index 3e45f2056..2fa9f5ca1 100644 --- a/components/core/src/glt/BufferedFileReader.hpp +++ b/components/core/src/glt/BufferedFileReader.hpp @@ -127,8 +127,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_NotInit if the file is not opened * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_peek_buffered_data(char const*& buf, size_t& peek_size) const -> ErrorCode; + [[nodiscard]] auto try_peek_buffered_data(char const*& buf, size_t& peek_size) const + -> ErrorCode; /** * Peeks the remaining buffered content without advancing the read head. @@ -191,8 +191,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_EndOfFile on EOF * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; + [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) + -> ErrorCode override; /** * Tries to read up to an occurrence of the given delimiter @@ -206,12 +206,9 @@ class BufferedFileReader : public ReaderInterface { * @return Same as BufferReader::try_read_to_delimiter if it fails * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_read_to_delimiter( - char delim, - bool keep_delimiter, - bool append, - std::string& str - ) -> ErrorCode override; + [[nodiscard]] auto + try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) + -> ErrorCode override; private: // Methods diff --git a/components/core/src/glt/Grep.cpp b/components/core/src/glt/Grep.cpp index 5a7356046..6c2a74719 100644 --- a/components/core/src/glt/Grep.cpp +++ b/components/core/src/glt/Grep.cpp @@ -716,10 +716,8 @@ bool Grep::get_bounds_of_next_potential_var( return (value_length != begin_pos); } -void Grep::calculate_sub_queries_relevant_to_file( - File const& compressed_file, - vector& queries -) { +void +Grep::calculate_sub_queries_relevant_to_file(File const& compressed_file, vector& queries) { for (auto& query : queries) { query.make_sub_queries_relevant_to_segment(compressed_file.get_segment_id()); } diff --git a/components/core/src/glt/ffi/search/query_methods.cpp b/components/core/src/glt/ffi/search/query_methods.cpp index 55fc1ce4c..2750b5665 100644 --- a/components/core/src/glt/ffi/search/query_methods.cpp +++ b/components/core/src/glt/ffi/search/query_methods.cpp @@ -66,10 +66,8 @@ static void tokenize_query( ); template -void generate_subqueries( - string_view wildcard_query, - vector>& sub_queries -) { +void +generate_subqueries(string_view wildcard_query, vector>& sub_queries) { if (wildcard_query.empty()) { throw QueryMethodFailed( ErrorCode_BadParam, diff --git a/components/core/src/glt/ir/LogEventDeserializer.cpp b/components/core/src/glt/ir/LogEventDeserializer.cpp index c22f22bb7..fa387421a 100644 --- a/components/core/src/glt/ir/LogEventDeserializer.cpp +++ b/components/core/src/glt/ir/LogEventDeserializer.cpp @@ -11,8 +11,8 @@ namespace glt::ir { template -auto LogEventDeserializer::create(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result> { ffi::ir_stream::encoded_tag_t metadata_type{0}; std::vector metadata; auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata); @@ -67,8 +67,8 @@ auto LogEventDeserializer::create(ReaderInterface& reader } template -auto LogEventDeserializer::deserialize_log_event( -) -> OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result> { epoch_time_ms_t timestamp_or_timestamp_delta{}; std::string logtype; std::vector dict_vars; @@ -106,12 +106,12 @@ auto LogEventDeserializer::deserialize_log_event( // Explicitly declare template specializations so that we can define the template methods in this // file -template auto LogEventDeserializer::create(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::create(ReaderInterface& reader -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event( -) -> OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event( -) -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result>; } // namespace glt::ir diff --git a/components/core/src/glt/ir/LogEventDeserializer.hpp b/components/core/src/glt/ir/LogEventDeserializer.hpp index 4fbfb3c53..092b0f58b 100644 --- a/components/core/src/glt/ir/LogEventDeserializer.hpp +++ b/components/core/src/glt/ir/LogEventDeserializer.hpp @@ -33,8 +33,8 @@ class LogEventDeserializer { * - std::errc::protocol_not_supported if the IR stream contains an unsupported metadata format * or uses an unsupported version */ - static auto create(ReaderInterface& reader - ) -> OUTCOME_V2_NAMESPACE::std_result>; + static auto create(ReaderInterface& reader) + -> OUTCOME_V2_NAMESPACE::std_result>; // Delete copy constructor and assignment LogEventDeserializer(LogEventDeserializer const&) = delete; @@ -58,8 +58,8 @@ class LogEventDeserializer { * - std::errc::result_out_of_range if the IR stream is truncated * - std::errc::result_out_of_range if the IR stream is corrupted */ - [[nodiscard]] auto deserialize_log_event( - ) -> OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto deserialize_log_event() + -> OUTCOME_V2_NAMESPACE::std_result>; private: // Constructors diff --git a/components/core/src/glt/streaming_archive/reader/Archive.cpp b/components/core/src/glt/streaming_archive/reader/Archive.cpp index bfb489cc9..b8c450946 100644 --- a/components/core/src/glt/streaming_archive/reader/Archive.cpp +++ b/components/core/src/glt/streaming_archive/reader/Archive.cpp @@ -183,11 +183,8 @@ bool Archive::get_next_message(File& file, Message& msg) { return file.get_next_message(msg); } -bool Archive::decompress_message( - File& file, - Message const& compressed_msg, - string& decompressed_msg -) { +bool +Archive::decompress_message(File& file, Message const& compressed_msg, string& decompressed_msg) { decompressed_msg.clear(); // Build original message content diff --git a/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp b/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp index f4334d417..c93203279 100644 --- a/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp +++ b/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp @@ -25,7 +25,7 @@ class LogtypeTableManager { } }; - LogtypeTableManager() : m_is_open(false) {}; + LogtypeTableManager() : m_is_open(false) {} /** * Open the concated variable segment file and metadata associated with the segment diff --git a/components/core/src/glt/streaming_archive/reader/Message.cpp b/components/core/src/glt/streaming_archive/reader/Message.cpp index bba8d472e..5318795c4 100644 --- a/components/core/src/glt/streaming_archive/reader/Message.cpp +++ b/components/core/src/glt/streaming_archive/reader/Message.cpp @@ -54,11 +54,8 @@ void Message::resize_var(size_t var_size) { m_vars.resize(var_size); } -void Message::load_vars_from( - std::vector const& vars, - size_t count, - size_t offset -) { +void +Message::load_vars_from(std::vector const& vars, size_t count, size_t offset) { for (size_t var_ix = 0; var_ix < count; var_ix++) { m_vars.at(var_ix) = vars.at(var_ix + offset); } diff --git a/components/core/src/glt/streaming_archive/reader/Segment.hpp b/components/core/src/glt/streaming_archive/reader/Segment.hpp index d2caecfba..c3cd88768 100644 --- a/components/core/src/glt/streaming_archive/reader/Segment.hpp +++ b/components/core/src/glt/streaming_archive/reader/Segment.hpp @@ -20,7 +20,7 @@ namespace glt::streaming_archive::reader { class Segment { public: // Constructor - Segment() : m_segment_path({}) {}; + Segment() : m_segment_path({}) {} // Destructor ~Segment(); diff --git a/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp b/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp index 46e9dfe45..223e71944 100644 --- a/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp +++ b/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp @@ -11,7 +11,8 @@ namespace glt::streaming_archive::reader { class SingleLogtypeTableManager : public streaming_archive::reader::LogtypeTableManager { public: - SingleLogtypeTableManager() : m_logtype_table_loaded(false) {}; + SingleLogtypeTableManager() : m_logtype_table_loaded(false) {} + void open_logtype_table(logtype_dictionary_id_t logtype_id); void close_logtype_table(); diff --git a/components/core/src/glt/streaming_archive/writer/Archive.cpp b/components/core/src/glt/streaming_archive/writer/Archive.cpp index 09642a1f0..cbe7e2dbf 100644 --- a/components/core/src/glt/streaming_archive/writer/Archive.cpp +++ b/components/core/src/glt/streaming_archive/writer/Archive.cpp @@ -276,11 +276,8 @@ void Archive::change_ts_pattern(TimestampPattern const* pattern) { m_file->change_ts_pattern(pattern); } -void Archive::write_msg( - epochtime_t timestamp, - string const& message, - size_t num_uncompressed_bytes -) { +void +Archive::write_msg(epochtime_t timestamp, string const& message, size_t num_uncompressed_bytes) { // Encode message and add components to dictionaries vector encoded_vars; vector var_ids; diff --git a/components/core/src/reducer/Pipeline.hpp b/components/core/src/reducer/Pipeline.hpp index 964db8972..f40d3d479 100644 --- a/components/core/src/reducer/Pipeline.hpp +++ b/components/core/src/reducer/Pipeline.hpp @@ -21,7 +21,7 @@ enum class PipelineInputMode : uint8_t { */ class Pipeline { public: - explicit Pipeline(PipelineInputMode input_mode) : m_input_mode{input_mode} {}; + explicit Pipeline(PipelineInputMode input_mode) : m_input_mode{input_mode} {} void push_record(Record const& record); void push_record_group(GroupTags const& tags, ConstRecordIterator& record_it); diff --git a/components/core/tests/test-NetworkReader.cpp b/components/core/tests/test-NetworkReader.cpp index 552775ea8..c378da3ff 100644 --- a/components/core/tests/test-NetworkReader.cpp +++ b/components/core/tests/test-NetworkReader.cpp @@ -47,8 +47,8 @@ auto get_content(clp::ReaderInterface& reader, size_t read_buf_size = cDefaultRe * @param reader * @return Whether the the assertion succeeded. */ -[[nodiscard]] auto -assert_curl_error_code(CURLcode expected, clp::NetworkReader const& reader) -> bool; +[[nodiscard]] auto assert_curl_error_code(CURLcode expected, clp::NetworkReader const& reader) + -> bool; auto get_test_input_local_path() -> std::string { std::filesystem::path const current_file_path{__FILE__}; diff --git a/components/core/tests/test-ffi_IrUnitHandlerInterface.cpp b/components/core/tests/test-ffi_IrUnitHandlerInterface.cpp index 8f76a2f1a..3947064ac 100644 --- a/components/core/tests/test-ffi_IrUnitHandlerInterface.cpp +++ b/components/core/tests/test-ffi_IrUnitHandlerInterface.cpp @@ -32,8 +32,8 @@ class TrivialIrUnitHandler { return IRErrorCode::IRErrorCode_Success; } - [[nodiscard]] auto - handle_utc_offset_change(UtcOffset utc_offset_old, UtcOffset utc_offset_new) -> IRErrorCode { + [[nodiscard]] auto handle_utc_offset_change(UtcOffset utc_offset_old, UtcOffset utc_offset_new) + -> IRErrorCode { m_utc_offset_delta = utc_offset_new - utc_offset_old; return IRErrorCode::IRErrorCode_Success; } @@ -55,8 +55,8 @@ class TrivialIrUnitHandler { [[nodiscard]] auto is_complete() const -> bool { return m_is_complete; } - [[nodiscard]] auto get_schema_tree_node_locator( - ) const -> std::optional const& { + [[nodiscard]] auto get_schema_tree_node_locator() const + -> std::optional const& { return m_schema_tree_node_locator; } @@ -82,11 +82,11 @@ class TriviallyInheritedIrUnitHandler : public TrivialIrUnitHandler {}; * `clp::ffi::ir_stream::IrUnitHandlerInterface` and ensure they don't return errors. * @param handler */ -auto test_ir_unit_handler_interface(clp::ffi::ir_stream::IrUnitHandlerInterface auto& handler -) -> void; +auto test_ir_unit_handler_interface(clp::ffi::ir_stream::IrUnitHandlerInterface auto& handler) + -> void; -auto test_ir_unit_handler_interface(clp::ffi::ir_stream::IrUnitHandlerInterface auto& handler -) -> void { +auto test_ir_unit_handler_interface(clp::ffi::ir_stream::IrUnitHandlerInterface auto& handler) + -> void { auto test_log_event_result{KeyValuePairLogEvent::create( std::make_shared(), std::make_shared(), diff --git a/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp b/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp index 9ffee4f68..66da26705 100644 --- a/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp +++ b/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp @@ -45,10 +45,9 @@ constexpr std::string_view cStringToEncode{"uid=0, CPU usage: 99.99%, \"user_nam * @return The encoded result. */ template -requires(std::is_same_v - || std::is_same_v) -[[nodiscard]] auto get_encoded_text_ast(std::string_view text -) -> clp::ir::EncodedTextAst; +requires(std::is_same_v || std::is_same_v) +[[nodiscard]] auto get_encoded_text_ast(std::string_view text) + -> clp::ir::EncodedTextAst; /** * Tests that `Value::is` returns true for the given type and false for all others. @@ -102,8 +101,7 @@ auto insert_invalid_node_id_value_pairs_with_node_type_errors( ) -> bool; template -requires(std::is_same_v - || std::is_same_v) +requires(std::is_same_v || std::is_same_v) auto get_encoded_text_ast(std::string_view text) -> clp::ir::EncodedTextAst { string logtype; vector encoded_vars; diff --git a/components/core/tests/test-utf8_utils.cpp b/components/core/tests/test-utf8_utils.cpp index 77324eaf9..8f5758a59 100644 --- a/components/core/tests/test-utf8_utils.cpp +++ b/components/core/tests/test-utf8_utils.cpp @@ -31,8 +31,8 @@ namespace { * @param num_continuation_bytes * @return The encoded UTF-8 byte sequence. */ -[[nodiscard]] auto -generate_utf8_byte_sequence(uint32_t code_point, size_t num_continuation_bytes) -> std::string; +[[nodiscard]] auto generate_utf8_byte_sequence(uint32_t code_point, size_t num_continuation_bytes) + -> std::string; auto get_expected_escaped_string(std::string_view raw) -> std::string { nlohmann::json const json_str = raw; // Don't use '{}' initializer diff --git a/lint-requirements.txt b/lint-requirements.txt index 4b3bbe927..95d0304de 100644 --- a/lint-requirements.txt +++ b/lint-requirements.txt @@ -1,5 +1,4 @@ black>=24.4.2 -# Lock to v18.x until we can upgrade our code to meet v19's formatting standards. -clang-format~=18.1 +clang-format>=19.1.6 ruff>=0.4.4 yamllint>=1.35.1 diff --git a/tools/yscope-dev-utils b/tools/yscope-dev-utils index ad576e43c..c1593f741 160000 --- a/tools/yscope-dev-utils +++ b/tools/yscope-dev-utils @@ -1 +1 @@ -Subproject commit ad576e43c1a43d7a6afde79fc9c3c952b7bf28bd +Subproject commit c1593f7414112f2b6e0bf46595126c8edeffe106 From 6875aa94627b98ef936aa7408ec6d48964e29f54 Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Fri, 10 Jan 2025 23:47:40 -0500 Subject: [PATCH 2/2] Fix exceeded lines --- .../ffi/ir_stream/ir_unit_deserialization_methods.cpp | 10 ++++++++-- .../core/tests/test-ffi_KeyValuePairLogEvent.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp b/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp index 3765d98d6..174b48be8 100644 --- a/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp +++ b/components/core/src/clp/ffi/ir_stream/ir_unit_deserialization_methods.cpp @@ -139,7 +139,10 @@ deserialize_string(ReaderInterface& reader, encoded_tag_t tag, std::string& dese * @return Forwards `deserialize_encoded_text_ast`'s return values on failure. */ template -requires(std::is_same_v || std::is_same_v) +requires( + (std::is_same_v + || std::is_same_v) +) [[nodiscard]] auto deserialize_encoded_text_ast_and_insert_to_node_id_value_pairs( ReaderInterface& reader, SchemaTree::Node::id_t node_id, @@ -394,7 +397,10 @@ auto deserialize_value_and_insert_to_node_id_value_pairs( } template -requires(std::is_same_v || std::is_same_v) +requires( + (std::is_same_v + || std::is_same_v) +) [[nodiscard]] auto deserialize_encoded_text_ast_and_insert_to_node_id_value_pairs( ReaderInterface& reader, SchemaTree::Node::id_t node_id, diff --git a/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp b/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp index 66da26705..99c7e2b48 100644 --- a/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp +++ b/components/core/tests/test-ffi_KeyValuePairLogEvent.cpp @@ -45,7 +45,10 @@ constexpr std::string_view cStringToEncode{"uid=0, CPU usage: 99.99%, \"user_nam * @return The encoded result. */ template -requires(std::is_same_v || std::is_same_v) +requires( + (std::is_same_v + || std::is_same_v) +) [[nodiscard]] auto get_encoded_text_ast(std::string_view text) -> clp::ir::EncodedTextAst; @@ -101,7 +104,10 @@ auto insert_invalid_node_id_value_pairs_with_node_type_errors( ) -> bool; template -requires(std::is_same_v || std::is_same_v) +requires( + (std::is_same_v + || std::is_same_v) +) auto get_encoded_text_ast(std::string_view text) -> clp::ir::EncodedTextAst { string logtype; vector encoded_vars;