mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-26 07:49:22 -05:00
Merge branch 'parse_as_target_no_async' into 'main'
Make VeilidAPI::parse_as_target a sync function See merge request veilid/veilid!262
This commit is contained in:
commit
2ec00e18da
@ -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