Skip to content

Commit

Permalink
simplify park
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed May 19, 2019
1 parent ef2f213 commit 3e0eb5e
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions timely/src/logging.rs
Expand Up @@ -198,29 +198,22 @@ pub struct InputEvent {
pub start_stop: StartStop,
}

#[derive(Serialize, Deserialize, Abomonation, Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
/// Input logic start/stop
pub struct ParkEvent {
/// True when activity begins, false when it stops
pub event: ParkUnpark
}

impl ParkEvent {
/// Creates a new park event from the supplied duration.
pub fn park(duration: Option<Duration>) -> Self { ParkEvent { event: ParkUnpark::Park(duration) } }
/// Creates a new unpark event.
pub fn unpark() -> Self { ParkEvent { event: ParkUnpark::Unpark } }
}

/// Records the starting and stopping of an operator.
#[derive(Serialize, Deserialize, Abomonation, Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
pub enum ParkUnpark {
pub enum ParkEvent {
/// Worker parks.
Park(Option<Duration>),
/// Worker unparks.
Unpark,
}

impl ParkEvent {
/// Creates a new park event from the supplied duration.
pub fn park(duration: Option<Duration>) -> Self { ParkEvent::Park(duration) }
/// Creates a new unpark event.
pub fn unpark() -> Self { ParkEvent::Unpark }
}

#[derive(Serialize, Deserialize, Debug, Clone, Abomonation, Hash, Eq, PartialEq, Ord, PartialOrd)]
/// An event in a timely worker
pub enum TimelyEvent {
Expand Down

0 comments on commit 3e0eb5e

Please sign in to comment.