Skip to content
Snippets Groups Projects

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

3 files
+ 56
8
Compare changes
  • Side-by-side
  • Inline

Files

+ 13
0
@@ -86,6 +86,10 @@ pub(crate) enum DragoonCommand {
block_hash: String,
sender: Sender<Vec<u8>>,
},
GetBlockList {
file_hash: String,
sender: Sender<Vec<String>>,
},
GetConnectedPeers {
sender: Sender<Vec<PeerId>>,
},
@@ -131,6 +135,7 @@ impl std::fmt::Display for DragoonCommand {
DragoonCommand::DragoonSend { .. } => write!(f, "dragoon-send"),
DragoonCommand::EncodeFile { .. } => write!(f, "encode-file"),
DragoonCommand::GetBlockFrom { .. } => write!(f, "get-block-from"),
DragoonCommand::GetBlockList { .. } => write!(f, "get-block-list"),
DragoonCommand::GetConnectedPeers { .. } => write!(f, "get-connected-peers"),
DragoonCommand::GetFile { .. } => write!(f, "get-file"),
DragoonCommand::GetListeners { .. } => write!(f, "get-listener"),
@@ -271,6 +276,14 @@ pub(crate) async fn create_cmd_get_block_from(
dragoon_command!(state, GetBlockFrom, peer_id, file_hash, block_hash)
}
pub(crate) async fn create_cmd_get_block_list(
Path(file_hash): Path<String>,
State(state): State<Arc<AppState>>,
) -> Response {
info!("running command `get_block_list");
dragoon_command!(state, GetBlockList, file_hash)
}
pub(crate) async fn create_cmd_get_connected_peers(State(state): State<Arc<AppState>>) -> Response {
info!("running command `get_connected_peers`");
dragoon_command!(state, GetConnectedPeers)
Loading