ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.MiniProtocol.ChainSync.Server

Synopsis

Documentation

data Tip (b ∷ k) #

Instances

Instances details
ConvertRawHash blk ⇒ SerialiseNodeToNode blk (Tip blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

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

Defined in Ouroboros.Network.Block

Methods

showProxy ∷ Proxy (Tip b) → String #

StandardHash b ⇒ NFData (Tip b) # 
Instance details

Defined in Ouroboros.Network.Block

Methods

rnf ∷ Tip b → () #

StandardHash b ⇒ Eq (Tip b) # 
Instance details

Defined in Ouroboros.Network.Block

Methods

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

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

Generic (Tip b) # 
Instance details

Defined in Ouroboros.Network.Block

Associated Types

type Rep (Tip b) 
Instance details

Defined in Ouroboros.Network.Block

type Rep (Tip b) = D1 ('MetaData "Tip" "Ouroboros.Network.Block" "ouroboros-network-1.2.0.0-l-api-af495335aa766cc933ee95df4ec7fdea2dd796e1efa726c7d4b40b7590fdf5d9" 'False) (C1 ('MetaCons "TipGenesis" 'PrefixI 'False) (U1 ∷ Type → Type) :+: C1 ('MetaCons "Tip" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 SlotNo) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HeaderHash b)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 BlockNo))))

Methods

from ∷ Tip b → Rep (Tip b) x #

to ∷ Rep (Tip b) x → Tip b #

StandardHash b ⇒ Show (Tip b) # 
Instance details

Defined in Ouroboros.Network.Block

Methods

showsPrec ∷ Int → Tip b → ShowS #

show ∷ Tip b → String #

showList ∷ [Tip b] → ShowS #

StandardHash b ⇒ NoThunks (Tip b) # 
Instance details

Defined in Ouroboros.Network.Block

Condense (HeaderHash b) ⇒ Condense (Tip b) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Condense

Methods

condense ∷ Tip b → String Source #

type Rep (Tip b) # 
Instance details

Defined in Ouroboros.Network.Block

type Rep (Tip b) = D1 ('MetaData "Tip" "Ouroboros.Network.Block" "ouroboros-network-1.2.0.0-l-api-af495335aa766cc933ee95df4ec7fdea2dd796e1efa726c7d4b40b7590fdf5d9" 'False) (C1 ('MetaCons "TipGenesis" 'PrefixI 'False) (U1 ∷ Type → Type) :+: C1 ('MetaCons "Tip" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 SlotNo) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HeaderHash b)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 BlockNo))))

chainSyncBlockServerFollower ∷ ChainDB m blk → ResourceRegistry m → m (Follower m blk (WithPoint blk (Serialised blk))) Source #

chainSyncBlocksServer ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk)) ⇒ Tracer m (TraceChainSyncServerEvent blk) → ChainDB m blk → Follower m blk (WithPoint blk (Serialised blk)) → ChainSyncServer (Serialised blk) (Point blk) (Tip blk) m () Source #

Chain Sync Server for blocks for a given a ChainDB.

The local node-to-client protocol uses the chain sync mini-protocol with chains of full blocks (rather than a header / body split).

chainSyncHeadersServer ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk)) ⇒ Tracer m (TraceChainSyncServerEvent blk) → ChainDB m blk → Follower m blk (WithPoint blk (SerialisedHeader blk)) → ChainSyncServer (SerialisedHeader blk) (Point blk) (Tip blk) m () Source #

Chain Sync Server for block headers for a given a ChainDB.

The node-to-node protocol uses the chain sync mini-protocol with chain headers (and fetches blocks separately with the block fetch mini-protocol).

Trace events

data BlockingType Source #

Whether reading a ChainSync server update instruction was blocking or non-blocking.

Constructors

Blocking 
NonBlocking 

data TraceChainSyncServerEvent blk Source #

Events traced by the Chain Sync Server.

Constructors

TraceChainSyncServerUpdate

Send a ChainUpdate message.

Fields

  • (Tip blk)

    Tip of the currently selected chain.

  • (ChainUpdate blk (Point blk))

    The whole headers/blocks in the traced ChainUpdate are substituted with their corresponding Point.

  • BlockingType
     
  • Enclosing
     

Low-level API

chainSyncServerForFollower ∷ ∀ (m ∷ Type → Type) blk b. IOLike m ⇒ Tracer m (TraceChainSyncServerEvent blk) → STM m (Tip blk) → Follower m blk (WithPoint blk b) → ChainSyncServer b (Point blk) (Tip blk) m () Source #

A chain sync server.

This is a version of chainSyncServerExample that uses an action to get the current Tip and a Follower instead of ChainProducerState.

All the hard work is done by the Followers provided by the ChainDB.