[][src]Struct grin_api::Owner

pub struct Owner {
    pub chain: Weak<Chain>,
    pub peers: Weak<Peers>,
    pub sync_state: Weak<SyncState>,
}

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]

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 the sync_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

  • Result Containing:
  • A Status
  • or Error if an error is encountered.

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]

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

  • Result Containing:
  • A vector of PeerData
  • or Error if an error is encountered.

pub fn get_connected_peers(&self) -> Result<Vec<PeerInfoDisplay>, Error>[src]

Retrieves a list of all connected peers.

Returns

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]

Unbans a specific peer.

Arguments

  • addr - the ip:port of the peer to unban.

Returns

  • Result Containing:
  • Ok(()) if the unban was done successfully
  • or Error if an error is encountered.

Trait Implementations

impl OwnerRpc for Owner[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,