[−][src]Struct grin_api::Owner
Main interface into all node API functions. Node APIs are split into two seperate blocks of functionality called the 'Owner' and 'Foreign' APIs
Methods in this API are intended to be 'single use'.
Fields
chain: Weak<Chain>
peers: Weak<Peers>
sync_state: Weak<SyncState>
Implementations
impl Owner
[src]
pub fn new(
chain: Weak<Chain>,
peers: Weak<Peers>,
sync_state: Weak<SyncState>
) -> Self
[src]
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.
pub fn get_status(&self) -> Result<Status, Error>
[src]
Returns various information about the node, the network and the current sync status.
Returns
pub fn validate_chain(&self) -> Result<(), Error>
[src]
Trigger a validation of the chain state.
Returns
- Result Containing:
Ok(())
if the validation was done successfully- or
Error
if an error is encountered.
pub fn compact_chain(&self) -> Result<(), Error>
[src]
Trigger a compaction of the chain state to regain storage space.
Returns
- Result Containing:
Ok(())
if the compaction was done successfully- or
Error
if an error is encountered.
pub fn get_peers(
&self,
addr: Option<SocketAddr>
) -> Result<Vec<PeerData>, Error>
[src]
&self,
addr: Option<SocketAddr>
) -> Result<Vec<PeerData>, Error>
Retrieves information about stored peers.
If None
is provided, will list all stored peers.
Arguments
addr
- the ip:port of the peer to get.
Returns
pub fn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, Error>
[src]
Retrieves a list of all connected peers.
Returns
- Result Containing:
- A vector of
PeerInfoDisplay
- or
Error
if an error is encountered.
pub fn ban_peer(&self, addr: SocketAddr) -> Result<(), Error>
[src]
Bans a specific peer.
Arguments
addr
- the ip:port of the peer to ban.
Returns
- Result Containing:
Ok(())
if the path was correctly set- or
Error
if an error is encountered.
pub fn unban_peer(&self, addr: SocketAddr) -> Result<(), Error>
[src]
Trait Implementations
impl OwnerRpc for Owner
[src]
fn get_status(&self) -> Result<Status, ErrorKind>
[src]
fn validate_chain(&self) -> Result<(), ErrorKind>
[src]
fn compact_chain(&self) -> Result<(), ErrorKind>
[src]
fn get_peers(
&self,
addr: Option<SocketAddr>
) -> Result<Vec<PeerData>, ErrorKind>
[src]
&self,
addr: Option<SocketAddr>
) -> Result<Vec<PeerData>, ErrorKind>
fn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, ErrorKind>
[src]
fn ban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind>
[src]
fn unban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,