ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.BlockFetch.Client

Synopsis

Documentation

newtype BlockFetchClient block point (m :: Type -> Type) a Source #

Block fetch client type for requesting ranges of blocks and handling responses.

Constructors

BlockFetchClient 

Fields

data BlockFetchRequest block point (m :: Type -> Type) a where Source #

Constructors

SendMsgRequestRange :: forall point block (m :: Type -> Type) a. ChainRange point -> BlockFetchResponse block m a -> BlockFetchClient block point m a -> BlockFetchRequest block point m a

Request a chain range, supply handler for incoming blocks and a continuation.

SendMsgClientDone :: forall a block point (m :: Type -> Type). a -> BlockFetchRequest block point m a

Client terminating the block-fetch protocol.

data BlockFetchResponse block (m :: Type -> Type) (a :: k) Source #

Constructors

BlockFetchResponse 

Fields

data BlockFetchReceiver block (m :: Type -> Type) Source #

Blocks are streamed and block receiver will handle each one when it comes, it also needs to handle errors sent back from the server.

Constructors

BlockFetchReceiver 

Fields

blockFetchClientPeer :: forall block point (m :: Type -> Type) a. Monad m => BlockFetchClient block point m a -> Client (BlockFetch block point) 'NonPipelined ('BFIdle :: BlockFetch block point) m a Source #

data BlockFetchClientPipelined block point (m :: Type -> Type) a where Source #

A BlockFetch client designed for running the protcol in a pipelined way.

Constructors

BlockFetchClientPipelined :: forall c block point (m :: Type -> Type) a. BlockFetchSender 'Z c block point m a -> BlockFetchClientPipelined block point m a

A BlockFetchSender, but starting with zero outstanding pipelined responses, and for any internal collect type c.

data BlockFetchSender (n :: N) c block point (m :: Type -> Type) a where Source #

A BlockFetchSender with n outstanding stream of block bodies.

Constructors

SendMsgRequestRangePipelined :: forall point c block (m :: Type -> Type) (n :: N) a. ChainRange point -> c -> (Maybe block -> c -> m c) -> BlockFetchSender ('S n) c block point m a -> BlockFetchSender n c block point m a

Send a MsgRequestRange but do not wait for response. Supply a monadic action which runs on each received block and which updates the internal received value c. c could be a Monoid, though it's more general this way.

CollectBlocksPipelined :: forall (n1 :: N) c block point (m :: Type -> Type) a. Maybe (BlockFetchSender ('S n1) c block point m a) -> (c -> BlockFetchSender n1 c block point m a) -> BlockFetchSender ('S n1) c block point m a

Collect the result of a previous pipelined receive action

SendMsgDonePipelined :: forall a c block point (m :: Type -> Type). a -> BlockFetchSender 'Z c block point m a

Termination of the block-fetch protocol.

blockFetchClientPeerPipelined :: forall block point (m :: Type -> Type) a. Monad m => BlockFetchClientPipelined block point m a -> ClientPipelined (BlockFetch block point) ('BFIdle :: BlockFetch block point) m a Source #

blockFetchClientPeerSender :: forall (n :: N) block point c (m :: Type -> Type) a. Monad m => BlockFetchSender n c block point m a -> Client (BlockFetch block point) ('Pipelined n c) ('BFIdle :: BlockFetch block point) m a Source #