Skip to content

Commit a359923

Browse files
committed
Updated swimos_messages docs.
1 parent 60e6327 commit a359923

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

runtime/swimos_messages/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
//!
1717
//! Encodes the protocol used to communicate between external sockets and agent runtime components.
1818
19-
/// Message types and Tokio encoders and decoders.
19+
/// Message types between the runtime and agents with Tokio encoders and decoders.
2020
pub mod protocol;
21+
/// Message types between the runtime and tasks managing sockets.
2122
pub mod remote_protocol;
2223
/// Utilities to strip the header fields from Warp frames.
2324
pub mod warp;

runtime/swimos_messages/src/remote_protocol/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use thiserror::Error;
2121
use tokio::sync::{mpsc, oneshot};
2222
use uuid::Uuid;
2323

24+
/// Error type produced when a node cannot be resolved locally.
2425
#[derive(Debug, Error)]
2526
pub enum LinkError {
2627
#[error("No endpoint with address: {0}")]
@@ -62,17 +63,27 @@ pub struct FindNode {
6263
pub request: NodeConnectionRequest,
6364
}
6465

66+
/// A request to connect to open a connection to an endpoint on a node.
6567
pub enum NodeConnectionRequest {
68+
/// Request an uplink from a Warp lane.
6669
Warp {
70+
/// The ID of the source of the request.
6771
source: Uuid,
72+
/// Promise to satisfy with a bidirectional channel attached to the uplink.
6873
promise: oneshot::Sender<Result<(ByteWriter, ByteReader), AgentResolutionError>>,
6974
},
75+
/// Open a channel to make HTTP requests to a lane.
7076
Http {
77+
/// Promise to be satisfied with a channel to make HTTP requests to the lane.
7178
promise: oneshot::Sender<Result<mpsc::Sender<HttpLaneRequest>, AgentResolutionError>>,
7279
},
7380
}
7481

7582
impl NodeConnectionRequest {
83+
/// Fail a request for a channel.
84+
///
85+
/// # Arguments
86+
/// * `err` - The reason for the failure.
7687
pub fn fail(self, err: AgentResolutionError) -> Result<(), AgentResolutionError> {
7788
match self {
7889
NodeConnectionRequest::Warp { promise, .. } => match promise.send(Err(err)) {

runtime/swimos_remote/src/plain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use tokio::net::{TcpListener, TcpStream};
2929
use crate::dns::BoxDnsResolver;
3030
use crate::net::{ClientConnections, ConnResult, ListenerResult, ServerConnections};
3131

32-
/// Implementation of [`ServerConnections`] and [`ClientConnections`], using [`TcpListener`]
32+
/// Implementation of [`ServerConnections`] and [`ClientConnections`], using [`TcpListener`]
3333
/// and [`TcpStream`] from Tokio.
3434
#[derive(Debug, Clone)]
3535
pub struct TokioPlainTextNetworking {

0 commit comments

Comments
 (0)