MCPcopy Create free account
hub / github.com/apache/dubbo-rust / init

Method init

dubbo/src/framework.rs:63–108  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

61 }
62
63 pub fn init(&mut self) -> Result<(), Box<dyn Error>> {
64 if self.config.is_none() {
65 self.config = Some(get_global_config())
66 }
67
68 let root_config = self.config.as_ref().unwrap();
69 debug!("global conf: {:?}", root_config);
70 // env::set_var("ZOOKEEPER_SERVERS",root_config);
71 for (_, service_config) in root_config.provider.services.iter() {
72 info!("init service name: {}", service_config.interface);
73 let url = if root_config
74 .protocols
75 .contains_key(service_config.protocol.as_str())
76 {
77 let protocol = root_config
78 .protocols
79 .get_protocol_or_default(service_config.protocol.as_str());
80 let interface_name = service_config.interface.clone();
81 let protocol_url = format!(
82 "{}/{}?interface={}",
83 protocol.to_url(),
84 interface_name,
85 interface_name
86 );
87 info!("protocol_url: {:?}", protocol_url);
88 protocol_url.parse().ok()
89 } else {
90 return Err(format!("base {:?} not exists", service_config.protocol).into());
91 };
92 info!("url: {:?}", url);
93 if url.is_none() {
94 continue;
95 }
96 let u = url.unwrap();
97 if self.protocols.get(&service_config.protocol).is_some() {
98 self.protocols
99 .get_mut(&service_config.protocol)
100 .unwrap()
101 .push(u);
102 } else {
103 self.protocols
104 .insert(service_config.protocol.clone(), vec![u]);
105 }
106 }
107 Ok(())
108 }
109
110 pub async fn start(&mut self) {
111 self.init().unwrap();

Callers 5

test_register_to_nacosFunction · 0.45
test_subscribeFunction · 0.45
test_unsubscribeFunction · 0.45
startMethod · 0.45

Calls 6

get_global_configFunction · 0.85
getMethod · 0.80
insertMethod · 0.80
as_strMethod · 0.45
cloneMethod · 0.45

Tested by 4

test_register_to_nacosFunction · 0.36
test_subscribeFunction · 0.36
test_unsubscribeFunction · 0.36