#node #applications #service #operating #management #safenode #rpc

sn_service_management

A command-line application for installing, managing and operating safenode as a service

15 releases

new 0.2.7 May 15, 2024
0.2.6 May 8, 2024
0.2.5-alpha.1 Apr 25, 2024
0.2.1 Mar 28, 2024
0.1.2 Mar 21, 2024

#1581 in Network programming

Download history 128/week @ 2024-03-11 481/week @ 2024-03-18 443/week @ 2024-03-25 553/week @ 2024-04-01 461/week @ 2024-04-08 342/week @ 2024-04-15 365/week @ 2024-04-22 203/week @ 2024-04-29 515/week @ 2024-05-06

1,459 downloads per month
Used in 4 crates

GPL-3.0 license

320KB
6K SLoC

Service Management

Provides utilities for dealing with services, which are mainly used by the node manager.

RPC Actions

The RpcActions trait defines the protocol that is currently available for interacting with safenode:

node_info: Returns information about the node, such as its peer ID and version.
network_info: Retrieves network-related information, such as the peers currently connected to the node.
record_addresses: Provides a list of the node's record addresses.
restart_node: Requests the node to restart.
stop_node: Requests the node to stop its operations.
update_node: Updates the node with provided parameters.

Users of the crate can program against the trait rather than the RpcClient implementation.

This can facilitate behaviour-based unit testing, like so:

use mockall::mock;
use mockall::predicate::*;

mock! {
    pub RpcClient {}
    #[async_trait]
    impl RpcClientInterface for RpcClient {
        async fn node_info(&self) -> RpcResult<NodeInfo>;
        async fn network_info(&self) -> RpcResult<NetworkInfo>;
        async fn record_addresses(&self) -> Result<Vec<RecordAddress>>;
        async fn gossipsub_subscribe(&self, topic: &str) -> Result<()>;
        async fn gossipsub_unsubscribe(&self, topic: &str) -> Result<()>;
        async fn gossipsub_publish(&self, topic: &str, message: &str) -> Result<()>;
        async fn node_restart(&self, delay_millis: u64) -> Result<()>;
        async fn node_stop(&self, delay_millis: u64) -> Result<()>;
        async fn node_update(&self, delay_millis: u64) -> Result<()>;
    }
}

Dependencies

~35–70MB
~1.5M SLoC