From 27d5c4d89db3898fc5a81ddbe428047f5c978e1e Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sat, 6 Jul 2024 17:05:59 -0700 Subject: [PATCH 1/4] base: move outcome_future_utils to base library It needs a home. Signed-off-by: Noah Watkins --- src/v/{ => base/include/base}/outcome_future_utils.h | 0 src/v/raft/heartbeat_manager.cc | 2 +- src/v/raft/recovery_stm.cc | 2 +- src/v/raft/replicate_entries_stm.cc | 2 +- src/v/raft/rpc_client_protocol.cc | 2 +- src/v/rpc/include/rpc/connection_cache.h | 2 +- src/v/rpc/include/rpc/connection_set.h | 2 +- src/v/utils/tests/outcome_utils_test.cc | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename src/v/{ => base/include/base}/outcome_future_utils.h (100%) diff --git a/src/v/outcome_future_utils.h b/src/v/base/include/base/outcome_future_utils.h similarity index 100% rename from src/v/outcome_future_utils.h rename to src/v/base/include/base/outcome_future_utils.h diff --git a/src/v/raft/heartbeat_manager.cc b/src/v/raft/heartbeat_manager.cc index 100a0cf59a86f..bac0fe761202a 100644 --- a/src/v/raft/heartbeat_manager.cc +++ b/src/v/raft/heartbeat_manager.cc @@ -10,13 +10,13 @@ #include "raft/heartbeat_manager.h" #include "base/likely.h" +#include "base/outcome_future_utils.h" #include "base/vlog.h" #include "config/configuration.h" #include "features/feature_table.h" #include "follower_stats.h" #include "model/metadata.h" #include "model/timeout_clock.h" -#include "outcome_future_utils.h" #include "raft/consensus_client_protocol.h" #include "raft/errc.h" #include "raft/group_configuration.h" diff --git a/src/v/raft/recovery_stm.cc b/src/v/raft/recovery_stm.cc index 3f4a832b38a61..1a098638b04ce 100644 --- a/src/v/raft/recovery_stm.cc +++ b/src/v/raft/recovery_stm.cc @@ -9,10 +9,10 @@ #include "raft/recovery_stm.h" +#include "base/outcome_future_utils.h" #include "bytes/iostream.h" #include "model/fundamental.h" #include "model/record_batch_reader.h" -#include "outcome_future_utils.h" #include "raft/consensus.h" #include "raft/consensus_utils.h" #include "raft/errc.h" diff --git a/src/v/raft/replicate_entries_stm.cc b/src/v/raft/replicate_entries_stm.cc index 24f66343d03cb..e6b7cb711830a 100644 --- a/src/v/raft/replicate_entries_stm.cc +++ b/src/v/raft/replicate_entries_stm.cc @@ -11,12 +11,12 @@ #include "base/likely.h" #include "base/outcome.h" +#include "base/outcome_future_utils.h" #include "features/feature_table.h" #include "model/fundamental.h" #include "model/metadata.h" #include "model/record.h" #include "model/record_batch_reader.h" -#include "outcome_future_utils.h" #include "raft/consensus.h" #include "raft/consensus_utils.h" #include "raft/errc.h" diff --git a/src/v/raft/rpc_client_protocol.cc b/src/v/raft/rpc_client_protocol.cc index 39396cd42ba78..4a4253b812720 100644 --- a/src/v/raft/rpc_client_protocol.cc +++ b/src/v/raft/rpc_client_protocol.cc @@ -9,7 +9,7 @@ #include "raft/rpc_client_protocol.h" -#include "outcome_future_utils.h" +#include "base/outcome_future_utils.h" #include "raft/raftgen_service.h" #include "raft/types.h" #include "rpc/connection_cache.h" diff --git a/src/v/rpc/include/rpc/connection_cache.h b/src/v/rpc/include/rpc/connection_cache.h index 752049929f963..d2ec8450f04a1 100644 --- a/src/v/rpc/include/rpc/connection_cache.h +++ b/src/v/rpc/include/rpc/connection_cache.h @@ -10,8 +10,8 @@ */ #pragma once +#include "base/outcome_future_utils.h" #include "model/metadata.h" -#include "outcome_future_utils.h" #include "rpc/backoff_policy.h" #include "rpc/connection_set.h" #include "rpc/errc.h" diff --git a/src/v/rpc/include/rpc/connection_set.h b/src/v/rpc/include/rpc/connection_set.h index 6bbb69ec91348..31ac4f7fcb4bf 100644 --- a/src/v/rpc/include/rpc/connection_set.h +++ b/src/v/rpc/include/rpc/connection_set.h @@ -12,9 +12,9 @@ #pragma once #include "base/outcome.h" +#include "base/outcome_future_utils.h" #include "config/tls_config.h" #include "model/metadata.h" -#include "outcome_future_utils.h" #include "rpc/backoff_policy.h" #include "rpc/errc.h" #include "rpc/reconnect_transport.h" diff --git a/src/v/utils/tests/outcome_utils_test.cc b/src/v/utils/tests/outcome_utils_test.cc index 9b66ea54921f2..48282ba0bb6f3 100644 --- a/src/v/utils/tests/outcome_utils_test.cc +++ b/src/v/utils/tests/outcome_utils_test.cc @@ -7,7 +7,7 @@ // the Business Source License, use of this software will be governed // by the Apache License, Version 2.0 -#include "outcome_future_utils.h" +#include "base/outcome_future_utils.h" #include From 56847911a8915a1b65f297cced33398d691966d4 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sat, 6 Jul 2024 17:00:17 -0700 Subject: [PATCH 2/4] rpc: remove unused header Signed-off-by: Noah Watkins --- src/v/rpc/reconnect_transport.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/v/rpc/reconnect_transport.cc b/src/v/rpc/reconnect_transport.cc index bf59f2374c886..70f8103f2d8b9 100644 --- a/src/v/rpc/reconnect_transport.cc +++ b/src/v/rpc/reconnect_transport.cc @@ -10,7 +10,6 @@ #include "rpc/reconnect_transport.h" #include "model/timeout_clock.h" -#include "raft/logger.h" #include "rpc/errc.h" #include "rpc/logger.h" #include "rpc/transport.h" From 24f235fed75098301df51731c9d3395d0ed8b5ca Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sat, 6 Jul 2024 16:58:00 -0700 Subject: [PATCH 3/4] serde: use narrower scope serde headers Including serde/serde.h enables serde for all supported types, but comes at the expense of unused headers and dependency issues for stricter build systems. Instead, include only what is required. Signed-off-by: Noah Watkins --- src/v/cluster/data_migration_types.h | 7 ++++++- src/v/cluster/ephemeral_credential_serde.h | 3 ++- src/v/cluster/node_status_rpc_types.h | 2 +- src/v/cluster/self_test_rpc_types.h | 10 +++++++++- src/v/raft/transfer_leadership.h | 6 +++++- src/v/rpc/include/rpc/parse_utils.h | 2 +- src/v/serde/serde.h | 1 + 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/v/cluster/data_migration_types.h b/src/v/cluster/data_migration_types.h index 5e8907453c166..f60889b1ab807 100644 --- a/src/v/cluster/data_migration_types.h +++ b/src/v/cluster/data_migration_types.h @@ -13,8 +13,13 @@ #include "cluster/errc.h" #include "container/fragmented_vector.h" #include "model/metadata.h" -#include "serde/envelope.h" +#include "serde/rw/enum.h" +#include "serde/rw/envelope.h" +#include "serde/rw/named_type.h" +#include "serde/rw/optional.h" +#include "serde/rw/sstring.h" #include "serde/rw/variant.h" +#include "serde/rw/vector.h" #include "utils/named_type.h" #include diff --git a/src/v/cluster/ephemeral_credential_serde.h b/src/v/cluster/ephemeral_credential_serde.h index 9d5f27b71f556..dd97be7bf0acb 100644 --- a/src/v/cluster/ephemeral_credential_serde.h +++ b/src/v/cluster/ephemeral_credential_serde.h @@ -14,7 +14,8 @@ #include "security/acl.h" #include "security/scram_credential.h" #include "security/types.h" -#include "serde/envelope.h" +#include "serde/rw/enum.h" +#include "serde/rw/envelope.h" namespace cluster { diff --git a/src/v/cluster/node_status_rpc_types.h b/src/v/cluster/node_status_rpc_types.h index 7fc081717da3c..ce51c461e3dcd 100644 --- a/src/v/cluster/node_status_rpc_types.h +++ b/src/v/cluster/node_status_rpc_types.h @@ -12,7 +12,7 @@ #pragma once #include "model/metadata.h" -#include "serde/envelope.h" +#include "serde/rw/envelope.h" #include diff --git a/src/v/cluster/self_test_rpc_types.h b/src/v/cluster/self_test_rpc_types.h index 7cd9b7154ae49..61abe2db634ff 100644 --- a/src/v/cluster/self_test_rpc_types.h +++ b/src/v/cluster/self_test_rpc_types.h @@ -14,7 +14,15 @@ #include "config/node_config.h" #include "json/document.h" #include "model/metadata.h" -#include "serde/envelope.h" +#include "serde/rw/chrono.h" +#include "serde/rw/enum.h" +#include "serde/rw/envelope.h" +#include "serde/rw/iobuf.h" +#include "serde/rw/optional.h" +#include "serde/rw/scalar.h" +#include "serde/rw/sstring.h" +#include "serde/rw/uuid.h" +#include "serde/rw/vector.h" #include "utils/uuid.h" #include diff --git a/src/v/raft/transfer_leadership.h b/src/v/raft/transfer_leadership.h index 364ee4c2cd3a1..ccc3cc6ec2eff 100644 --- a/src/v/raft/transfer_leadership.h +++ b/src/v/raft/transfer_leadership.h @@ -14,7 +14,11 @@ #include "model/fundamental.h" #include "raft/errc.h" #include "raft/fundamental.h" -#include "serde/envelope.h" +#include "serde/rw/chrono.h" +#include "serde/rw/enum.h" +#include "serde/rw/envelope.h" +#include "serde/rw/optional.h" +#include "serde/rw/scalar.h" namespace raft { diff --git a/src/v/rpc/include/rpc/parse_utils.h b/src/v/rpc/include/rpc/parse_utils.h index b6bd689a587b0..478540498bfaf 100644 --- a/src/v/rpc/include/rpc/parse_utils.h +++ b/src/v/rpc/include/rpc/parse_utils.h @@ -20,7 +20,7 @@ #include "reflection/async_adl.h" #include "rpc/logger.h" #include "rpc/types.h" -#include "serde/serde.h" +#include "serde/async.h" #include #include diff --git a/src/v/serde/serde.h b/src/v/serde/serde.h index 5550455a8f542..6bc037dd545d1 100644 --- a/src/v/serde/serde.h +++ b/src/v/serde/serde.h @@ -26,4 +26,5 @@ #include "serde/rw/sstring.h" #include "serde/rw/tristate_rw.h" #include "serde/rw/uuid.h" +#include "serde/rw/variant.h" #include "serde/rw/vector.h" From 36a4cca4ba1ec16b0153d96fabfa4802520c7c9e Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sun, 7 Jul 2024 07:20:27 -0700 Subject: [PATCH 4/4] serde: add missing include guard Signed-off-by: Noah Watkins --- src/v/serde/peek.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/v/serde/peek.h b/src/v/serde/peek.h index 9da183960c8dd..497740df03c6e 100644 --- a/src/v/serde/peek.h +++ b/src/v/serde/peek.h @@ -6,6 +6,7 @@ // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, Version 2.0 +#pragma once #include "serde/envelope.h" #include "serde/rw/rw.h"