add better dht debugging
This commit is contained in:
		| @@ -901,6 +901,20 @@ impl VeilidAPI { | ||||
|         return Ok(out); | ||||
|     } | ||||
|  | ||||
|     async fn debug_record_purge(&self, args: Vec<String>) -> VeilidAPIResult<String> { | ||||
|         // <local|remote> | ||||
|         let storage_manager = self.storage_manager()?; | ||||
|  | ||||
|         let scope = get_debug_argument_at(&args, 1, "debug_record_purge", "scope", get_string)?; | ||||
|         let bytes = get_debug_argument_at(&args, 2, "debug_record_purge", "bytes", get_number).ok(); | ||||
|         let out = match scope.as_str() { | ||||
|             "local" => storage_manager.purge_local_records(bytes).await, | ||||
|             "remote" => storage_manager.purge_remote_records(bytes).await, | ||||
|             _ => "Invalid scope\n".to_owned(), | ||||
|         }; | ||||
|         return Ok(out); | ||||
|     } | ||||
|  | ||||
|     async fn debug_record(&self, args: String) -> VeilidAPIResult<String> { | ||||
|         let args: Vec<String> = args.split_whitespace().map(|s| s.to_owned()).collect(); | ||||
|  | ||||
| @@ -908,6 +922,8 @@ impl VeilidAPI { | ||||
|  | ||||
|         if command == "list" { | ||||
|             self.debug_record_list(args).await | ||||
|         } else if command == "purge" { | ||||
|             self.debug_record_purge(args).await | ||||
|         } else { | ||||
|             Ok(">>> Unknown command\n".to_owned()) | ||||
|         } | ||||
| @@ -936,7 +952,8 @@ impl VeilidAPI { | ||||
|               list | ||||
|               import <blob> | ||||
|               test <route> | ||||
|         record list <local|remote>  | ||||
|         record list <local|remote> | ||||
|                purge <local|remote> [bytes] | ||||
|  | ||||
|         <destination> is: | ||||
|          * direct:  <node>[+<safety>][<modifiers>] | ||||
|   | ||||
| @@ -259,11 +259,11 @@ impl JsonRequestProcessor { | ||||
|                         .add_routing_context(routing_context.clone().with_sequencing(sequencing)), | ||||
|                 } | ||||
|             } | ||||
|             RoutingContextRequestOp::AppCall { target, request } => { | ||||
|             RoutingContextRequestOp::AppCall { target, message } => { | ||||
|                 RoutingContextResponseOp::AppCall { | ||||
|                     result: to_json_api_result_with_vec_u8( | ||||
|                         self.parse_target(target) | ||||
|                             .then(|tr| async { routing_context.app_call(tr?, request).await }) | ||||
|                             .then(|tr| async { routing_context.app_call(tr?, message).await }) | ||||
|                             .await, | ||||
|                     ), | ||||
|                 } | ||||
|   | ||||
| @@ -29,7 +29,7 @@ pub enum RoutingContextRequestOp { | ||||
|         target: String, | ||||
|         #[serde(with = "json_as_base64")] | ||||
|         #[schemars(with = "String")] | ||||
|         request: Vec<u8>, | ||||
|         message: Vec<u8>, | ||||
|     }, | ||||
|     AppMessage { | ||||
|         target: String, | ||||
|   | ||||
| @@ -137,14 +137,14 @@ impl RoutingContext { | ||||
|     //////////////////////////////////////////////////////////////// | ||||
|     // App-level Messaging | ||||
|  | ||||
|     pub async fn app_call(&self, target: Target, request: Vec<u8>) -> VeilidAPIResult<Vec<u8>> { | ||||
|     pub async fn app_call(&self, target: Target, message: Vec<u8>) -> VeilidAPIResult<Vec<u8>> { | ||||
|         let rpc_processor = self.api.rpc_processor()?; | ||||
|  | ||||
|         // Get destination | ||||
|         let dest = self.get_destination(target).await?; | ||||
|  | ||||
|         // Send app message | ||||
|         let answer = match rpc_processor.rpc_call_app_call(dest, request).await { | ||||
|         let answer = match rpc_processor.rpc_call_app_call(dest, message).await { | ||||
|             Ok(NetworkResult::Value(v)) => v, | ||||
|             Ok(NetworkResult::Timeout) => apibail_timeout!(), | ||||
|             Ok(NetworkResult::ServiceUnavailable(e)) => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user