Struct nakamoto_node::client::Handle
source · [−]pub struct Handle<W>where
W: Waker,{ /* private fields */ }Expand description
An instance of handle::Handle for Client.
Implementations
sourceimpl<W> Handle<W>where
W: Waker,
impl<W> Handle<W>where
W: Waker,
sourcepub fn listening(&mut self) -> Result<SocketAddr, Error>
pub fn listening(&mut self) -> Result<SocketAddr, Error>
Wait for node to start listening for incoming connections.
sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Set the timeout for operations that wait on the network.
Trait Implementations
sourceimpl<W> Handle for Handle<W>where
W: Waker,
impl<W> Handle for Handle<W>where
W: Waker,
sourcefn query_tree(
&self,
query: impl Fn(&dyn BlockReader) + Send + Sync + 'static
) -> Result<(), Error>
fn query_tree(
&self,
query: impl Fn(&dyn BlockReader) + Send + Sync + 'static
) -> Result<(), Error>
sourcefn find_branch(
&self,
to: &BlockHash
) -> Result<Option<(u64, NonEmpty<BlockHeader>)>, Error>
fn find_branch(
&self,
to: &BlockHash
) -> Result<Option<(u64, NonEmpty<BlockHeader>)>, Error>
Find a branch from the active chain to the given (stale) block. Read more
sourcefn get_filters(&self, range: RangeInclusive<u64>) -> Result<(), Error>
fn get_filters(&self, range: RangeInclusive<u64>) -> Result<(), Error>
Get compact filters from the network.
sourcefn filters(&self) -> Receiver<(BlockFilter, BlockHash, u64)>
fn filters(&self) -> Receiver<(BlockFilter, BlockHash, u64)>
Subscribe to compact filters received.
sourcefn broadcast(
&self,
msg: NetworkMessage,
predicate: fn(Peer) -> bool
) -> Result<Vec<SocketAddr, Global>, Error>
fn broadcast(
&self,
msg: NetworkMessage,
predicate: fn(Peer) -> bool
) -> Result<Vec<SocketAddr, Global>, Error>
Broadcast a message to peers matching the predicate.
To only broadcast to outbound peers, use
Peer::is_outbound. Read moresourcefn query(&self, msg: NetworkMessage) -> Result<Option<SocketAddr>, Error>
fn query(&self, msg: NetworkMessage) -> Result<Option<SocketAddr>, Error>
Send a message to a random outbound peer. Return the chosen
peer or nothing if no peer was available. Read more
sourcefn connect(&self, addr: SocketAddr) -> Result<Link, Error>
fn connect(&self, addr: SocketAddr) -> Result<Link, Error>
Connect to the designated peer address.
sourcefn disconnect(&self, addr: SocketAddr) -> Result<(), Error>
fn disconnect(&self, addr: SocketAddr) -> Result<(), Error>
Disconnect from the designated peer address.
sourcefn import_headers(
&self,
headers: Vec<BlockHeader, Global>
) -> Result<Result<ImportResult, Error>, Error>
fn import_headers(
&self,
headers: Vec<BlockHeader, Global>
) -> Result<Result<ImportResult, Error>, Error>
Import block headers into the node.
This may cause the node to broadcast header or inventory messages to its peers. Read more
sourcefn import_addresses(&self, addrs: Vec<Address, Global>) -> Result<(), Error>
fn import_addresses(&self, addrs: Vec<Address, Global>) -> Result<(), Error>
Import peer addresses into the node’s address book.
sourcefn submit_transaction(
&self,
tx: Transaction
) -> Result<NonEmpty<SocketAddr>, Error>
fn submit_transaction(
&self,
tx: Transaction
) -> Result<NonEmpty<SocketAddr>, Error>
Submit a transaction to the network. Read more
sourcefn wait<F, T>(&self, f: F) -> Result<T, Error>where
F: FnMut(Event) -> Option<T>,
fn wait<F, T>(&self, f: F) -> Result<T, Error>where
F: FnMut(Event) -> Option<T>,
Wait for the given predicate to be fulfilled.
sourcefn wait_for_peers(
&self,
count: usize,
required_services: impl Into<ServiceFlags>
) -> Result<Vec<(SocketAddr, u64, ServiceFlags), Global>, Error>
fn wait_for_peers(
&self,
count: usize,
required_services: impl Into<ServiceFlags>
) -> Result<Vec<(SocketAddr, u64, ServiceFlags), Global>, Error>
Wait for a given number of peers to be connected with the given services.
sourcefn wait_for_height(&self, h: u64) -> Result<BlockHash, Error>
fn wait_for_height(&self, h: u64) -> Result<BlockHash, Error>
Wait for the node’s active chain to reach a certain height. The hash at that height
is returned. Read more
Auto Trait Implementations
impl<W> RefUnwindSafe for Handle<W>where
W: RefUnwindSafe,
impl<W> Send for Handle<W>
impl<W> Sync for Handle<W>
impl<W> Unpin for Handle<W>where
W: Unpin,
impl<W> UnwindSafe for Handle<W>where
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more