Skip to content

Commit feb493d

Browse files
committed
Remove try_get_record() and other try_...() non-async methods
1 parent 5432c9b commit feb493d

1 file changed

Lines changed: 0 additions & 64 deletions

File tree

src/protocol/libp2p/kademlia/handle.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -338,70 +338,6 @@ impl KademliaHandle {
338338
pub async fn store_record(&mut self, record: Record) {
339339
let _ = self.cmd_tx.send(KademliaCommand::StoreRecord { record }).await;
340340
}
341-
342-
/// Try to add known peer and if the channel is clogged, return an error.
343-
pub fn try_add_known_peer(&self, peer: PeerId, addresses: Vec<Multiaddr>) -> Result<(), ()> {
344-
self.cmd_tx
345-
.try_send(KademliaCommand::AddKnownPeer { peer, addresses })
346-
.map_err(|_| ())
347-
}
348-
349-
/// Try to initiate `FIND_NODE` query and if the channel is clogged, return an error.
350-
pub fn try_find_node(&mut self, peer: PeerId) -> Result<QueryId, ()> {
351-
let query_id = self.next_query_id();
352-
self.cmd_tx
353-
.try_send(KademliaCommand::FindNode { peer, query_id })
354-
.map(|_| query_id)
355-
.map_err(|_| ())
356-
}
357-
358-
/// Try to initiate `PUT_VALUE` query and if the channel is clogged, return an error.
359-
pub fn try_put_record(&mut self, record: Record) -> Result<QueryId, ()> {
360-
let query_id = self.next_query_id();
361-
self.cmd_tx
362-
.try_send(KademliaCommand::PutRecord { record, query_id })
363-
.map(|_| query_id)
364-
.map_err(|_| ())
365-
}
366-
367-
/// Try to initiate `PUT_VALUE` query to the given peers and if the channel is clogged,
368-
/// return an error.
369-
pub fn try_put_record_to_peers(
370-
&mut self,
371-
record: Record,
372-
peers: Vec<PeerId>,
373-
update_local_store: bool,
374-
) -> Result<QueryId, ()> {
375-
let query_id = self.next_query_id();
376-
self.cmd_tx
377-
.try_send(KademliaCommand::PutRecordToPeers {
378-
record,
379-
query_id,
380-
peers,
381-
update_local_store,
382-
})
383-
.map(|_| query_id)
384-
.map_err(|_| ())
385-
}
386-
387-
/// Try to initiate `GET_VALUE` query and if the channel is clogged, return an error.
388-
pub fn try_get_record(&mut self, key: RecordKey, quorum: Quorum) -> Result<QueryId, ()> {
389-
let query_id = self.next_query_id();
390-
self.cmd_tx
391-
.try_send(KademliaCommand::GetRecord {
392-
key,
393-
quorum,
394-
query_id,
395-
})
396-
.map(|_| query_id)
397-
.map_err(|_| ())
398-
}
399-
400-
/// Try to store the record in the local store, and if the channel is clogged, return an error.
401-
/// Used in combination with [`IncomingRecordValidationMode::Manual`].
402-
pub fn try_store_record(&mut self, record: Record) -> Result<(), ()> {
403-
self.cmd_tx.try_send(KademliaCommand::StoreRecord { record }).map_err(|_| ())
404-
}
405341
}
406342

407343
impl Stream for KademliaHandle {

0 commit comments

Comments
 (0)