Struct stack_test_epic_api::Owner
source · [−]pub struct Owner {
pub chain: Weak<Chain>,
pub peers: Weak<Peers>,
pub sync_state: Weak<SyncState>,
}
Expand description
Fields
chain: Weak<Chain>
peers: Weak<Peers>
sync_state: Weak<SyncState>
Implementations
sourceimpl Owner
impl Owner
sourcepub fn new(
chain: Weak<Chain>,
peers: Weak<Peers>,
sync_state: Weak<SyncState>
) -> Self
pub fn new(
chain: Weak<Chain>,
peers: Weak<Peers>,
sync_state: Weak<SyncState>
) -> Self
Create a new API instance with the chain, transaction pool, peers and sync_state
. All subsequent
API calls will operate on this instance of node API.
Arguments
chain
- A non-owning reference of the chain.tx_pool
- A non-owning reference of the transaction pool.peers
- A non-owning reference of the peers.sync_state
- A non-owning reference of thesync_state
.
Returns
- An instance of the Node holding references to the current chain, transaction pool, peers and sync_state.
sourcepub fn get_status(&self) -> Result<Status, Error>
pub fn get_status(&self) -> Result<Status, Error>
sourcepub fn validate_chain(&self) -> Result<(), Error>
pub fn validate_chain(&self) -> Result<(), Error>
sourcepub fn compact_chain(&self) -> Result<(), Error>
pub fn compact_chain(&self) -> Result<(), Error>
sourcepub fn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, Error>
pub fn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, Error>
Retrieves a list of all connected peers.
Returns
- Result Containing:
- A vector of
PeerInfoDisplay
- or
Error
if an error is encountered.
sourcepub fn unban_peer(&self, addr: SocketAddr) -> Result<(), Error>
pub fn unban_peer(&self, addr: SocketAddr) -> Result<(), Error>
Trait Implementations
sourceimpl OwnerRpc for Owner
impl OwnerRpc for Owner
sourcefn get_status(&self) -> Result<Status, ErrorKind>
fn get_status(&self) -> Result<Status, ErrorKind>
Networked version of Owner::get_status. Read more
sourcefn validate_chain(&self) -> Result<(), ErrorKind>
fn validate_chain(&self) -> Result<(), ErrorKind>
Networked version of Owner::validate_chain. Read more
sourcefn compact_chain(&self) -> Result<(), ErrorKind>
fn compact_chain(&self) -> Result<(), ErrorKind>
Networked version of Owner::compact_chain. Read more
sourcefn get_peers(&self, addr: Option<SocketAddr>) -> Result<Vec<PeerData>, ErrorKind>
fn get_peers(&self, addr: Option<SocketAddr>) -> Result<Vec<PeerData>, ErrorKind>
Networked version of Owner::get_peers. Read more
sourcefn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, ErrorKind>
fn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, ErrorKind>
Networked version of Owner::get_connected_peers. Read more
sourcefn ban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind>
fn ban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind>
Networked version of Owner::ban_peer. Read more
sourcefn unban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind>
fn unban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind>
Networked version of Owner::unban_peer. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Owner
impl Send for Owner
impl Sync for Owner
impl Unpin for Owner
impl !UnwindSafe for Owner
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
impl<T> SafeBorrow<T> for T where
T: ?Sized,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
fn borrow_replacement(ptr: &T) -> &T
Given ptr
, which was obtained from a prior call to Self::borrow()
,
return a value with the same nominal lifetime which is guaranteed to
survive mutations to Self
. Read more