mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-21 21:08:07 +00:00
perf: Major event processing system refactor for improved performance
This commit is contained in:
@@ -41,16 +41,33 @@ impl ShredStreamGrpc {
|
||||
})
|
||||
}
|
||||
|
||||
/// 创建高性能客户端(适合高并发场景)
|
||||
pub async fn new_high_performance(endpoint: String) -> AnyResult<Self> {
|
||||
Self::new_with_config(endpoint, StreamClientConfig::high_performance()).await
|
||||
/// Creates a new ShredStreamClient with high-throughput configuration.
|
||||
///
|
||||
/// This is a convenience method that creates a client optimized for high-concurrency scenarios
|
||||
/// where throughput is prioritized over latency. See `StreamClientConfig::high_throughput()`
|
||||
/// for detailed configuration information.
|
||||
pub async fn new_high_throughput(endpoint: String) -> AnyResult<Self> {
|
||||
Self::new_with_config(endpoint, StreamClientConfig::high_throughput()).await
|
||||
}
|
||||
|
||||
/// 创建低延迟客户端(适合实时场景)
|
||||
/// Creates a new ShredStreamClient with low-latency configuration.
|
||||
///
|
||||
/// This is a convenience method that creates a client optimized for real-time scenarios
|
||||
/// where latency is prioritized over throughput. See `StreamClientConfig::low_latency()`
|
||||
/// for detailed configuration information.
|
||||
pub async fn new_low_latency(endpoint: String) -> AnyResult<Self> {
|
||||
Self::new_with_config(endpoint, StreamClientConfig::low_latency()).await
|
||||
}
|
||||
|
||||
/// Creates a new ShredStreamClient with asynchronous processing configuration.
|
||||
///
|
||||
/// This is a convenience method that creates a client optimized for high-volume scenarios
|
||||
/// with balanced throughput and reliability. See `StreamClientConfig::async_processing()`
|
||||
/// for detailed configuration information.
|
||||
pub async fn new_async_processing(endpoint: String) -> AnyResult<Self> {
|
||||
Self::new_with_config(endpoint, StreamClientConfig::async_processing()).await
|
||||
}
|
||||
|
||||
/// 获取当前配置
|
||||
pub fn get_config(&self) -> &StreamClientConfig {
|
||||
&self.config
|
||||
|
||||
@@ -8,6 +8,6 @@ pub use types::*;
|
||||
|
||||
// 从公用模块重新导出
|
||||
pub use crate::streaming::common::{
|
||||
BackpressureConfig, BackpressureStrategy, BatchConfig, ConnectionConfig, MetricsEventType,
|
||||
MetricsManager, PerformanceMetrics, StreamClientConfig,
|
||||
BackpressureConfig, BackpressureStrategy, ConnectionConfig, MetricsEventType, MetricsManager,
|
||||
PerformanceMetrics, StreamClientConfig,
|
||||
};
|
||||
|
||||
@@ -5,16 +5,16 @@ use solana_sdk::transaction::VersionedTransaction;
|
||||
pub struct TransactionWithSlot {
|
||||
pub transaction: VersionedTransaction,
|
||||
pub slot: u64,
|
||||
pub program_received_time_us: i64,
|
||||
}
|
||||
|
||||
impl TransactionWithSlot {
|
||||
/// 创建新的带槽位的交易
|
||||
pub fn new(transaction: VersionedTransaction, slot: u64) -> Self {
|
||||
Self { transaction, slot }
|
||||
}
|
||||
|
||||
/// 获取交易签名
|
||||
pub fn signature(&self) -> String {
|
||||
self.transaction.signatures[0].to_string()
|
||||
pub fn new(
|
||||
transaction: VersionedTransaction,
|
||||
slot: u64,
|
||||
program_received_time_us: i64,
|
||||
) -> Self {
|
||||
Self { transaction, slot, program_received_time_us }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user