ant_protocol/node_rpc.rs
1// Copyright 2024 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use color_eyre::eyre::Error;
10use std::time::Duration;
11
12#[derive(Debug)]
13/// To be sent to the main thread in order to stop/restart the execution of the antnode app.
14pub enum NodeCtrl {
15 /// Request to stop the execution of the antnode app, providing an error as a reason for it.
16 Stop {
17 delay: Duration,
18 result: StopResult,
19 },
20 /// Request to restart the execution of the antnode app, retrying to join the network, after the requested delay.
21 /// Set `retain_peer_id` to `true` if you want to re-use the same root dir/secret keys/PeerId.
22 Restart {
23 delay: Duration,
24 retain_peer_id: bool,
25 },
26 // Request to update the antnode app, and restart it, after the requested delay.
27 Update(Duration),
28}
29
30#[derive(Debug)]
31pub enum StopResult {
32 Success(String),
33 Error(Error),
34}