Files
@ 9e771c9cf8d3
Branch filter:
Location: CSY/reowolf/src/runtime2/component/control_layer.rs - annotation
9e771c9cf8d3
1.3 KiB
application/rls-services+xml
WIP: Control messaging between components
9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 | use crate::runtime2::runtime::*;
use crate::runtime2::communication::*;
use crate::runtime2::component::*;
struct ControlEntry {
id: u32,
ack_countdown: u32,
content: ControlContent,
ack_action: ControlAction,
}
enum ControlContent {
PeerChange(ControlPeerChange),
}
struct ControlPeerChange {
source_port: PortId,
target_port: PortId, // if sent to this port
new_target_comp: CompId, // redirect to this component
}
/// Action to be taken when the `Ack`s for a control entry has come in.
enum ControlAction {
Nothing,
AckOwnEntry(u32), // ack an entry we own ourselves
ScheduleComponent(CompId), // schedule a particular component for execution
}
/// Handling/sending control messages.
pub(crate) struct ControlLayer {
id_counter: u32,
entries: Vec<ControlEntry>,
}
impl ControlLayer {
fn handle_created_component(&mut self, creator_ctx: &CompCtx, created_ctx: &CompCtx) {
for peer in &created_ctx.peers {
// TODO: Optimize when we ourselves are the peer.
// Create entry that will unblock the peer if it confirms that all
// of its ports have been blocked
peer.handle.inbox.push(Message::)
}
}
fn take_id(&mut self) -> u32 {
let id = self.id_counter;
self.id_counter += 1;
return id;
}
}
|