Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.Protocol.ChainSync.Examples
Synopsis
- chainSyncClientExample ∷ ∀ header tip m a. (HasHeader header, MonadSTM m) ⇒ StrictTVar m (Chain header) → Client header (Point header) tip m a → ChainSyncClient header (Point header) tip m a
- data Client header point tip m 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 (Client header point tip m t)
- pureClient ∷ Applicative m ⇒ Client header point tip m void
- controlledClient ∷ MonadSTM m ⇒ ControlMessageSTM m → Client header point tip m ()
- data Tip b
- = TipGenesis
- | Tip !SlotNo !(HeaderHash b) !BlockNo
- chainSyncServerExample ∷ ∀ blk header m a. (HasHeader header, MonadSTM m, HeaderHash header ~ HeaderHash blk) ⇒ a → StrictTVar m (ChainProducerState header) → ChainSyncServer header (Point blk) (Tip blk) m a
Documentation
chainSyncClientExample ∷ ∀ header tip m a. (HasHeader header, MonadSTM m) ⇒ StrictTVar m (Chain header) → Client header (Point header) tip m a → ChainSyncClient header (Point header) 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 t Source #
Constructors
Client | |
Fields
|
pureClient ∷ 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 ∷ MonadSTM m ⇒ ControlMessageSTM m → Client header point tip m () Source #
Used in chain-sync protocol to advertise the tip of the server's chain.
Constructors
TipGenesis | The tip is genesis |
Tip !SlotNo !(HeaderHash b) !BlockNo | The tip is not genesis |
Instances
StandardHash b ⇒ Eq (Tip b) Source # | |
StandardHash b ⇒ Show (Tip b) Source # | |
Generic (Tip b) Source # | |
StandardHash b ⇒ NoThunks (Tip b) Source # | |
ShowProxy b ⇒ ShowProxy (Tip b ∷ Type) Source # | |
type Rep (Tip b) Source # | |
Defined in Ouroboros.Network.Block type Rep (Tip b) = D1 ('MetaData "Tip" "Ouroboros.Network.Block" "ouroboros-network-0.1.0.0-inplace" 'False) (C1 ('MetaCons "TipGenesis" 'PrefixI 'False) (U1 ∷ Type → Type) :+: C1 ('MetaCons "Tip" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HeaderHash b)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BlockNo)))) |
chainSyncServerExample ∷ ∀ blk header m a. (HasHeader header, MonadSTM m, HeaderHash header ~ HeaderHash blk) ⇒ a → StrictTVar m (ChainProducerState 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.