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

Method request

backend/src/lib.rs:310–353  ·  view source on GitHub ↗
(
        &self,
        target_role: Option<Role>,
        pl: &S,
        ans: &mut D,
        async_resp: Option<Receiver<Vec<u8>>>,
    )

Source from the content-addressed store, hash-verified

308 }
309
310 async fn request<S, D>(
311 &self,
312 target_role: Option<Role>,
313 pl: &S,
314 ans: &mut D,
315 async_resp: Option<Receiver<Vec<u8>>>,
316 ) -> Result<()>
317 where
318 S: ?Sized + serde::ser::Serialize + BasePayloadProvider,
319 D: serde::de::DeserializeOwned + BasePayloadResultProvider,
320 {
321 let bp = pl.base_payload().clone();
322
323 let mut be_req_log = stream::BackendInterfacesRequest {
324 time: Some(Utc::now().into()),
325 sender_id: hex::encode(&bp.sender_id),
326 receiver_id: hex::encode(&bp.receiver_id),
327 transaction_id: bp.transaction_id,
328 message_type: format!("{:?}", bp.message_type),
329 ..Default::default()
330 };
331
332 let span = span!(Level::INFO, "request", message_type = ?bp.message_type, sender_id = %be_req_log.sender_id, receiver_id = %be_req_log.receiver_id, transaction_id = bp.transaction_id);
333
334 let res = self
335 ._request(target_role, pl, ans, async_resp, &mut be_req_log)
336 .instrument(span)
337 .await;
338
339 if let Err(e) = &res {
340 be_req_log.request_error = format!("{:#}", e);
341 }
342
343 if let Some(tx) = &self.config.request_log_sender {
344 // We use try_send here as we don't want to delay the response in case
345 // there is no channel capacity. This would also log an error, proving
346 // feedback that there is a channel capacity issue.
347 if let Err(e) = tx.try_send(be_req_log) {
348 error!(error = %e, "Sending request-log to stream error");
349 }
350 }
351
352 res
353 }
354
355 async fn _request<S, D>(
356 &self,

Callers 7

join_reqMethod · 0.80
rejoin_reqMethod · 0.80
app_s_key_reqMethod · 0.80
pr_start_reqMethod · 0.80
pr_stop_reqMethod · 0.80
home_ns_reqMethod · 0.80
xmit_data_reqMethod · 0.80

Calls 4

base_payloadMethod · 0.80
_requestMethod · 0.80
encodeFunction · 0.50
intoMethod · 0.45

Tested by

no test coverage detected