solana_core/
admin_rpc_post_init.rs1use {
2 crate::{
3 banking_stage::BankingControlMsg, cluster_slots_service::cluster_slots::ClusterSlots,
4 repair::repair_service::OutstandingShredRepairs,
5 },
6 agave_votor::event::VotorEventSender,
7 solana_gossip::{cluster_info::ClusterInfo, node::NodeMultihoming},
8 solana_ledger::blockstore::Blockstore,
9 solana_pubkey::Pubkey,
10 solana_runtime::{bank_forks::BankForks, snapshot_controller::SnapshotController},
11 solana_tls_utils::NotifyKeyUpdate,
12 std::{
13 collections::{HashMap, HashSet},
14 net::UdpSocket,
15 sync::{Arc, RwLock},
16 },
17 tokio::sync::mpsc,
18};
19
20#[derive(PartialEq, Eq, Hash, Clone, Debug)]
22pub enum KeyUpdaterType {
23 Tpu,
25 TpuForwards,
27 TpuVote,
29 Forward,
31 RpcService,
33 Bls,
35 BlsConnectionCache,
37}
38
39#[derive(Default)]
41pub struct KeyUpdaters {
42 updaters: HashMap<KeyUpdaterType, Arc<dyn NotifyKeyUpdate + Sync + Send>>,
43}
44
45impl KeyUpdaters {
46 pub fn add(
48 &mut self,
49 updater_type: KeyUpdaterType,
50 updater: Arc<dyn NotifyKeyUpdate + Sync + Send>,
51 ) {
52 self.updaters.insert(updater_type, updater);
53 }
54
55 pub fn remove(&mut self, updater_type: &KeyUpdaterType) {
57 self.updaters.remove(updater_type);
58 }
59}
60
61impl<'a> IntoIterator for &'a KeyUpdaters {
63 type Item = (
64 &'a KeyUpdaterType,
65 &'a Arc<dyn NotifyKeyUpdate + Sync + Send>,
66 );
67 type IntoIter = std::collections::hash_map::Iter<
68 'a,
69 KeyUpdaterType,
70 Arc<dyn NotifyKeyUpdate + Sync + Send>,
71 >;
72
73 fn into_iter(self) -> Self::IntoIter {
74 self.updaters.iter()
75 }
76}
77
78#[derive(Clone)]
79pub struct AdminRpcRequestMetadataPostInit {
80 pub cluster_info: Arc<ClusterInfo>,
81 pub bank_forks: Arc<RwLock<BankForks>>,
82 pub vote_account: Pubkey,
83 pub repair_whitelist: Arc<RwLock<HashSet<Pubkey>>>,
84 pub notifies: Arc<RwLock<KeyUpdaters>>,
85 pub repair_socket: Arc<UdpSocket>,
86 pub outstanding_repair_requests: Arc<RwLock<OutstandingShredRepairs>>,
87 pub cluster_slots: Arc<ClusterSlots>,
88 pub node: Option<Arc<NodeMultihoming>>,
89 pub banking_control_sender: mpsc::Sender<BankingControlMsg>,
90 pub snapshot_controller: Arc<SnapshotController>,
91 pub blockstore: Arc<Blockstore>,
92 pub votor_event_sender: VotorEventSender,
93}