| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Chain.Direct.TimeHandle
Description
Module to deal with time in direct cardano chain layer. Defines the type
for a PointInTime and a means to acquire one via a TimeHandle and
queryTimeHandle.
Synopsis
- data TimeHandle = TimeHandle {
- currentPointInTime :: Either Text PointInTime
- slotFromUTCTime :: UTCTime -> Either Text SlotNo
- slotToUTCTime :: SlotNo -> Either Text UTCTime
- data TimeHandleParams = TimeHandleParams {
- systemStart :: SystemStart
- eraHistory :: EraHistory
- horizonSlot :: SlotNo
- currentSlot :: SlotNo
- genTimeParams :: Gen TimeHandleParams
- mkTimeHandle :: HasCallStack => SlotNo -> SystemStart -> EraHistory -> TimeHandle
- queryTimeHandle :: NetworkId -> SocketPath -> IO TimeHandle
Documentation
data TimeHandle Source #
Constructors
| TimeHandle | |
Fields
| |
Instances
| Arbitrary TimeHandle Source # | |
Defined in Hydra.Chain.Direct.TimeHandle | |
data TimeHandleParams Source #
Constructors
| TimeHandleParams | |
Fields
| |
genTimeParams :: Gen TimeHandleParams Source #
Generate consistent values for SystemStart and EraHistory which has
a horizon at the returned SlotNo as well as some UTCTime before that
mkTimeHandle :: HasCallStack => SlotNo -> SystemStart -> EraHistory -> TimeHandle Source #
Construct a time handle using current slot and given chain parameters. See
queryTimeHandle to create one by querying a cardano-node.
queryTimeHandle :: NetworkId -> SocketPath -> IO TimeHandle Source #
Query node for system start and era history before constructing a
TimeHandle using the slot at the tip of the network.