ouroboros-consensus-0.21.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Util.LogicalClock

Description

Logical time (in terms of abstract " ticks ")

Intended for qualified import

import Test.Util.LogicalClock (LogicalClock)
import qualified Test.Util.LogicalClock as LogicalClock
Synopsis

API

data LogicalClock m Source #

Logical clock (in terms of ticks rather than actual UTCTime)

Constructors

LogicalClock 

Fields

newtype NumTicks Source #

Number of ticks the test will run for

Constructors

NumTicks Word64 

newtype Tick Source #

Logical time unit

Constructors

Tick 

Fields

Instances

Instances details
Enum Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

succTickTick #

predTickTick #

toEnumIntTick #

fromEnumTickInt #

enumFromTick → [Tick] #

enumFromThenTickTick → [Tick] #

enumFromToTickTick → [Tick] #

enumFromThenToTickTickTick → [Tick] #

Num Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

(+)TickTickTick #

(-)TickTickTick #

(*)TickTickTick #

negateTickTick #

absTickTick #

signumTickTick #

fromIntegerIntegerTick #

Show Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

showsPrecIntTickShowS #

showTickString #

showList ∷ [Tick] → ShowS #

Eq Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

(==)TickTickBool #

(/=)TickTickBool #

Ord Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

compareTickTickOrdering #

(<)TickTickBool #

(<=)TickTickBool #

(>)TickTickBool #

(>=)TickTickBool #

maxTickTickTick #

minTickTickTick #

Random Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

randomRRandomGen g ⇒ (Tick, Tick) → g → (Tick, g) Source #

randomRandomGen g ⇒ g → (Tick, g) Source #

randomRsRandomGen g ⇒ (Tick, Tick) → g → [Tick] Source #

randomsRandomGen g ⇒ g → [Tick] Source #

Construction

sufficientTimeForHasCallStack ⇒ [Tick] → NumTicks Source #

Set NumTicks such that we will have seen all of the specified Ticks

Scheduling actions

blockUntilTickMonadSTM m ⇒ LogicalClock m → Tick → m Bool Source #

Block until the specified tick

Returns False if the current tick is later than the requested one, or True if they were equal.

onTick ∷ (IOLike m, HasCallStack) ⇒ ResourceRegistry m → LogicalClock m → StringTick → m () → m () Source #

Execute action once at the specified tick

tickWatcherLogicalClock m → (Tick → m ()) → Watcher m Tick Tick Source #

Execute action on every clock tick

Utilities

tickTracerMonadSTM m ⇒ LogicalClock m → Tracer m (Tick, ev) → Tracer m ev Source #