Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- chainSyncClientExample :: forall header block tip (m :: Type -> Type) a. (HasHeader header, HasHeader block, HeaderHash header ~ HeaderHash block, MonadSTM m) => StrictTVar m (Chain header) -> Client header (Point block) tip m a -> ChainSyncClient header (Point block) tip m a
- data Client header point tip (m :: Type -> Type) t = Client {
- rollbackward :: point -> tip -> m (Either t (Client header point tip m t))
- rollforward :: header -> m (Either t (Client header point tip m t))
- points :: [point] -> m (Either t (Client header point tip m t))
- pureClient :: forall (m :: Type -> Type) header point tip void. Applicative m => Client header point tip m void
- controlledClient :: forall (m :: Type -> Type) header point tip. MonadSTM m => ControlMessageSTM m -> Client header point tip m ()
- data Tip (b :: k)
- = TipGenesis
- | Tip !SlotNo !(HeaderHash b) !BlockNo
- chainSyncServerExample :: forall blk header (m :: Type -> Type) a. (HasHeader blk, MonadSTM m, HeaderHash header ~ HeaderHash blk) => a -> StrictTVar m (ChainProducerState blk) -> (blk -> header) -> ChainSyncServer header (Point blk) (Tip blk) m a
Documentation
chainSyncClientExample :: forall header block tip (m :: Type -> Type) a. (HasHeader header, HasHeader block, HeaderHash header ~ HeaderHash block, MonadSTM m) => StrictTVar m (Chain header) -> Client header (Point block) tip m a -> ChainSyncClient header (Point block) tip m a Source #
An instance of the client side of the chain sync protocol that
consumes into a Chain
stored in a StrictTVar
.
This is of course only useful in tests and reference implementations since this is not a realistic chain representation.
data Client header point tip (m :: Type -> Type) t Source #
Client | |
|
pureClient :: forall (m :: Type -> Type) header point tip void. Applicative m => Client header point tip m void Source #
A client which doesn't do anything and never ends. Used with
chainSyncClientExample
, the StrictTVar m (Chain header) will be updated but
nothing further will happen.
controlledClient :: forall (m :: Type -> Type) header point tip. MonadSTM m => ControlMessageSTM m -> Client header point tip m () Source #
Used in chain-sync protocol to advertise the tip of the server's chain.
TipGenesis | The tip is genesis |
Tip !SlotNo !(HeaderHash b) !BlockNo | The tip is not genesis |
Instances
chainSyncServerExample :: forall blk header (m :: Type -> Type) a. (HasHeader blk, MonadSTM m, HeaderHash header ~ HeaderHash blk) => a -> StrictTVar m (ChainProducerState blk) -> (blk -> header) -> ChainSyncServer header (Point blk) (Tip blk) m a Source #
An instance of the server side of the chain sync protocol that reads from
a pure ChainProducerState
stored in a StrictTVar
.
This is of course only useful in tests and reference implementations since this is not a realistic chain representation.