@@ -8,21 +8,21 @@ use serde::{Deserialize, Serialize};
88use std:: collections:: { HashMap , HashSet } ;
99use thiserror:: Error ;
1010
11- /// HTTP Request received from the `http_server:distro:sys` service as a
11+ /// [`crate:: Request`] received from the `http_server:distro:sys` service as a
1212/// result of either an HTTP or WebSocket binding, created via [`HttpServerAction`].
1313#[ derive( Clone , Debug , Serialize , Deserialize ) ]
1414pub enum HttpServerRequest {
1515 Http ( IncomingHttpRequest ) ,
1616 /// Processes will receive this kind of request when a client connects to them.
17- /// If a process does not want this websocket open, they should issue a *request*
17+ /// If a process does not want this websocket open, they should issue a [`crate::Request`]
1818 /// containing a [`HttpServerAction::WebSocketClose`] message and this channel ID.
1919 WebSocketOpen {
2020 path : String ,
2121 channel_id : u32 ,
2222 } ,
23- /// Processes can both SEND and RECEIVE this kind of request
23+ /// Processes can both SEND and RECEIVE this kind of [`crate::Request`]
2424 /// (send as [`HttpServerAction::WebSocketPush`]).
25- /// When received, will contain the message bytes as lazy_load_blob .
25+ /// When received, will contain the message bytes as [`crate::LazyLoadBlob`] .
2626 WebSocketPush {
2727 channel_id : u32 ,
2828 message_type : WsMessageType ,
@@ -33,7 +33,7 @@ pub enum HttpServerRequest {
3333}
3434
3535impl HttpServerRequest {
36- /// Parse a byte slice into an HttpServerRequest.
36+ /// Parse a byte slice into an [` HttpServerRequest`] .
3737 pub fn from_bytes ( bytes : & [ u8 ] ) -> serde_json:: Result < Self > {
3838 serde_json:: from_slice ( bytes)
3939 }
@@ -132,9 +132,9 @@ impl IncomingHttpRequest {
132132
133133/// The possible message types for [`HttpServerRequest::WebSocketPush`].
134134/// Ping and Pong are limited to 125 bytes by the WebSockets protocol.
135- /// Text will be sent as a Text frame, with the lazy_load_blob bytes
135+ /// Text will be sent as a Text frame, with the [`crate::LazyLoadBlob`] bytes
136136/// being the UTF-8 encoding of the string. Binary will be sent as a
137- /// Binary frame containing the unmodified lazy_load_blob bytes.
137+ /// Binary frame containing the unmodified [`crate::LazyLoadBlob`] bytes.
138138#[ derive( Clone , Copy , Debug , PartialEq , Serialize , Deserialize ) ]
139139pub enum WsMessageType {
140140 Text ,
@@ -144,26 +144,26 @@ pub enum WsMessageType {
144144 Close ,
145145}
146146
147- /// Request type sent to `http_server:distro:sys` in order to configure it.
147+ /// [`crate:: Request`] type sent to `http_server:distro:sys` in order to configure it.
148148///
149- /// If a response is expected, all actions will return a Response
149+ /// If a [`crate::Response`] is expected, all actions will return a [`crate:: Response`]
150150/// with the shape `Result<(), HttpServerActionError>` serialized to JSON.
151151#[ derive( Clone , Debug , Serialize , Deserialize ) ]
152152pub enum HttpServerAction {
153- /// Bind expects a lazy_load_blob if and only if `cache` is TRUE. The lazy_load_blob should
154- /// be the static file to serve at this path.
153+ /// Bind expects a [`crate::LazyLoadBlob`] if and only if `cache` is TRUE.
154+ /// The [`crate::LazyLoadBlob`] should be the static file to serve at this path.
155155 Bind {
156156 path : String ,
157157 /// Set whether the HTTP request needs a valid login cookie, AKA, whether
158158 /// the user needs to be logged in to access this path.
159159 authenticated : bool ,
160- /// Set whether requests can be fielded from anywhere, or only the loopback address.
160+ /// Set whether [`crate::Request`]s can be fielded from anywhere, or only the loopback address.
161161 local_only : bool ,
162- /// Set whether to bind the lazy_load_blob statically to this path. That is, take the
163- /// lazy_load_blob bytes and serve them as the response to any request to this path.
162+ /// Set whether to bind the [`crate::LazyLoadBlob`] statically to this path. That is, take the
163+ /// [`crate::LazyLoadBlob`] bytes and serve them as the response to any request to this path.
164164 cache : bool ,
165165 } ,
166- /// SecureBind expects a lazy_load_blob if and only if `cache` is TRUE. The lazy_load_blob should
166+ /// SecureBind expects a [`crate::LazyLoadBlob`] if and only if `cache` is TRUE. The [`crate::LazyLoadBlob`] should
167167 /// be the static file to serve at this path.
168168 ///
169169 /// SecureBind is the same as Bind, except that it forces requests to be made from
@@ -174,8 +174,8 @@ pub enum HttpServerAction {
174174 /// will require the user to be logged in separately to the general domain authentication.
175175 SecureBind {
176176 path : String ,
177- /// Set whether to bind the lazy_load_blob statically to this path. That is, take the
178- /// lazy_load_blob bytes and serve them as the response to any request to this path.
177+ /// Set whether to bind the [`crate::LazyLoadBlob`] statically to this path. That is, take the
178+ /// [`crate::LazyLoadBlob`] bytes and serve them as the response to any request to this path.
179179 cache : bool ,
180180 } ,
181181 /// Unbind a previously-bound HTTP path
@@ -199,26 +199,26 @@ pub enum HttpServerAction {
199199 } ,
200200 /// Unbind a previously-bound WebSocket path
201201 WebSocketUnbind { path : String } ,
202- /// When sent, expects a lazy_load_blob containing the WebSocket message bytes to send.
202+ /// When sent, expects a [`crate::LazyLoadBlob`] containing the WebSocket message bytes to send.
203203 WebSocketPush {
204204 channel_id : u32 ,
205205 message_type : WsMessageType ,
206206 } ,
207- /// When sent, expects a `lazy_load_blob` containing the WebSocket message bytes to send.
208- /// Modifies the `lazy_load_blob` by placing into ` WebSocketExtPushData` with id taken from
209- /// this `KernelMessage` and `kinode_message_type` set to `desired_reply_type`.
207+ /// When sent, expects a [`crate::LazyLoadBlob`] containing the WebSocket message bytes to send.
208+ /// Modifies the [`crate::LazyLoadBlob`] by placing into [`HttpServerAction:: WebSocketExtPushData`] ` with id taken from
209+ /// this [ `KernelMessage`] ` and `kinode_message_type` set to `desired_reply_type`.
210210 WebSocketExtPushOutgoing {
211211 channel_id : u32 ,
212212 message_type : WsMessageType ,
213213 desired_reply_type : MessageType ,
214214 } ,
215215 /// For communicating with the ext.
216- /// Kinode's http_server sends this to the ext after receiving ` WebSocketExtPushOutgoing`.
216+ /// Kinode's http_server sends this to the ext after receiving [`HttpServerAction:: WebSocketExtPushOutgoing`] .
217217 /// Upon receiving reply with this type from ext, http_server parses, setting:
218218 /// * id as given,
219- /// * message type as given (Request or Response),
220- /// * body as HttpServerRequest::WebSocketPush,
221- /// * blob as given.
219+ /// * message type as given ([`crate:: Request`] or [`crate:: Response`] ),
220+ /// * body as [` HttpServerRequest::WebSocketPush`] ,
221+ /// * [`crate::LazyLoadBlob`] as given.
222222 WebSocketExtPushData {
223223 id : u64 ,
224224 kinode_message_type : MessageType ,
@@ -230,11 +230,12 @@ pub enum HttpServerAction {
230230
231231/// HTTP Response type that can be shared over Wasm boundary to apps.
232232/// Respond to [`IncomingHttpRequest`] with this type.
233+ ///
234+ /// BODY is stored in the [`crate::LazyLoadBlob`] as bytes
233235#[ derive( Clone , Debug , Serialize , Deserialize ) ]
234236pub struct HttpResponse {
235237 pub status : u16 ,
236238 pub headers : HashMap < String , String > ,
237- // BODY is stored in the lazy_load_blob, as bytes
238239}
239240
240241impl HttpResponse {
@@ -268,7 +269,7 @@ impl HttpResponse {
268269 }
269270}
270271
271- /// Part of the Response type issued by http_server
272+ /// Part of the [`crate:: Response`] type issued by http_server
272273#[ derive( Clone , Debug , Error , Serialize , Deserialize ) ]
273274pub enum HttpServerError {
274275 #[ error( "request could not be parsed to HttpServerAction: {req}." ) ]
@@ -287,7 +288,7 @@ pub enum HttpServerError {
287288 UnexpectedResponse ,
288289}
289290
290- /// Whether the WebSocketPush is a request or a response .
291+ /// Whether the [`HttpServerAction:: WebSocketPush`] is [`crate::Request`] or [`crate::Response`] .
291292#[ derive( Clone , Copy , Debug , Serialize , Deserialize ) ]
292293pub enum MessageType {
293294 Request ,
0 commit comments