MCPcopy Create free account
hub / github.com/apache/skywalking-php / get_peer

Function get_peer

src/plugin/plugin_memcached.rs:369–390  ·  view source on GitHub ↗
(this: &mut ZObj, key: ZVal)

Source from the content-addressed store, hash-verified

367}
368
369fn get_peer(this: &mut ZObj, key: ZVal) -> String {
370 let f = || {
371 let info = this.call(&"getServerByKey".to_ascii_lowercase(), [key])?;
372 let info = info.as_z_arr().context("Server isn't array")?;
373 let host = info
374 .get("host")
375 .context("Server host not exists")?
376 .as_z_str()
377 .context("Server host isn't string")?
378 .to_str()?;
379 let port = info
380 .get("port")
381 .context("Server port not exists")?
382 .as_long()
383 .context("Server port isn't long")?;
384 Ok::<_, crate::Error>(format!("{}:{}", host, port))
385 };
386 f().unwrap_or_else(|err| {
387 warn!(?err, "Get peer failed");
388 "".to_owned()
389 })
390}

Calls

no outgoing calls

Tested by

no test coverage detected