Skip to content

Commit

Permalink
Merge pull request #18043 from mmaslankaprv/reduce-raft-deps
Browse files Browse the repository at this point in the history
Reduce raft deps
  • Loading branch information
mmaslankaprv authored Apr 25, 2024
2 parents b8e3d6e + 79bf7ee commit 7fd9f10
Show file tree
Hide file tree
Showing 48 changed files with 129 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/v/archival/ntp_archiver_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "model/fundamental.h"
#include "model/metadata.h"
#include "model/record.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "storage/disk_log_impl.h"
#include "storage/fs_utils.h"
#include "storage/ntp_config.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/archival/tests/archival_metadata_stm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
#include "model/metadata.h"
#include "model/record.h"
#include "model/timestamp.h"
#include "raft/fundamental.h"
#include "raft/persisted_stm.h"
#include "raft/state_machine_manager.h"
#include "raft/tests/raft_group_fixture.h"
#include "raft/tests/simple_raft_fixture.h"
#include "raft/types.h"
#include "storage/tests/utils/disk_log_builder.h"
#include "test_utils/async.h"

Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/cloud_metadata/uploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "model/fundamental.h"
#include "model/namespace.h"
#include "raft/consensus.h"
#include "raft/fundamental.h"
#include "raft/group_manager.h"
#include "raft/types.h"
#include "ssx/future-util.h"
#include "ssx/sleep_abortable.h"
#include "storage/api.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/controller_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include "model/fundamental.h"
#include "model/metadata.h"
#include "prometheus/prometheus_sanitize.h"
#include "raft/fundamental.h"
#include "raft/group_configuration.h"
#include "raft/types.h"
#include "ssx/event.h"
#include "ssx/future-util.h"
#include "storage/offset_translator.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/id_allocator_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "model/namespace.h"
#include "raft/consensus.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "storage/ntp_config.h"
#include "storage/record_batch_builder.h"

Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/log_eviction_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "cluster/prefix_truncate_record.h"
#include "model/fundamental.h"
#include "raft/consensus.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "serde/serde.h"

#include <seastar/core/future-util.hh>
Expand Down
1 change: 0 additions & 1 deletion src/v/cluster/members_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "raft/consensus_utils.h"
#include "raft/errc.h"
#include "raft/group_configuration.h"
#include "raft/types.h"
#include "random/generators.h"
#include "reflection/adl.h"
#include "storage/api.h"
Expand Down
1 change: 0 additions & 1 deletion src/v/cluster/migrations/tx_manager_migrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "model/record_batch_reader.h"
#include "model/record_batch_types.h"
#include "model/timeout_clock.h"
#include "raft/types.h"
#include "ssx/future-util.h"
#include "storage/types.h"

Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "model/fundamental.h"
#include "model/metadata.h"
#include "model/namespace.h"
#include "raft/fundamental.h"
#include "raft/fwd.h"
#include "raft/state_machine_manager.h"
#include "raft/types.h"

#include <seastar/core/shared_ptr_incomplete.hh>
#include <seastar/coroutine/as_future.hh>
Expand Down
1 change: 0 additions & 1 deletion src/v/cluster/partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "model/record_batch_reader.h"
#include "model/timeout_clock.h"
#include "raft/replicate.h"
#include "raft/types.h"
#include "storage/translating_reader.h"
#include "storage/types.h"

Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/partition_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "model/metadata.h"
#include "raft/consensus.h"
#include "raft/consensus_utils.h"
#include "raft/fundamental.h"
#include "raft/group_configuration.h"
#include "raft/rpc_client_protocol.h"
#include "raft/types.h"
#include "resource_mgmt/io_priority.h"
#include "ssx/async-clear.h"
#include "storage/segment_utils.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/rm_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "prometheus/prometheus_sanitize.h"
#include "raft/consensus_utils.h"
#include "raft/errc.h"
#include "raft/fundamental.h"
#include "raft/persisted_stm.h"
#include "raft/state_machine_base.h"
#include "raft/types.h"
#include "ssx/future-util.h"
#include "storage/parser_utils.h"
#include "storage/record_batch_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/security_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "model/namespace.h"
#include "model/validation.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "random/generators.h"
#include "rpc/errc.h"
#include "rpc/types.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/security_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "cluster/commands.h"
#include "cluster/controller_snapshot.h"
#include "model/metadata.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "security/authorizer.h"
#include "security/credential_store.h"
#include "security/role_store.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/allocation_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "base/outcome.h"
#include "cluster/tests/partition_allocator_fixture.h"
#include "cluster/types.h"
#include "raft/types.h"
#include "raft/fundamental.h"

#include <seastar/core/reactor.hh>
#include <seastar/core/sharded.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/commands_serialization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "model/compression.h"
#include "model/fundamental.h"
#include "model/metadata.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "test_utils/fixture.h"
#include "topic_table_fixture.h"

Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/id_allocator_stm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "model/fundamental.h"
#include "model/record.h"
#include "model/timeout_clock.h"
#include "raft/fundamental.h"
#include "raft/tests/simple_raft_fixture.h"
#include "raft/types.h"
#include "random/generators.h"
#include "reflection/adl.h"
#include "storage/record_batch_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/idempotency_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "model/tests/random_batch.h"
#include "model/timestamp.h"
#include "raft/consensus_utils.h"
#include "raft/fundamental.h"
#include "raft/tests/raft_group_fixture.h"
#include "raft/types.h"
#include "random/generators.h"
#include "storage/record_batch_builder.h"
#include "storage/tests/utils/disk_log_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/leader_balancer_constraints_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "leader_balancer_test_utils.h"
#include "model/fundamental.h"
#include "model/metadata.h"
#include "raft/types.h"
#include "raft/fundamental.h"

#include <absl/container/flat_hash_map.h>
#include <absl/container/flat_hash_set.h>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/manual_log_deletion_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "model/record.h"
#include "model/timestamp.h"
#include "raft/consensus_utils.h"
#include "raft/fundamental.h"
#include "raft/tests/raft_group_fixture.h"
#include "raft/types.h"
#include "random/generators.h"
#include "storage/record_batch_builder.h"
#include "storage/tests/utils/disk_log_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/partition_allocator_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "cluster/scheduling/types.h"
#include "cluster/tests/partition_allocator_fixture.h"
#include "model/metadata.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "random/fast_prng.h"
#include "random/generators.h"
#include "test_utils/fixture.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/partition_leaders_table_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "model/metadata.h"
#include "model/namespace.h"
#include "model/timeout_clock.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "random/generators.h"
#include "test_utils/randoms.h"
#include "test_utils/test.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/plugin_frontend_validation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "model/metadata.h"
#include "model/namespace.h"
#include "model/transform.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "utils/uuid.h"

#include <seastar/core/chunked_fifo.hh>
Expand Down
1 change: 0 additions & 1 deletion src/v/cluster/tests/rm_stm_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "model/timestamp.h"
#include "raft/consensus_utils.h"
#include "raft/tests/raft_group_fixture.h"
#include "raft/types.h"
#include "random/generators.h"
#include "storage/record_batch_builder.h"
#include "storage/tests/utils/disk_log_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/serialization_rt_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "model/tests/random_batch.h"
#include "model/tests/randoms.h"
#include "model/timestamp.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "random/generators.h"
#include "reflection/adl.h"
#include "reflection/async_adl.h"
Expand Down
1 change: 0 additions & 1 deletion src/v/cluster/tests/tm_stm_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "raft/consensus_utils.h"
#include "raft/tests/raft_group_fixture.h"
#include "raft/tests/simple_raft_fixture.h"
#include "raft/types.h"
#include "random/generators.h"
#include "storage/record_batch_builder.h"
#include "storage/tests/utils/disk_log_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tests/topic_table_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "cluster/types.h"
#include "model/fundamental.h"
#include "model/metadata.h"
#include "raft/types.h"
#include "raft/fundamental.h"

#include <seastar/core/chunked_fifo.hh>
#include <seastar/testing/thread_test_case.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tm_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "cluster/types.h"
#include "model/record.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "storage/record_batch_builder.h"

#include <seastar/core/coroutine.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/tm_stm_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "cluster/types.h"
#include "model/record.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "storage/record_batch_builder.h"

#include <seastar/core/coroutine.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/topic_updates_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "cluster/topic_table.h"
#include "model/fundamental.h"
#include "model/metadata.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "ssx/future-util.h"

#include <seastar/coroutine/maybe_yield.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/topics_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "model/validation.h"
#include "raft/consensus_client_protocol.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "random/generators.h"
#include "rpc/errc.h"
#include "rpc/types.h"
Expand Down
5 changes: 4 additions & 1 deletion src/v/cluster/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "model/transform.h"
#include "pandaproxy/schema_registry/subject_name_strategy.h"
#include "raft/errc.h"
#include "raft/fundamental.h"
#include "raft/fwd.h"
#include "raft/transfer_leadership.h"
#include "security/acl.h"
#include "security/license.h"
#include "security/role.h"
Expand Down Expand Up @@ -2663,6 +2663,9 @@ struct delete_acls_reply
auto serde_fields() { return std::tie(results); }
};

using transfer_leadership_request = raft::transfer_leadership_request;
using transfer_leadership_reply = raft::transfer_leadership_reply;

struct backend_operation
: serde::
envelope<backend_operation, serde::version<1>, serde::compat_version<0>> {
Expand Down
1 change: 0 additions & 1 deletion src/v/kafka/protocol/kafka_batch_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "kafka/protocol/wire.h"
#include "model/fundamental.h"
#include "model/record.h"
#include "raft/types.h"
#include "storage/parser_utils.h"

#include <seastar/core/smp.hh>
Expand Down
2 changes: 1 addition & 1 deletion src/v/kafka/server/group_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "model/namespace.h"
#include "model/record.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "raft/fundamental.h"
#include "resource_mgmt/io_priority.h"
#include "ssx/future-util.h"

Expand Down
1 change: 0 additions & 1 deletion src/v/kafka/server/handlers/produce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "model/timestamp.h"
#include "pandaproxy/schema_registry/validation.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "ssx/future-util.h"
#include "utils/remote.h"
#include "utils/to_string.h"
Expand Down
1 change: 0 additions & 1 deletion src/v/kafka/server/replicated_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "model/timeout_clock.h"
#include "raft/consensus_utils.h"
#include "raft/errc.h"
#include "raft/types.h"
#include "storage/log_reader.h"
#include "storage/types.h"

Expand Down
27 changes: 27 additions & 0 deletions src/v/model/fundamental.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,33 @@ namespace model {
using node_uuid = named_type<uuid_t, struct node_uuid_type>;
using cluster_uuid = named_type<uuid_t, struct cluster_uuid_type>;

using node_id = named_type<int32_t, struct node_id_model_type>;

/**
* Reserved to represent the node_id value yet to be assigned
* when node is configured for automatic assignment of node_ids.
* Never used in node configuration.
*/
constexpr node_id unassigned_node_id(-1);

/**
* We use revision_id to identify entities evolution in time. f.e. NTP that was
* first created and then removed, raft configuration
*/
using revision_id = named_type<int64_t, struct revision_id_model_type>;

/**
* Revision id that the partition had when the topic was just created.
* The revision_id of the partition might change when the partition is moved
* between the nodes.
*/
using initial_revision_id
= named_type<int64_t, struct initial_revision_id_model_type>;

// tracking evolution of the shard table
using shard_revision_id
= named_type<int64_t, struct shard_revision_id_model_type>;

// Named after Kafka cleanup.policy topic property
enum class cleanup_policy_bitflags : uint8_t {
none = 0,
Expand Down
Loading

0 comments on commit 7fd9f10

Please sign in to comment.