mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
Make VeilidAPI::parse_as_target a sync function
VeilidAPI::parse_as_target doesn't perform any async operations so it should be a sync function.
This commit is contained in:
parent
9d3ee579d3
commit
b5cf325c5a
@ -217,7 +217,7 @@ impl VeilidAPI {
|
|||||||
/// `XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` will be parsed with the 'best' cryptosystem
|
/// `XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` will be parsed with the 'best' cryptosystem
|
||||||
/// available (at the time of this writing this is `VLD0`)
|
/// available (at the time of this writing this is `VLD0`)
|
||||||
#[instrument(target = "veilid_api", level = "debug", skip(self), fields(s=s.to_string()), ret, err)]
|
#[instrument(target = "veilid_api", level = "debug", skip(self), fields(s=s.to_string()), ret, err)]
|
||||||
pub async fn parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target> {
|
pub fn parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target> {
|
||||||
let s = s.to_string();
|
let s = s.to_string();
|
||||||
|
|
||||||
event!(target: "veilid_api", Level::DEBUG,
|
event!(target: "veilid_api", Level::DEBUG,
|
||||||
|
@ -568,7 +568,7 @@ pub extern "C" fn routing_context_app_call(port: i64, id: u32, target: FfiStr, r
|
|||||||
let routing_context = get_routing_context(id, "routing_context_app_call")?;
|
let routing_context = get_routing_context(id, "routing_context_app_call")?;
|
||||||
|
|
||||||
let veilid_api = get_veilid_api().await?;
|
let veilid_api = get_veilid_api().await?;
|
||||||
let target = veilid_api.parse_as_target(target_string).await?;
|
let target = veilid_api.parse_as_target(target_string)?;
|
||||||
let answer = routing_context.app_call(target, request).await?;
|
let answer = routing_context.app_call(target, request).await?;
|
||||||
let answer = data_encoding::BASE64URL_NOPAD.encode(&answer);
|
let answer = data_encoding::BASE64URL_NOPAD.encode(&answer);
|
||||||
APIResult::Ok(answer)
|
APIResult::Ok(answer)
|
||||||
@ -585,7 +585,7 @@ pub extern "C" fn routing_context_app_message(port: i64, id: u32, target: FfiStr
|
|||||||
let routing_context = get_routing_context(id, "routing_context_app_message")?;
|
let routing_context = get_routing_context(id, "routing_context_app_message")?;
|
||||||
|
|
||||||
let veilid_api = get_veilid_api().await?;
|
let veilid_api = get_veilid_api().await?;
|
||||||
let target = veilid_api.parse_as_target(target_string).await?;
|
let target = veilid_api.parse_as_target(target_string)?;
|
||||||
routing_context.app_message(target, message).await?;
|
routing_context.app_message(target, message).await?;
|
||||||
APIRESULT_VOID
|
APIRESULT_VOID
|
||||||
});
|
});
|
||||||
|
@ -470,7 +470,7 @@ pub fn routing_context_app_call(id: u32, target_string: String, request: String)
|
|||||||
let routing_context = get_routing_context(id, "routing_context_app_call")?;
|
let routing_context = get_routing_context(id, "routing_context_app_call")?;
|
||||||
|
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let target = veilid_api.parse_as_target(target_string).await?;
|
let target = veilid_api.parse_as_target(target_string)?;
|
||||||
let answer = routing_context.app_call(target, request).await?;
|
let answer = routing_context.app_call(target, request).await?;
|
||||||
let answer = data_encoding::BASE64URL_NOPAD.encode(&answer);
|
let answer = data_encoding::BASE64URL_NOPAD.encode(&answer);
|
||||||
APIResult::Ok(answer)
|
APIResult::Ok(answer)
|
||||||
@ -486,7 +486,7 @@ pub fn routing_context_app_message(id: u32, target_string: String, message: Stri
|
|||||||
let routing_context = get_routing_context(id, "routing_context_app_message")?;
|
let routing_context = get_routing_context(id, "routing_context_app_message")?;
|
||||||
|
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let target = veilid_api.parse_as_target(target_string).await?;
|
let target = veilid_api.parse_as_target(target_string)?;
|
||||||
routing_context.app_message(target, message).await?;
|
routing_context.app_message(target, message).await?;
|
||||||
APIRESULT_UNDEFINED
|
APIRESULT_UNDEFINED
|
||||||
})
|
})
|
||||||
|
@ -161,7 +161,7 @@ impl VeilidRoutingContext {
|
|||||||
let routing_context = self.getRoutingContext()?;
|
let routing_context = self.getRoutingContext()?;
|
||||||
let message = message.into_vec();
|
let message = message.into_vec();
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let target = veilid_api.parse_as_target(target_string).await?;
|
let target = veilid_api.parse_as_target(target_string)?;
|
||||||
routing_context.app_message(target, message).await?;
|
routing_context.app_message(target, message).await?;
|
||||||
APIRESULT_UNDEFINED
|
APIRESULT_UNDEFINED
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ impl VeilidRoutingContext {
|
|||||||
let routing_context = self.getRoutingContext()?;
|
let routing_context = self.getRoutingContext()?;
|
||||||
|
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let target = veilid_api.parse_as_target(target_string).await?;
|
let target = veilid_api.parse_as_target(target_string)?;
|
||||||
let answer = routing_context.app_call(target, request).await?;
|
let answer = routing_context.app_call(target, request).await?;
|
||||||
let answer = Uint8Array::from(answer.as_slice());
|
let answer = Uint8Array::from(answer.as_slice());
|
||||||
APIResult::Ok(answer)
|
APIResult::Ok(answer)
|
||||||
|
Loading…
Reference in New Issue
Block a user