Files
@ daf15df0f8ca
Branch filter:
Location: CSY/reowolf/src/runtime2/port.rs - annotation
daf15df0f8ca
1.5 KiB
application/rls-services+xml
scaffolding in place for scheduler/runtime
daf15df0f8ca daf15df0f8ca cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc daf15df0f8ca daf15df0f8ca cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc cf26538b25dc | use super::global_store::ConnectorId;
#[derive(Clone, Copy, PartialEq, Eq)]
pub(crate) struct PortIdLocal {
pub index: u32,
}
impl PortIdLocal {
pub fn new(id: u32) -> Self {
Self{ index: id }
}
// TODO: Unsure about this, maybe remove, then also remove all struct
// instances where I call this
pub fn new_invalid() -> Self {
Self{ index: u32::MAX }
}
pub fn is_valid(&self) -> bool {
return self.index != u32::MAX;
}
}
pub enum PortKind {
Putter,
Getter,
}
pub enum PortOwnership {
Unowned, // i.e. held by a native application
Owned,
InTransit,
}
/// Represents a port inside of the runtime. May be without owner if it is
/// created by the application interfacing with the runtime, instead of being
/// created by a connector.
pub struct Port {
// Once created, these values are immutable
pub self_id: PortIdLocal,
pub peer_id: PortIdLocal,
pub kind: PortKind,
// But this can be changed, but only by the connector that owns it
pub ownership: PortOwnership,
pub owning_connector: ConnectorId,
pub peer_connector: ConnectorId, // might be temporarily inconsistent while peer port is sent around in non-sync phase.
}
// TODO: Turn port ID into its own type
pub struct Channel {
pub putter_id: u32, // can put on it, so from the connector's point of view, this is an output
pub getter_id: u32, // vice versa: can get on it, so an input for the connector
}
|