[][src]Struct grin_servers::Server

pub struct Server {
    pub config: ServerConfig,
    pub p2p: Arc<Server>,
    pub chain: Arc<Chain>,
    pub stop_state: Arc<Mutex<StopState>>,
    // some fields omitted

Grin server holding internal structures.


config: ServerConfig

server config

p2p: Arc<Server>

handle to our network server

chain: Arc<Chain>

data store access

stop_state: Arc<Mutex<StopState>>

Stop flag


impl Server[src]

pub fn start<F>(config: ServerConfig, info_callback: F) -> Result<(), Error> where
    F: FnMut(Arc<Server>), 

Instantiates and starts a new server. Optionally takes a callback for the server to send an ARC copy of itself, to allow another process to poll info about the server status

pub fn new(config: ServerConfig) -> Result<Server, Error>[src]

Instantiates a new server associated with the provided future reactor.

pub fn connect_peer(&self, addr: PeerAddr) -> Result<(), Error>[src]

Asks the server to connect to a peer at the provided network address.

pub fn ping_peers(&self) -> Result<(), Error>[src]

Ping all peers, mostly useful for tests to have connected peers share their heights

pub fn peer_count(&self) -> u32[src]

Number of peers

pub fn start_stratum_server(&self, config: StratumServerConfig)[src]

Start a minimal "stratum" mining service on a separate thread

pub fn start_test_miner(
    wallet_listener_url: Option<String>,
    stop_state: Arc<Mutex<StopState>>

Start mining for blocks internally on a separate thread. Relies on internal miner, and should only be used for automated testing. Burns reward if wallet_listener_url is 'None'

pub fn head(&self) -> Result<Tip, Error>[src]

The chain head

pub fn header_head(&self) -> Result<Tip, Error>[src]

The head of the block header chain

pub fn get_server_stats(&self) -> Result<ServerStats, Error>[src]

Returns a set of stats about this server. This and the ServerStats structure can be updated over time to include any information needed by tests or other consumers

pub fn stop(&self)[src]

Stop the server.

pub fn pause(&self)[src]

Pause the p2p server.

pub fn resume(&self)[src]

Resume p2p server. TODO - We appear not to resume the p2p server (peer connections) here?

pub fn stop_test_miner(&self, stop: Arc<Mutex<StopState>>)[src]

Stops the test miner without stopping the p2p layer

Auto Trait Implementations

impl Send for Server

impl Sync for Server

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.

impl<T> Erased for T

impl<T> UnsafeAny for T where
    T: Any

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

impl<T> Same for T

type Output = T

Should always be Self