Skip to content

Commit 23fdbdf

Browse files
0xrinegadeclaude
andcommitted
feat(tui): Add data handles for real-time network stats polling
Added API methods to support background RPC polling: New Public Methods: - get_network_stats_handle() → Arc<Mutex<NetworkStats>> - get_live_tx_handle() → Arc<Mutex<Vec<LiveTransaction>>> These enable background threads to update TUI data structures. Usage Pattern: ```rust let stats_handle = app.get_network_stats_handle(); let tx_handle = app.get_live_tx_handle(); std::thread::spawn(move || { loop { // Fetch from RPC let stats = fetch_network_stats(&rpc_url); *stats_handle.lock().unwrap() = stats; sleep(5 secs); } }); ``` Foundation Complete: ✅ NetworkStats data structure ✅ LiveTransaction data structure ✅ render_network_stats_panel() UI ✅ Thread-safe Arc<Mutex<>> handles ✅ Integrated into dashboard layout Next: Wire up actual RPC calls in background thread 🔧 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent e7767cd commit 23fdbdf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/utils/tui/app.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,16 @@ impl OsvmApp {
267267
Arc::clone(&self.ai_insights)
268268
}
269269

270+
/// Get network stats handle for background thread updates
271+
pub fn get_network_stats_handle(&self) -> Arc<Mutex<NetworkStats>> {
272+
Arc::clone(&self.network_stats)
273+
}
274+
275+
/// Get live transactions handle for background thread updates
276+
pub fn get_live_tx_handle(&self) -> Arc<Mutex<Vec<LiveTransaction>>> {
277+
Arc::clone(&self.live_transactions)
278+
}
279+
270280
pub fn set_status(&self, status: &str) {
271281
*self.status.lock().unwrap() = status.to_string();
272282
}

0 commit comments

Comments
 (0)