@@ -149,15 +149,15 @@ impl<T> From<StoreResponse<T>> for LaneResponse<T> {
149
149
/// Message type for agents to send commands to the runtime.
150
150
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
151
151
pub enum CommandMessage < S , T > {
152
- Register {
153
- address : Address < S > ,
154
- id : u16 ,
155
- } ,
152
+ /// Register an endpoint so that it can be referred to by an integer ID.
153
+ Register { address : Address < S > , id : u16 } ,
154
+ /// Send an message to explicit address.
156
155
Addressed {
157
156
target : Address < S > ,
158
157
command : T ,
159
158
overwrite_permitted : bool ,
160
159
} ,
160
+ /// Send a message to an endpoint that was registered with a register message.
161
161
Registered {
162
162
target : u16 ,
163
163
command : T ,
@@ -166,6 +166,8 @@ pub enum CommandMessage<S, T> {
166
166
}
167
167
168
168
impl < S , T > CommandMessage < S , T > {
169
+ /// Send a message to an explicit endpoint.
170
+ ///
169
171
/// # Arguments
170
172
/// * `address` - The target lane for the command.
171
173
/// * `command` - The body of the command message.
@@ -181,10 +183,24 @@ impl<S, T> CommandMessage<S, T> {
181
183
}
182
184
}
183
185
186
+ /// Register an integer ID for a lane endpoint.
187
+ ///
188
+ /// # Arguments
189
+ /// * `address` - The target lane to register.
190
+ /// * `id` - The ID to assign to the address.
184
191
pub fn register ( address : Address < S > , id : u16 ) -> Self {
185
192
CommandMessage :: Register { address, id }
186
193
}
187
194
195
+ /// Send a message to an pre-registered endpoint.
196
+ ///
197
+ /// # Arguments
198
+ /// * `target` - The registered ID.
199
+ /// * `command` - The body of the command message.
200
+ /// * `overwrite_permitted` - Controls the behaviour of command handling in the case of back-pressure.
201
+ /// If this is true, the command maybe be overwritten by a subsequent command to the same target (and so
202
+ /// will never be sent). If false, the command will be queued instead. This is a user specifiable parameter
203
+ /// in the API.
188
204
pub fn registered ( target : u16 , command : T , overwrite_permitted : bool ) -> Self {
189
205
CommandMessage :: Registered {
190
206
target,
0 commit comments