| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Network.Protocol.ChainSync.Examples
Synopsis
- chainSyncClientExample :: forall header block tip (m :: Type -> Type) a. (HasHeader header, 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) => 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, 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 #
Constructors
| Client | |
Fields
| |
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 #
Constructors
| TipGenesis | |
| Tip !SlotNo !(HeaderHash b) !BlockNo |
Instances
chainSyncServerExample :: forall blk header (m :: Type -> Type) a. (HasHeader blk, MonadSTM m) => 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.