bp_resolver.rs

Overview

This file implements the BPResolverImpl struct, which provides functionality for managing and resolving Breakpoint (BP) socket addresses associated with different thread identifiers. It maintains a thread-safe mapping between thread IDs and their corresponding lists of socket addresses, supports updating this mapping dynamically, and offers a resolution mechanism to obtain the relevant socket addresses for a given thread ID. The component is designed to listen for incoming updates asynchronously and integrates with a message routing system via the BPResolver trait.

Detailed Components

BPResolverImpl Struct


Methods of BPResolverImpl

new(default_bp: SocketAddr) -> Self


upsert(&mut self, thread_id: String, bp_list: Vec<String>) -> anyhow::Result<()>


start_listener(resolver: Arc<Mutex<BPResolverImpl>>, bp_data_rx: mpsc::Receiver<(String, Vec<String>)>) -> anyhow::Result<()>


impl BPResolver for BPResolverImpl


Important Implementation Details and Algorithms

Interaction with Other System Components

Visual Diagram

classDiagram
class BPResolverImpl {
-default_bp: SocketAddr
-map_thread_addr: Arc<RwLock<HashMap<String, Vec<SocketAddr>>>>
+new(default_bp: SocketAddr)
+upsert(thread_id: String, bp_list: Vec<String>) Result
+start_listener(resolver: Arc<Mutex<BPResolverImpl>>, bp_data_rx: mpsc::Receiver)
+resolve(thread_id: Option<String>) Vec<SocketAddr>
}
BPResolverImpl ..|> BPResolver

This diagram shows the core structure of BPResolverImpl, its fields, and public methods, as well as its implementation of the BPResolver trait.