From 5babd5401b1eb55e955f6ddf8ebd4bc245ed8618 2022-03-22 07:03:00 From: MH Date: 2022-03-22 07:03:00 Subject: [PATCH] Moved around definitions, started on component trait --- diff --git a/src/runtime2/component/component.rs b/src/runtime2/component/component.rs new file mode 100644 index 0000000000000000000000000000000000000000..d68a0207767ee01904a1e6028d7742ccf9f63d8d --- /dev/null +++ b/src/runtime2/component/component.rs @@ -0,0 +1,14 @@ +use crate::runtime2::*; +use super::CompCtx; + +pub enum CompScheduling { + Immediate, + Requeue, + Sleep, + Exit, +} + +pub(crate) trait Component { + fn handle_message(sched_ctx: &mut SchedulerCtx, comp_ctx: &mut CompCtx, message: Message); + fn run(sched_ctx: &mut SchedulerCtx, comp_ctx: &mut CompCtx) -> CompScheduling; +} \ No newline at end of file diff --git a/src/runtime2/component/component_ip.rs b/src/runtime2/component/component_ip.rs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/runtime2/component/component_pdl.rs b/src/runtime2/component/component_pdl.rs index a73582435ecaeecf86030c59d95f085e71cff9b1..f312249d6981fb59443ae041b5fe53248bfffde0 100644 --- a/src/runtime2/component/component_pdl.rs +++ b/src/runtime2/component/component_pdl.rs @@ -10,17 +10,11 @@ use crate::protocol::eval::{ use crate::runtime2::scheduler::SchedulerCtx; use crate::runtime2::communication::*; +use super::component::CompScheduling; use super::component_context::*; use super::control_layer::*; use super::consensus::Consensus; -pub enum CompScheduling { - Immediate, - Requeue, - Sleep, - Exit, -} - pub enum ExecStmt { CreatedChannel((Value, Value)), PerformedPut, diff --git a/src/runtime2/component/mod.rs b/src/runtime2/component/mod.rs index 58b0ea3defc4d26d844fcc1bb86f53a6d84d98ff..72240a091c4b44ed376ff93fef76f4dc15b5e120 100644 --- a/src/runtime2/component/mod.rs +++ b/src/runtime2/component/mod.rs @@ -2,6 +2,7 @@ mod component_pdl; mod component_context; mod control_layer; mod consensus; +mod component; pub(crate) use component_pdl::{CompPDL, CompScheduling}; pub(crate) use component_context::CompCtx; diff --git a/src/runtime2/mod.rs b/src/runtime2/mod.rs index 05881c7b85be8a3fd71f8e4d892c8d6c395064db..93d9db7f74210151b07b2858bb925c97c1ede825 100644 --- a/src/runtime2/mod.rs +++ b/src/runtime2/mod.rs @@ -5,4 +5,6 @@ mod communication; mod scheduler; #[cfg(test)] mod tests; -pub use runtime::Runtime; \ No newline at end of file +pub use runtime::Runtime; +pub(crate) use scheduler::SchedulerCtx; +pub(crate) use communication::Message; \ No newline at end of file