Files
@ 0781cf1b7abf
Branch filter:
Location: CSY/reowolf/src/runtime2/communication.rs - annotation
0781cf1b7abf
2.0 KiB
application/rls-services+xml
WIP: Adding debug logs, add sync test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | 9e771c9cf8d3 0e1a76667937 968e958c3286 0e1a76667937 c04f7fea1a62 0e1a76667937 0e1a76667937 968e958c3286 0e1a76667937 968e958c3286 968e958c3286 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 9e771c9cf8d3 0e1a76667937 0e1a76667937 0e1a76667937 968e958c3286 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 968e958c3286 0e1a76667937 0e1a76667937 9e771c9cf8d3 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 0e1a76667937 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 0781cf1b7abf 9e771c9cf8d3 968e958c3286 968e958c3286 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 0781cf1b7abf 968e958c3286 968e958c3286 968e958c3286 968e958c3286 0781cf1b7abf 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 0781cf1b7abf 9e771c9cf8d3 c04f7fea1a62 9e771c9cf8d3 968e958c3286 968e958c3286 9e771c9cf8d3 9e771c9cf8d3 0781cf1b7abf 968e958c3286 9e771c9cf8d3 968e958c3286 968e958c3286 0de39654770f 968e958c3286 968e958c3286 9e771c9cf8d3 9e771c9cf8d3 0781cf1b7abf 9e771c9cf8d3 9e771c9cf8d3 9e771c9cf8d3 0e1a76667937 0e1a76667937 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 968e958c3286 0e1a76667937 | use crate::protocol::eval::*;
use super::runtime::*;
use super::component::*;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct PortId(pub u32);
impl PortId {
/// This value is not significant, it is chosen to make debugging easier: a
/// very large port number is more likely to shine a light on bugs.
pub fn new_invalid() -> Self {
return Self(u32::MAX);
}
}
pub struct Peer {
pub id: CompId,
pub num_associated_ports: u32,
pub(crate) handle: CompHandle,
}
#[derive(Debug, PartialEq, Eq)]
pub enum PortKind {
Putter,
Getter,
}
#[derive(Debug, PartialEq, Eq)]
pub enum PortState {
Open,
Blocked,
Closed,
}
pub struct Port {
pub self_id: PortId,
pub peer_id: PortId,
pub kind: PortKind,
pub state: PortState,
pub peer_comp_id: CompId,
}
pub struct Channel {
pub putter_id: PortId,
pub getter_id: PortId,
}
#[derive(Debug)]
pub struct DataMessage {
pub data_header: MessageDataHeader,
pub sync_header: MessageSyncHeader,
pub content: ValueGroup,
}
#[derive(Debug)]
pub struct MessageSyncHeader {
pub sync_round: u32,
}
#[derive(Debug)]
pub struct MessageDataHeader {
pub expected_mapping: Vec<(PortId, u32)>,
pub new_mapping: u32,
pub source_port: PortId,
pub target_port: PortId,
}
#[derive(Debug)]
pub struct ControlMessage {
pub(crate) id: ControlId,
pub sender_comp_id: CompId,
pub target_port_id: Option<PortId>,
pub content: ControlMessageContent,
}
#[derive(Copy, Clone, Debug)]
pub enum ControlMessageContent {
Ack,
BlockPort(PortId),
UnblockPort(PortId),
ClosePort(PortId),
PortPeerChangedBlock(PortId),
PortPeerChangedUnblock(PortId, CompId),
}
#[derive(Debug)]
pub enum Message {
Data(DataMessage),
Control(ControlMessage),
}
impl Message {
pub(crate) fn target_port(&self) -> Option<PortId> {
match self {
Message::Data(v) =>
return Some(v.data_header.target_port),
Message::Control(v) =>
return v.target_port_id,
}
}
}
|