From 73242ce9a64677a418a25379c0a888305eb1f73d Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Thu, 14 Sep 2023 12:05:13 +0200 Subject: [PATCH] changes after groovies review --- cluster-endpoints/src/json_rpc_leaders_getter.rs | 2 +- .../stores/{cluster_info.rs => cluster_info_store.rs} | 0 core/src/stores/data_cache.rs | 6 +++--- core/src/stores/mod.rs | 6 ++++-- .../{subscription_handler.rs => subscription_store.rs} | 10 ++++------ core/src/structures/mod.rs | 2 ++ .../{block_storage.rs => block_storage_interface.rs} | 0 ...s_fetcher_trait.rs => leaders_fetcher_interface.rs} | 0 core/src/traits/mod.rs | 4 ++-- lite-rpc/src/main.rs | 6 +++--- services/src/tpu_utils/tpu_service.rs | 2 +- 11 files changed, 20 insertions(+), 18 deletions(-) rename core/src/stores/{cluster_info.rs => cluster_info_store.rs} (100%) rename core/src/stores/{subscription_handler.rs => subscription_store.rs} (97%) rename core/src/traits/{block_storage.rs => block_storage_interface.rs} (100%) rename core/src/traits/{leaders_fetcher_trait.rs => leaders_fetcher_interface.rs} (100%) diff --git a/cluster-endpoints/src/json_rpc_leaders_getter.rs b/cluster-endpoints/src/json_rpc_leaders_getter.rs index 5f7ba99a..3f75d5f1 100644 --- a/cluster-endpoints/src/json_rpc_leaders_getter.rs +++ b/cluster-endpoints/src/json_rpc_leaders_getter.rs @@ -3,7 +3,7 @@ use async_trait::async_trait; use itertools::Itertools; use solana_client::nonblocking::rpc_client::RpcClient; use solana_lite_rpc_core::{ - structures::leader_data::LeaderData, traits::leaders_fetcher_trait::LeaderFetcherInterface, + structures::leader_data::LeaderData, traits::leaders_fetcher_interface::LeaderFetcherInterface, }; use std::{collections::VecDeque, sync::Arc}; use tokio::sync::RwLock; diff --git a/core/src/stores/cluster_info.rs b/core/src/stores/cluster_info_store.rs similarity index 100% rename from core/src/stores/cluster_info.rs rename to core/src/stores/cluster_info_store.rs diff --git a/core/src/stores/data_cache.rs b/core/src/stores/data_cache.rs index 17ef9570..bbf01b34 100644 --- a/core/src/stores/data_cache.rs +++ b/core/src/stores/data_cache.rs @@ -5,8 +5,8 @@ use solana_sdk::slot_history::Slot; use crate::{ stores::{ - block_information_store::BlockInformationStore, cluster_info::ClusterInfo, - subscription_handler::SubscriptionHandler, tx_store::TxStore, + block_information_store::BlockInformationStore, cluster_info_store::ClusterInfo, + subscription_store::SubscriptionStore, tx_store::TxStore, }, structures::{ identity_stakes::IdentityStakes, @@ -26,7 +26,7 @@ pub struct SlotCache { pub struct DataCache { pub block_store: BlockInformationStore, pub txs: TxStore, - pub tx_subs: SubscriptionHandler, + pub tx_subs: SubscriptionStore, pub slot_cache: SlotCache, pub identity_stakes: IdentityStakes, pub cluster_info: ClusterInfo, diff --git a/core/src/stores/mod.rs b/core/src/stores/mod.rs index fd36ee8b..1f1b8c51 100644 --- a/core/src/stores/mod.rs +++ b/core/src/stores/mod.rs @@ -1,5 +1,7 @@ +// this mod will contain all the different stores that are used by lite-rpc + pub mod block_information_store; -pub mod cluster_info; +pub mod cluster_info_store; pub mod data_cache; -pub mod subscription_handler; +pub mod subscription_store; pub mod tx_store; diff --git a/core/src/stores/subscription_handler.rs b/core/src/stores/subscription_store.rs similarity index 97% rename from core/src/stores/subscription_handler.rs rename to core/src/stores/subscription_store.rs index 208f8633..9e3b0b14 100644 --- a/core/src/stores/subscription_handler.rs +++ b/core/src/stores/subscription_store.rs @@ -1,21 +1,19 @@ -use std::{sync::Arc, time::Duration}; - +use crate::{structures::processed_block::TransactionInfo, types::SubscptionHanderSink}; use dashmap::DashMap; use solana_sdk::{ commitment_config::{CommitmentConfig, CommitmentLevel}, slot_history::Slot, }; +use std::{sync::Arc, time::Duration}; use tokio::time::Instant; -use crate::{structures::processed_block::TransactionInfo, types::SubscptionHanderSink}; - #[derive(Clone, Default)] -pub struct SubscriptionHandler { +pub struct SubscriptionStore { pub signature_subscribers: Arc>, } -impl SubscriptionHandler { +impl SubscriptionStore { #[allow(deprecated)] pub fn get_supported_commitment_config( commitment_config: CommitmentConfig, diff --git a/core/src/structures/mod.rs b/core/src/structures/mod.rs index 05e1ebfd..2e50b636 100644 --- a/core/src/structures/mod.rs +++ b/core/src/structures/mod.rs @@ -1,3 +1,5 @@ +// this mod will contain all the core structures that are defined for lite-rpc + pub mod identity_stakes; pub mod leader_data; pub mod notifications; diff --git a/core/src/traits/block_storage.rs b/core/src/traits/block_storage_interface.rs similarity index 100% rename from core/src/traits/block_storage.rs rename to core/src/traits/block_storage_interface.rs diff --git a/core/src/traits/leaders_fetcher_trait.rs b/core/src/traits/leaders_fetcher_interface.rs similarity index 100% rename from core/src/traits/leaders_fetcher_trait.rs rename to core/src/traits/leaders_fetcher_interface.rs diff --git a/core/src/traits/mod.rs b/core/src/traits/mod.rs index 43997434..c1746f35 100644 --- a/core/src/traits/mod.rs +++ b/core/src/traits/mod.rs @@ -1,3 +1,3 @@ -pub mod block_storage; -pub mod leaders_fetcher_trait; +pub mod block_storage_interface; +pub mod leaders_fetcher_interface; pub mod subscription_sink; diff --git a/lite-rpc/src/main.rs b/lite-rpc/src/main.rs index 83f02b0b..9da86402 100644 --- a/lite-rpc/src/main.rs +++ b/lite-rpc/src/main.rs @@ -18,9 +18,9 @@ use solana_lite_rpc_core::keypair_loader::load_identity_keypair; use solana_lite_rpc_core::quic_connection_utils::QuicConnectionParameters; use solana_lite_rpc_core::stores::{ block_information_store::{BlockInformation, BlockInformationStore}, - cluster_info::ClusterInfo, + cluster_info_store::ClusterInfo, data_cache::{DataCache, SlotCache}, - subscription_handler::SubscriptionHandler, + subscription_store::SubscriptionStore, tx_store::TxStore, }; use solana_lite_rpc_core::structures::{ @@ -123,7 +123,7 @@ pub async fn start_lite_rpc(args: Args, rpc_client: Arc) -> anyhow::R cluster_info: ClusterInfo::default(), identity_stakes: IdentityStakes::new(validator_identity.pubkey()), slot_cache: SlotCache::new(finalized_block.slot), - tx_subs: SubscriptionHandler::default(), + tx_subs: SubscriptionStore::default(), txs: TxStore::default(), }; diff --git a/services/src/tpu_utils/tpu_service.rs b/services/src/tpu_utils/tpu_service.rs index 669d56ed..4c11713c 100644 --- a/services/src/tpu_utils/tpu_service.rs +++ b/services/src/tpu_utils/tpu_service.rs @@ -7,7 +7,7 @@ use crate::tpu_utils::tpu_connection_path::TpuConnectionPath; use crate::tpu_utils::tpu_service::ConnectionManager::{DirectTpu, QuicProxy}; use solana_lite_rpc_core::quic_connection_utils::QuicConnectionParameters; use solana_lite_rpc_core::stores::data_cache::DataCache; -use solana_lite_rpc_core::traits::leaders_fetcher_trait::LeaderFetcherInterface; +use solana_lite_rpc_core::traits::leaders_fetcher_interface::LeaderFetcherInterface; use solana_lite_rpc_core::types::SlotStream; use solana_lite_rpc_core::AnyhowJoinHandle; use solana_sdk::{quic::QUIC_PORT_OFFSET, signature::Keypair, slot_history::Slot};