pub struct PropagationChannel {
pub channel: Channel,
pub gateway: String,
pub state: ChannelState,
pub pickup_events: Vec<String>,
pub last_rc: Option<i32>,
pub results: Vec<PropagationResult>,
/* private fields */
}Expand description
Admin-node propagation channel.
Manages the lifecycle of communication with a gateway node:
- Init: Send configuration (serialized topology).
- Config: Wait for ACK, then send control message (command).
- Control: Wait for ACK, then enter gather state.
- Gather: Collect results (stdout, stderr, retcodes, timeouts, routing).
This is a state machine that drives the Channel transport.
Fields§
§channel: ChannelThe underlying communication channel.
gateway: StringThe gateway node this channel connects to.
state: ChannelStateCurrent FSM state.
pickup_events: Vec<String>Pickup notifications produced when a CTL actually goes on the wire
(upstream #594: ev_pickup fires only when the command really left
the local process). Drained by the caller (TreeWorker), which
forwards them as ev_pickup. write()/eof CTLs never add entries.
last_rc: Option<i32>Last return code from the gateway process.
results: Vec<PropagationResult>Collected results: (node, stream_name, data).
Implementations§
Source§impl PropagationChannel
impl PropagationChannel
Sourcepub fn start(&mut self, topology_bytes: &[u8])
pub fn start(&mut self, topology_bytes: &[u8])
Start the propagation channel — send configuration.
Serializes the topology and sends it as a ConfigurationMessage.
Sourcepub fn send_queued(&mut self, msg: Message)
pub fn send_queued(&mut self, msg: Message)
Enqueue a control message for sending.
If the channel is already set up and the queue is empty, the message is sent immediately. Otherwise it’s queued for later.
Sourcepub fn shell(&mut self, nodes: &str, command: &[u8], worker_id: u64)
pub fn shell(&mut self, nodes: &str, command: &[u8], worker_id: u64)
Create and enqueue a shell command for execution through the channel.
Mirrors upstream PropagationChannel.shell: the target nodes are
registered for pickup notification, which fires only when the CTL is
actually written on the wire (#594).
Sourcepub fn write(&mut self, nodes: &str, buf: &[u8], worker_id: u64)
pub fn write(&mut self, nodes: &str, buf: &[u8], worker_id: u64)
Create and enqueue a write operation through the channel.
Sourcepub fn set_write_eof(&mut self, nodes: &str, worker_id: u64)
pub fn set_write_eof(&mut self, nodes: &str, worker_id: u64)
Create and enqueue an EOF operation through the channel.
Sourcepub fn recv(
&mut self,
msg: Message,
) -> Result<Vec<PropagationResult>, RecvError>
pub fn recv( &mut self, msg: Message, ) -> Result<Vec<PropagationResult>, RecvError>
Process an incoming message according to the current FSM state.
Returns any propagation results generated by this message.
Sourcepub fn current_state(&self) -> ChannelState
pub fn current_state(&self) -> ChannelState
Get the current channel state.
Sourcepub fn is_gathering(&self) -> bool
pub fn is_gathering(&self) -> bool
Check if the channel is in gather state (ready for results).