2024-01-03 10:24:52 +00:00
|
|
|
use crate::types::NetworkInfo;
|
|
|
|
use jsonrpsee::core::RpcResult;
|
|
|
|
use jsonrpsee::proc_macros::rpc;
|
|
|
|
use std::collections::HashMap;
|
|
|
|
use sync::FileSyncInfo;
|
|
|
|
|
|
|
|
#[rpc(server, client, namespace = "admin")]
|
|
|
|
pub trait Rpc {
|
|
|
|
#[method(name = "shutdown")]
|
|
|
|
async fn shutdown(&self) -> RpcResult<()>;
|
|
|
|
|
|
|
|
#[method(name = "startSyncFile")]
|
|
|
|
async fn start_sync_file(&self, tx_seq: u64) -> RpcResult<()>;
|
|
|
|
|
2024-01-19 06:04:59 +00:00
|
|
|
#[method(name = "startSyncChunks")]
|
|
|
|
async fn start_sync_chunks(
|
|
|
|
&self,
|
|
|
|
tx_seq: u64,
|
|
|
|
start_index: u64,
|
|
|
|
end_index: u64, // exclusive
|
|
|
|
) -> RpcResult<()>;
|
|
|
|
|
2024-01-30 08:50:35 +00:00
|
|
|
/// Terminate file or chunks sync for specified tx_seq.
|
|
|
|
#[method(name = "terminateSync")]
|
2024-07-11 08:54:04 +00:00
|
|
|
async fn terminate_sync(&self, tx_seq: u64) -> RpcResult<bool>;
|
2024-01-30 08:50:35 +00:00
|
|
|
|
2024-01-03 10:24:52 +00:00
|
|
|
#[method(name = "getSyncStatus")]
|
|
|
|
async fn get_sync_status(&self, tx_seq: u64) -> RpcResult<String>;
|
|
|
|
|
|
|
|
#[method(name = "getSyncInfo")]
|
|
|
|
async fn get_sync_info(&self, tx_seq: Option<u64>) -> RpcResult<HashMap<u64, FileSyncInfo>>;
|
|
|
|
|
|
|
|
#[method(name = "getNetworkInfo")]
|
|
|
|
async fn get_network_info(&self) -> RpcResult<NetworkInfo>;
|
|
|
|
}
|