Files
solana-streamer/src/streaming/event_parser/protocols/block/block_meta_event.rs
T
ysq b71a83bf66 perf: add object pooling and enhanced metrics for streaming optimization
- Implement gRPC/shred connection pools for memory efficiency
- Add atomic processing time stats with auto-calibration clock
- Optimize event parsers and protocol handlers
- Refactor metrics system for advanced performance monitoring
2025-09-02 17:27:27 +08:00

42 lines
1.2 KiB
Rust

use crate::impl_unified_event;
use crate::streaming::event_parser::common::{types::EventType, EventMetadata};
use borsh::BorshDeserialize;
use serde::{Deserialize, Serialize};
use solana_sdk::signature::Signature;
/// Block元数据事件
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
pub struct BlockMetaEvent {
#[borsh(skip)]
pub metadata: EventMetadata,
pub slot: u64,
pub block_hash: String,
}
impl BlockMetaEvent {
pub fn new(
slot: u64,
block_hash: String,
block_time_ms: i64,
program_received_time_us: i64,
) -> Self {
let metadata = EventMetadata::new(
Signature::default(),
slot,
block_time_ms / 1000,
block_time_ms,
crate::streaming::event_parser::common::types::ProtocolType::Common,
EventType::BlockMeta,
solana_sdk::pubkey::Pubkey::default(),
0,
None,
program_received_time_us,
None,
);
Self { metadata, slot, block_hash }
}
}
// 使用macro生成UnifiedEvent实现
impl_unified_event!(BlockMetaEvent,);