ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.BlockchainTime.API

Synopsis

Documentation

data BlockchainTime m Source #

Blockchain time

When we run the blockchain, there is a single, global time. We abstract over this here to allow to query this time (in terms of the current slot), and execute an action each time we advance a slot.

Constructors

BlockchainTime 

Fields

Instances

Instances details
NoThunks (BlockchainTime m) Source # 
Instance details

Defined in Ouroboros.Consensus.BlockchainTime.API

Methods

noThunks ∷ Context → BlockchainTime m → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → BlockchainTime m → IO (Maybe ThunkInfo) #

showTypeOfProxy (BlockchainTime m) → String #

data CurrentSlot Source #

Constructors

CurrentSlot !SlotNo

The current slot is known

CurrentSlotUnknown

The current slot is not yet known

This only happens when the tip of the ledger is so far behind that we lack the information necessary to translate the current UTCTime into a SlotNo. This should only be the case during syncing.

Instances

Instances details
Show CurrentSlot Source # 
Instance details

Defined in Ouroboros.Consensus.BlockchainTime.API

Generic CurrentSlot Source # 
Instance details

Defined in Ouroboros.Consensus.BlockchainTime.API

Associated Types

type Rep CurrentSlotTypeType Source #

NoThunks CurrentSlot Source # 
Instance details

Defined in Ouroboros.Consensus.BlockchainTime.API

Methods

noThunks ∷ Context → CurrentSlotIO (Maybe ThunkInfo) #

wNoThunks ∷ Context → CurrentSlotIO (Maybe ThunkInfo) #

showTypeOfProxy CurrentSlotString #

type Rep CurrentSlot Source # 
Instance details

Defined in Ouroboros.Consensus.BlockchainTime.API

type Rep CurrentSlot = D1 ('MetaData "CurrentSlot" "Ouroboros.Consensus.BlockchainTime.API" "ouroboros-consensus-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CurrentSlot" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)) :+: C1 ('MetaCons "CurrentSlotUnknown" 'PrefixI 'False) (U1TypeType))

knownSlotWatcher Source #

Arguments

∷ ∀ m. IOLike m 
BlockchainTime m 
→ (SlotNo → m ())

Action to execute

Watcher m SlotNo SlotNo 

Watches for changes in the current slot

The action will not be called until the current slot becomes known (if the tip of our ledger is too far away from the current wallclock time, we may not know what the current SlotNo is).