[][src]Struct grin_servers::Server

pub struct Server {
    pub config: ServerConfig,
    pub p2p: Arc<Server>,
    pub chain: Arc<Chain>,
    pub tx_pool: ServerTxPool,
    pub sync_state: Arc<SyncState>,
    pub stop_state: Arc<StopState>,
    // some fields omitted
}

Grin server holding internal structures.

Fields

config: ServerConfig

server config

p2p: Arc<Server>

handle to our network server

chain: Arc<Chain>

data store access

tx_pool: ServerTxPool

in-memory transaction pool

sync_state: Arc<SyncState>

Whether we're currently syncing

stop_state: Arc<StopState>

Stop flag

Implementations

impl Server[src]

pub fn start<F>(
    config: ServerConfig,
    logs_rx: Option<Receiver<LogEntry>>,
    info_callback: F
) -> Result<(), Error> where
    F: FnMut(Server, Option<Receiver<LogEntry>>), 
[src]

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(
    &self,
    wallet_listener_url: Option<String>,
    stop_state: Arc<StopState>
)
[src]

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 protocol_version() -> ProtocolVersion[src]

The p2p layer protocol version for this node.

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<StopState>)[src]

Stops the test miner without stopping the p2p layer

Auto Trait Implementations

impl !RefUnwindSafe for Server

impl Send for Server

impl Sync for Server

impl Unpin for Server

impl !UnwindSafe for Server

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, 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>,