Only pass num_transactions to EntryNotifier (#31053)
* Add EntrySummary struct * Add new entry struct to send to notifier
This commit is contained in:
parent
9cbaf0e234
commit
c98b7f0c46
|
@ -146,6 +146,22 @@ pub struct Entry {
|
|||
pub transactions: Vec<VersionedTransaction>,
|
||||
}
|
||||
|
||||
pub struct EntrySummary {
|
||||
pub num_hashes: u64,
|
||||
pub hash: Hash,
|
||||
pub num_transactions: u64,
|
||||
}
|
||||
|
||||
impl From<Entry> for EntrySummary {
|
||||
fn from(entry: Entry) -> Self {
|
||||
Self {
|
||||
num_hashes: entry.num_hashes,
|
||||
hash: entry.hash,
|
||||
num_transactions: entry.transactions.len() as u64,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Typed entry to distinguish between transaction and tick entries
|
||||
pub enum EntryType {
|
||||
Transactions(Vec<SanitizedTransaction>),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
use {
|
||||
crate::geyser_plugin_manager::GeyserPluginManager,
|
||||
log::*,
|
||||
solana_entry::entry::Entry,
|
||||
solana_entry::entry::EntrySummary,
|
||||
solana_geyser_plugin_interface::geyser_plugin_interface::{
|
||||
ReplicaEntryInfo, ReplicaEntryInfoVersions,
|
||||
},
|
||||
|
@ -18,7 +18,7 @@ pub(crate) struct EntryNotifierImpl {
|
|||
}
|
||||
|
||||
impl EntryNotifier for EntryNotifierImpl {
|
||||
fn notify_entry<'a>(&'a self, slot: Slot, index: usize, entry: &'a Entry) {
|
||||
fn notify_entry<'a>(&'a self, slot: Slot, index: usize, entry: &'a EntrySummary) {
|
||||
let mut measure = Measure::start("geyser-plugin-notify_plugins_of_entry_info");
|
||||
|
||||
let plugin_manager = self.plugin_manager.read().unwrap();
|
||||
|
@ -63,14 +63,14 @@ impl EntryNotifierImpl {
|
|||
fn build_replica_entry_info(
|
||||
slot: Slot,
|
||||
index: usize,
|
||||
entry: &'_ Entry,
|
||||
entry: &'_ EntrySummary,
|
||||
) -> ReplicaEntryInfo<'_> {
|
||||
ReplicaEntryInfo {
|
||||
slot,
|
||||
index,
|
||||
num_hashes: entry.num_hashes,
|
||||
hash: entry.hash.as_ref(),
|
||||
executed_transaction_count: entry.transactions.len() as u64,
|
||||
executed_transaction_count: entry.num_transactions,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use {
|
||||
solana_entry::entry::Entry,
|
||||
solana_entry::entry::EntrySummary,
|
||||
solana_sdk::clock::Slot,
|
||||
std::sync::{Arc, RwLock},
|
||||
};
|
||||
|
||||
pub trait EntryNotifier {
|
||||
fn notify_entry(&self, slot: Slot, index: usize, entry: &Entry);
|
||||
fn notify_entry(&self, slot: Slot, index: usize, entry: &EntrySummary);
|
||||
}
|
||||
|
||||
pub type EntryNotifierLock = Arc<RwLock<dyn EntryNotifier + Sync + Send>>;
|
||||
|
|
Loading…
Reference in New Issue