| 99 | unimplemented!() |
| 100 | } |
| 101 | async fn dowith_request(req: RequestMessage) -> Result<()> { |
| 102 | match req.command.as_str() { |
| 103 | CMD_START => { |
| 104 | let command = FeatureCommand::registry_global() |
| 105 | .get(&req.feature) |
| 106 | .ok_or_else(|| anyhow!("feature[{}] not found", req.feature))?; |
| 107 | (command.start)(req.seq_id, serde_json::Value::Object(req.args)); |
| 108 | } |
| 109 | CMD_STOP => { |
| 110 | let command = FeatureCommand::registry_global() |
| 111 | .get(&req.feature) |
| 112 | .ok_or_else(|| anyhow!("feature[{}] not found", req.feature))?; |
| 113 | (command.stop)(req.seq_id); |
| 114 | } |
| 115 | _ => unreachable!(), |
| 116 | } |
| 117 | Ok(()) |
| 118 | } |
| 119 | |
| 120 | /// A server for debug |
| 121 | pub struct Server { |