Struct stack_epic_servers::Server
source · 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>,
/* private fields */
}Expand description
Epic server holding internal structures.
Fields§
§config: ServerConfigserver config
p2p: Arc<Server>handle to our network server
chain: Arc<Chain>data store access
tx_pool: ServerTxPoolin-memory transaction pool
sync_state: Arc<SyncState>Whether we’re currently syncing
stop_state: Arc<StopState>Stop flag
Implementations§
source§impl Server
impl Server
sourcepub fn start<F>(
config: ServerConfig,
logs_rx: Option<Receiver<LogEntry>>,
info_callback: F,
stop_state: Option<Arc<StopState>>,
api_chan: &'static mut (Sender<()>, Receiver<()>)
) -> Result<(), Error>
pub fn start<F>( config: ServerConfig, logs_rx: Option<Receiver<LogEntry>>, info_callback: F, stop_state: Option<Arc<StopState>>, api_chan: &'static mut (Sender<()>, Receiver<()>) ) -> Result<(), Error>
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
sourcepub fn new(
config: ServerConfig,
stop_state: Option<Arc<StopState>>,
api_chan: &'static mut (Sender<()>, Receiver<()>)
) -> Result<Server, Error>
pub fn new( config: ServerConfig, stop_state: Option<Arc<StopState>>, api_chan: &'static mut (Sender<()>, Receiver<()>) ) -> Result<Server, Error>
Instantiates a new server associated with the provided future reactor.
sourcepub fn connect_peer(&self, addr: PeerAddr) -> Result<(), Error>
pub fn connect_peer(&self, addr: PeerAddr) -> Result<(), Error>
Asks the server to connect to a peer at the provided network address.
sourcepub fn ping_peers(&self) -> Result<(), Error>
pub fn ping_peers(&self) -> Result<(), Error>
Ping all peers, mostly useful for tests to have connected peers share their heights
sourcepub fn peer_count(&self) -> u32
pub fn peer_count(&self) -> u32
Number of peers
sourcepub fn start_stratum_server(&self, config: StratumServerConfig)
pub fn start_stratum_server(&self, config: StratumServerConfig)
Start a minimal “stratum” mining service on a separate thread
sourcepub fn start_test_miner(
&self,
wallet_listener_url: Option<String>,
stop_state: Arc<StopState>
)
pub fn start_test_miner( &self, wallet_listener_url: Option<String>, stop_state: Arc<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’
sourcepub fn header_head(&self) -> Result<Tip, Error>
pub fn header_head(&self) -> Result<Tip, Error>
The head of the block header chain
sourcepub fn protocol_version() -> ProtocolVersion
pub fn protocol_version() -> ProtocolVersion
The p2p layer protocol version for this node.
sourcepub fn get_server_stats(&self) -> Result<ServerStats, Error>
pub fn get_server_stats(&self) -> Result<ServerStats, Error>
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
sourcepub fn resume(&self)
pub fn resume(&self)
Resume p2p server. TODO - We appear not to resume the p2p server (peer connections) here?
sourcepub fn stop_test_miner(&self, stop: Arc<StopState>)
pub fn stop_test_miner(&self, stop: Arc<StopState>)
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> SafeBorrow<T> for Twhere
T: ?Sized,
impl<T> SafeBorrow<T> for Twhere
T: ?Sized,
§fn borrow_replacement(ptr: &T) -> &T
fn borrow_replacement(ptr: &T) -> &T
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