ouroboros-network-0.1.0.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.Examples

Synopsis

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

pureClientApplicative 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 #

data Tip b 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

Instances details
StandardHash b ⇒ Eq (Tip b) Source # 
Instance details

Defined in Ouroboros.Network.Block

Methods

(==)Tip b → Tip b → Bool Source #

(/=)Tip b → Tip b → Bool Source #

StandardHash b ⇒ Show (Tip b) Source # 
Instance details

Defined in Ouroboros.Network.Block

Methods

showsPrecIntTip b → ShowS Source #

showTip b → String Source #

showList ∷ [Tip b] → ShowS Source #

Generic (Tip b) Source # 
Instance details

Defined in Ouroboros.Network.Block

Associated Types

type Rep (Tip b) ∷ TypeType Source #

Methods

fromTip b → Rep (Tip b) x Source #

toRep (Tip b) x → Tip b Source #

StandardHash b ⇒ NoThunks (Tip b) Source # 
Instance details

Defined in Ouroboros.Network.Block

Methods

noThunks ∷ Context → Tip b → IO (Maybe ThunkInfo)

wNoThunks ∷ Context → Tip b → IO (Maybe ThunkInfo)

showTypeOfProxy (Tip b) → String

ShowProxy b ⇒ ShowProxy (Tip b ∷ Type) Source # 
Instance details

Defined in Ouroboros.Network.Block

Methods

showProxyProxy (Tip b) → String Source #

type Rep (Tip b) Source # 
Instance details

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) (U1TypeType) :+: C1 ('MetaCons "Tip" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HeaderHash b)) :*: S1 ('MetaSel ('NothingMaybe 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.