#management #safenode #service #command-line #applications #p2p-communication #operating

sn_service_management

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

35 releases

0.4.3 Nov 12, 2024
0.4.1 Oct 29, 2024
0.3.9 Jul 29, 2024
0.2.1 Mar 28, 2024

#1512 in Network programming

Download history 221/week @ 2024-08-04 297/week @ 2024-08-11 188/week @ 2024-08-18 354/week @ 2024-08-25 169/week @ 2024-09-01 301/week @ 2024-09-08 241/week @ 2024-09-15 424/week @ 2024-09-22 509/week @ 2024-09-29 431/week @ 2024-10-06 260/week @ 2024-10-13 426/week @ 2024-10-20 447/week @ 2024-10-27 462/week @ 2024-11-03 360/week @ 2024-11-10 229/week @ 2024-11-17

1,547 downloads per month
Used in 5 crates

GPL-3.0 license

205KB
4K 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

~57–92MB
~2M SLoC