| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Protocol.Socket.Client
Synopsis
- data ChainSyncHandle event = ChainSyncHandle {
- cshCurrentSlot :: IO Slot
- cshHandler :: event -> Slot -> IO ()
- data ChainSyncEvent
- = Resume !ChainPoint
- | RollForward !(BlockInMode CardanoMode) !ChainTip
- | RollBackward !ChainPoint !ChainTip
- type ChainSyncCallback = ChainSyncEvent -> Slot -> IO ()
- data ClientMsg
- = Disconnected Text
- | Resumed Point
- | RolledForward Tip
- | RolledBackward Point
- getCurrentSlot :: forall block. ChainSyncHandle block -> IO Slot
- runChainSync' :: FilePath -> SlotConfig -> NetworkId -> [ChainPoint] -> IO (ChainSyncHandle ChainSyncEvent)
- runChainSync :: FilePath -> Trace IO ClientMsg -> SlotConfig -> NetworkId -> [ChainPoint] -> (ChainSyncEvent -> IO ()) -> IO (ChainSyncHandle ChainSyncEvent)
- chainSyncClient :: Trace IO ClientMsg -> SlotConfig -> [ChainPoint] -> ChainSyncCallback -> ChainSyncClient (BlockInMode CardanoMode) ChainPoint ChainTip IO ()
Documentation
data ChainSyncHandle event Source #
Constructors
| ChainSyncHandle | |
Fields
| |
data ChainSyncEvent Source #
Constructors
| Resume !ChainPoint | |
| RollForward !(BlockInMode CardanoMode) !ChainTip | |
| RollBackward !ChainPoint !ChainTip |
type ChainSyncCallback = ChainSyncEvent -> Slot -> IO () Source #
The Slot parameter here represents the current slot as computed from the
current time. There is also the slot where the block was published, which is
available from the ChainSyncEvent.
Currently we are using this current slot everywhere, which is why I leave it here, as a parameter.
Constructors
| Disconnected Text | |
| Resumed Point | |
| RolledForward Tip | |
| RolledBackward Point |
Instances
getCurrentSlot :: forall block. ChainSyncHandle block -> IO Slot Source #
runChainSync' :: FilePath -> SlotConfig -> NetworkId -> [ChainPoint] -> IO (ChainSyncHandle ChainSyncEvent) Source #
Run the chain sync protocol to get access to the current slot number.
runChainSync :: FilePath -> Trace IO ClientMsg -> SlotConfig -> NetworkId -> [ChainPoint] -> (ChainSyncEvent -> IO ()) -> IO (ChainSyncHandle ChainSyncEvent) Source #
chainSyncClient :: Trace IO ClientMsg -> SlotConfig -> [ChainPoint] -> ChainSyncCallback -> ChainSyncClient (BlockInMode CardanoMode) ChainPoint ChainTip IO () Source #
The client updates the application state when the protocol state changes.