Skip to content
Snippets Groups Projects

Write `get-file` and commands to get the list of blocks from another node

2 files
+ 43
2
Compare changes
  • Side-by-side
  • Inline

Files

+ 13
0
@@ -89,6 +89,10 @@ pub(crate) enum DragoonCommand {
GetConnectedPeers {
sender: Sender<Vec<PeerId>>,
},
GetFile {
file_hash: String,
sender: Sender<String>,
},
GetListeners {
sender: Sender<Vec<Multiaddr>>,
},
@@ -128,6 +132,7 @@ impl std::fmt::Display for DragoonCommand {
DragoonCommand::EncodeFile { .. } => write!(f, "encode-file"),
DragoonCommand::GetBlockFrom { .. } => write!(f, "get-block-from"),
DragoonCommand::GetConnectedPeers { .. } => write!(f, "get-connected-peers"),
DragoonCommand::GetFile { .. } => write!(f, "get-file"),
DragoonCommand::GetListeners { .. } => write!(f, "get-listener"),
DragoonCommand::GetPeerId { .. } => write!(f, "get-peer-id"),
DragoonCommand::GetNetworkInfo { .. } => write!(f, "get-network-info"),
@@ -271,6 +276,14 @@ pub(crate) async fn create_cmd_get_connected_peers(State(state): State<Arc<AppSt
dragoon_command!(state, GetConnectedPeers)
}
pub(crate) async fn create_cmd_get_file(
Path(file_hash): Path<String>,
State(state): State<Arc<AppState>>,
) -> Response {
info!("running command get_file");
dragoon_command!(state, GetFile, file_hash)
}
pub(crate) async fn create_cmd_get_listeners(State(state): State<Arc<AppState>>) -> Response {
info!("running command `get_listeners`");
dragoon_command!(state, GetListeners)
Loading