remove discv5 apis

This commit is contained in:
al8n 2023-01-05 22:38:19 +13:00
parent 04cfe90d26
commit f9b8c8eb43
4 changed files with 1 additions and 55 deletions

View File

@ -1,30 +0,0 @@
// std
use std::ffi::CStr;
// crates
use crate::general::JsonResponse;
use crate::Result;
/// Starts the DiscoveryV5 service to discover and connect to new peers
pub fn waku_discv5_start() -> Result<bool> {
let result = unsafe { CStr::from_ptr(waku_sys::waku_discv5_start()) }
.to_str()
.expect("Response should always succeed to load to a &str");
let response: JsonResponse<bool> =
serde_json::from_str(result).expect("JsonResponse should always succeed to deserialize");
response.into()
}
/// Stops the DiscoveryV5 service
pub fn waku_discv5_stop() -> Result<bool> {
let result = unsafe { CStr::from_ptr(waku_sys::waku_discv5_stop()) }
.to_str()
.expect("Response should always succeed to load to a &str");
let response: JsonResponse<bool> =
serde_json::from_str(result).expect("JsonResponse should always succeed to deserialize");
response.into()
}

View File

@ -2,7 +2,6 @@
mod config; mod config;
mod discovery; mod discovery;
mod discv5;
mod filter; mod filter;
mod lightpush; mod lightpush;
mod management; mod management;
@ -89,16 +88,6 @@ fn stop_node() -> Result<()> {
} }
impl WakuNodeHandle<Initialized> { impl WakuNodeHandle<Initialized> {
/// Starts the DiscoveryV5 service to discover and connect to new peers
pub fn discv5_start(&self) -> Result<bool> {
discv5::waku_discv5_start()
}
/// Stops the DiscoveryV5 service
pub fn discv5_stop(&self) -> Result<bool> {
discv5::waku_discv5_stop()
}
/// Start a Waku node mounting all the protocols that were enabled during the Waku node instantiation. /// Start a Waku node mounting all the protocols that were enabled during the Waku node instantiation.
/// as per the [specification](https://rfc.vac.dev/spec/36/#extern-char-waku_start) /// as per the [specification](https://rfc.vac.dev/spec/36/#extern-char-waku_start)
pub fn start(self) -> Result<WakuNodeHandle<Running>> { pub fn start(self) -> Result<WakuNodeHandle<Running>> {
@ -119,16 +108,6 @@ impl WakuNodeHandle<Running> {
stop_node() stop_node()
} }
/// Starts the DiscoveryV5 service to discover and connect to new peers
pub fn discv5_start(&self) -> Result<bool> {
discv5::waku_discv5_start()
}
/// Stops the DiscoveryV5 service
pub fn discv5_stop(&self) -> Result<bool> {
discv5::waku_discv5_stop()
}
/// Dial peer using a multiaddress /// Dial peer using a multiaddress
/// If `timeout` as milliseconds doesn't fit into a `i32` it is clamped to [`i32::MAX`] /// If `timeout` as milliseconds doesn't fit into a `i32` it is clamped to [`i32::MAX`]
/// If the function execution takes longer than `timeout` value, the execution will be canceled and an error returned. /// If the function execution takes longer than `timeout` value, the execution will be canceled and an error returned.

View File

@ -37,9 +37,6 @@ pub fn main() -> Result<(), String> {
let node = node.start()?; let node = node.start()?;
println!("Node peer id: {}", node.peer_id()?); println!("Node peer id: {}", node.peer_id()?);
let result = node.discv5_start()?;
println!("Discv5 started: {}", result);
for node_address in NODES { for node_address in NODES {
let address: Multiaddr = node_address.parse().unwrap(); let address: Multiaddr = node_address.parse().unwrap();
let peer_id = node.add_peer(&address, ProtocolId::Relay)?; let peer_id = node.add_peer(&address, ProtocolId::Relay)?;

@ -1 +1 @@
Subproject commit 183d7822bfb5d7149a10823a782b007cc2476b1b Subproject commit 2c9c763c306dfa10dc371134d830702d4e0fbf0f