Merge commit 'ab0200c2ec7e7ed76afafc5cfa8440f61052d0fb' into perf/improve

This commit is contained in:
ysq
2025-08-29 16:45:22 +08:00
7 changed files with 843 additions and 238 deletions
+41
View File
@@ -29,6 +29,7 @@ A lightweight Rust library for real-time event streaming from Solana DEX trading
16. **Runtime Configuration Updates**: Supports dynamic configuration parameter updates at runtime
17. **Full Function Performance Monitoring**: All subscribe_events functions support performance monitoring, automatically collecting and reporting performance metrics
18. **Graceful Shutdown**: Support for programmatic stop() method for clean shutdown
19. **Dynamic Subscription Management**: Runtime filter updates without reconnection, enabling adaptive monitoring strategies
## Installation
@@ -157,6 +158,20 @@ This example demonstrates:
The example uses a predefined transaction signature and shows how to extract protocol-specific events from the transaction data.
### Dynamic Subscription Management Example
Test runtime filter updates without reconnection:
```bash
cargo run --example dynamic_subscription
```
This example demonstrates:
- Creating initial subscriptions with specific protocol filters
- Updating subscription filters at runtime without reconnection
- Single subscription enforcement and proper error handling
- Clean shutdown and resource management
### Advanced Usage - Complete Example
```rust
@@ -555,6 +570,32 @@ let event_type_filter = Some(EventTypeFilter {
});
```
## Dynamic Subscription Management
Update subscription filters at runtime without reconnecting to the stream.
```rust
// Update filters on existing subscription
grpc.update_subscription(
TransactionFilter {
account_include: vec!["new_program_id".to_string()],
account_exclude: vec![],
account_required: vec![],
},
AccountFilter {
account: vec![],
owner: vec![],
},
).await?;
```
- **No Reconnection**: Filter changes apply immediately without closing the stream
- **Atomic Updates**: Both transaction and account filters updated together
- **Single Subscription**: One active subscription per client instance
- **Compatible**: Works with both immediate and advanced subscription methods
Note: Multiple subscription attempts on the same client return an error.
## Supported Protocols
- **PumpFun**: Primary meme coin trading platform