Skip to content

Commit

Permalink
feat(runtime): We can now add duplication fault
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-daniel-gustafsson committed Dec 16, 2021
1 parent cf0db64 commit 54ac69b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/runtime-prototype/src/Scheduler/Fault.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ newFaultState = foldMap mkFaultState . Faults.faults
translate (Faults.ClockSkewBump n d f t) = n !-> mempty { fsClockSkew = ClockSkew [(TimeInterval f t, CSABump d)]}
translate (Faults.ClockSkewStrobe n d p f t) = n !-> mempty { fsClockSkew = ClockSkew [(TimeInterval f t, CSAStrobe d p)]}
translate Faults.RestartReactor{} = Nothing
translate (Faults.DuplicateMessage n f t d p r) = n !-> mempty { fsDuplicationPotential = DuplicationPotential [(TimeInterval f t, DuplicationInfo (RandomVariable (detRandomInterval p) r) d)]}

agendaItems :: Faults.Fault -> Agenda
agendaItems Faults.Omission{} = mempty
Expand All @@ -134,6 +135,7 @@ newFaultState = foldMap mkFaultState . Faults.faults
agendaItems (Faults.RestartReactor n t) = Agenda.push (t, ev) mempty
where
ev = SchedulerEvent {kind = "fault", event = "restart", args = Aeson.object [], from = "god", to = n, at = t, meta = Nothing}
agendaItems Faults.DuplicateMessage{} = mempty

------------------------------------------------------------------------
afterLogicalTime :: LogicalTime -> LogicalTime -> Bool
Expand Down
8 changes: 8 additions & 0 deletions src/runtime-prototype/src/Scheduler/Faults.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ data Fault
{ node :: String
, fromTime :: Time
}
| DuplicateMessage
{ node :: String
, fromTime :: Time
, toTime :: Time
, bumpDuration :: Time.NominalDiffTime
, randomPoint :: Double
, randomRange :: Double
}
deriving (Generic, Show)

customOptions :: Options
Expand Down

0 comments on commit 54ac69b

Please sign in to comment.