mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-08 14:42:36 -04:00
add writer to set_dht_value, allow multiple open_dht_record
This commit is contained in:
parent
fac9937cf4
commit
0c3271b3b9
19 changed files with 161 additions and 66 deletions
|
@ -667,12 +667,16 @@ pub extern "C" fn routing_context_set_dht_value(
|
|||
key: FfiStr,
|
||||
subkey: u32,
|
||||
data: FfiStr,
|
||||
writer: FfiStr,
|
||||
) {
|
||||
let key: veilid_core::TypedKey =
|
||||
veilid_core::deserialize_opt_json(key.into_opt_string()).unwrap();
|
||||
let data: Vec<u8> = data_encoding::BASE64URL_NOPAD
|
||||
.decode(data.into_opt_string().unwrap().as_bytes())
|
||||
.unwrap();
|
||||
let writer: Option<veilid_core::KeyPair> = writer
|
||||
.into_opt_string()
|
||||
.map(|s| veilid_core::deserialize_json(&s).unwrap());
|
||||
|
||||
DartIsolateWrapper::new(port).spawn_result_json(async move {
|
||||
let routing_context = {
|
||||
|
@ -686,7 +690,9 @@ pub extern "C" fn routing_context_set_dht_value(
|
|||
};
|
||||
routing_context.clone()
|
||||
};
|
||||
let res = routing_context.set_dht_value(key, subkey, data).await?;
|
||||
let res = routing_context
|
||||
.set_dht_value(key, subkey, data, writer)
|
||||
.await?;
|
||||
APIResult::Ok(res)
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue