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

Function save

chirpstack/src/storage/downlink_frame.rs:10–23  ·  view source on GitHub ↗
(df: &internal::DownlinkFrame)

Source from the content-addressed store, hash-verified

8use chirpstack_api::internal;
9
10pub async fn save(df: &internal::DownlinkFrame) -> Result<()> {
11 let b = df.encode_to_vec();
12 let key = redis_key(format!("frame:{}", df.downlink_id));
13
14 () = redis::cmd("SETEX")
15 .arg(key)
16 .arg(30)
17 .arg(b)
18 .query_async(&mut get_async_redis_conn().await?)
19 .await?;
20
21 info!(downlink_id = df.downlink_id, "Downlink-frame saved");
22 Ok(())
23}
24
25pub async fn get_and_del(id: u32) -> Result<internal::DownlinkFrame, Error> {
26 let key = redis_key(format!("frame:{}", id));

Callers 1

test_downlink_frameFunction · 0.70

Calls 2

redis_keyFunction · 0.85
get_async_redis_connFunction · 0.85

Tested by 1

test_downlink_frameFunction · 0.56