Skip to content

Commit e2ff576

Browse files
committed
c/leader_balancer: reorder class fields
No functional changes.
1 parent f6b37d7 commit e2ff576

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

src/v/cluster/scheduling/leader_balancer.h

+25-13
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ class leader_balancer {
137137

138138
bool should_stop_balance() const;
139139

140+
/// Config binding fields
141+
140142
// On/off switch: when off, leader balancer tick will run
141143
// but do nothing
142144
config::binding<bool> _enabled;
@@ -185,20 +187,8 @@ class leader_balancer {
185187

186188
config::binding<config::leaders_preference> _default_preference;
187189

188-
struct last_known_leader {
189-
model::broker_shard shard;
190-
clock_type::time_point expires;
191-
};
192-
absl::btree_map<raft::group_id, last_known_leader> _last_leader;
190+
/// Service dependencies
193191

194-
leader_balancer_probe _probe;
195-
bool _need_controller_refresh{true};
196-
bool _throttled{false};
197-
absl::btree_map<raft::group_id, clock_type::time_point> _muted;
198-
cluster::notification_id_type _leader_notify_handle;
199-
std::optional<cluster::notification_id_type>
200-
_leadership_change_notify_handle;
201-
cluster::notification_id_type _maintenance_state_notify_handle;
202192
topic_table& _topics;
203193
partition_leaders_table& _leaders;
204194
members_table& _members;
@@ -209,15 +199,37 @@ class leader_balancer {
209199
ss::sharded<partition_manager>& _partition_manager;
210200
ss::sharded<ss::abort_source>& _as;
211201
consensus_ptr _raft0;
202+
203+
/// Notifications
204+
205+
cluster::notification_id_type _leader_notify_handle;
206+
std::optional<cluster::notification_id_type>
207+
_leadership_change_notify_handle;
208+
cluster::notification_id_type _maintenance_state_notify_handle;
209+
212210
ss::gate _gate;
213211
ss::timer<clock_type> _timer;
214212

213+
/// Internal state
214+
215+
struct last_known_leader {
216+
model::broker_shard shard;
217+
clock_type::time_point expires;
218+
};
219+
absl::btree_map<raft::group_id, last_known_leader> _last_leader;
220+
221+
bool _need_controller_refresh{true};
222+
bool _throttled{false};
223+
absl::btree_map<raft::group_id, clock_type::time_point> _muted;
224+
215225
struct in_flight_reassignment {
216226
reassignment value;
217227
clock_type::time_point expires;
218228
};
219229
absl::flat_hash_map<raft::group_id, in_flight_reassignment>
220230
_in_flight_changes;
231+
232+
leader_balancer_probe _probe;
221233
};
222234

223235
} // namespace cluster

0 commit comments

Comments
 (0)