Struct epic_api::Owner[][src]

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

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

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.

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.

Trigger a validation of the chain state.

Returns

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

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.

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.

Retrieves a list of all connected peers.

Returns

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.

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

Networked version of Owner::get_status. Read more

Networked version of Owner::validate_chain. Read more

Networked version of Owner::compact_chain. Read more

Networked version of Owner::get_peers. Read more

Networked version of Owner::get_connected_peers. Read more

Networked version of Owner::ban_peer. Read more

Networked version of Owner::unban_peer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.