MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / get

Function get

chirpstack/src/storage/device_session.rs:11–25  ·  view source on GitHub ↗
(dev_eui: &EUI64)

Source from the content-addressed store, hash-verified

9use lrwn::EUI64;
10
11pub async fn get(dev_eui: &EUI64) -> Result<internal::DeviceSession, Error> {
12 let key = redis_key(format!("device:{{{}}}:ds", dev_eui));
13
14 let v: Vec<u8> = redis::cmd("GET")
15 .arg(key)
16 .query_async(&mut get_async_redis_conn().await?)
17 .await
18 .context("Get device-session")?;
19 if v.is_empty() {
20 return Err(Error::NotFound(dev_eui.to_string()));
21 }
22 let ds =
23 internal::DeviceSession::decode(&mut Cursor::new(v)).context("Decode device-session")?;
24 Ok(ds)
25}

Callers

nothing calls this directly

Calls 4

redis_keyFunction · 0.85
get_async_redis_connFunction · 0.85
to_stringMethod · 0.80
decodeFunction · 0.50

Tested by

no test coverage detected