@@ -21,6 +21,7 @@ use thiserror::Error;
21
21
use tokio:: sync:: { mpsc, oneshot} ;
22
22
use uuid:: Uuid ;
23
23
24
+ /// Error type produced when a node cannot be resolved locally.
24
25
#[ derive( Debug , Error ) ]
25
26
pub enum LinkError {
26
27
#[ error( "No endpoint with address: {0}" ) ]
@@ -62,17 +63,27 @@ pub struct FindNode {
62
63
pub request : NodeConnectionRequest ,
63
64
}
64
65
66
+ /// A request to connect to open a connection to an endpoint on a node.
65
67
pub enum NodeConnectionRequest {
68
+ /// Request an uplink from a Warp lane.
66
69
Warp {
70
+ /// The ID of the source of the request.
67
71
source : Uuid ,
72
+ /// Promise to satisfy with a bidirectional channel attached to the uplink.
68
73
promise : oneshot:: Sender < Result < ( ByteWriter , ByteReader ) , AgentResolutionError > > ,
69
74
} ,
75
+ /// Open a channel to make HTTP requests to a lane.
70
76
Http {
77
+ /// Promise to be satisfied with a channel to make HTTP requests to the lane.
71
78
promise : oneshot:: Sender < Result < mpsc:: Sender < HttpLaneRequest > , AgentResolutionError > > ,
72
79
} ,
73
80
}
74
81
75
82
impl NodeConnectionRequest {
83
+ /// Fail a request for a channel.
84
+ ///
85
+ /// # Arguments
86
+ /// * `err` - The reason for the failure.
76
87
pub fn fail ( self , err : AgentResolutionError ) -> Result < ( ) , AgentResolutionError > {
77
88
match self {
78
89
NodeConnectionRequest :: Warp { promise, .. } => match promise. send ( Err ( err) ) {
0 commit comments