Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- blockFetchClient :: forall header block versionNumber (m :: Type -> Type). (MonadSTM m, MonadThrow m, MonadTime m, MonadMonotonicTime m, HasHeader header, HasHeader block, HeaderHash header ~ HeaderHash block) => versionNumber -> ControlMessageSTM m -> FetchedMetricsTracer m -> FetchClientContext header block m -> ClientPipelined (BlockFetch block (Point block)) ('BFIdle :: BlockFetch block (Point block)) m ()
- type BlockFetchClient header block (m :: Type -> Type) a = FetchClientContext header block m -> ClientPipelined (BlockFetch block (Point block)) ('BFIdle :: BlockFetch block (Point block)) m a
- data FetchClientContext header block (m :: Type -> Type)
- data TraceFetchClientState header
- newtype FetchRequest header = FetchRequest {
- fetchRequestFragments :: [AnchoredFragment header]
- data FetchClientStateVars (m :: Type -> Type) header
- data BlockFetchProtocolFailure
Block fetch protocol client implementation
blockFetchClient :: forall header block versionNumber (m :: Type -> Type). (MonadSTM m, MonadThrow m, MonadTime m, MonadMonotonicTime m, HasHeader header, HasHeader block, HeaderHash header ~ HeaderHash block) => versionNumber -> ControlMessageSTM m -> FetchedMetricsTracer m -> FetchClientContext header block m -> ClientPipelined (BlockFetch block (Point block)) ('BFIdle :: BlockFetch block (Point block)) m () Source #
The implementation of the client side of block fetch protocol designed to work in conjunction with our fetch logic.
type BlockFetchClient header block (m :: Type -> Type) a = FetchClientContext header block m -> ClientPipelined (BlockFetch block (Point block)) ('BFIdle :: BlockFetch block (Point block)) m a Source #
TODO: use a fetch client wrapper type rather than the raw PeerPipelined, and eliminate this alias. It is only here to avoid large types leaking into the consensus layer.
data FetchClientContext header block (m :: Type -> Type) Source #
The context that is passed into the block fetch protocol client when it is started.
data TraceFetchClientState header Source #
Tracing types for the various events that change the state
(i.e. FetchClientStateVars
) for a block fetch client.
Note that while these are all state changes, the AddedFetchRequest
occurs
in the decision thread while the other state changes occur in the block
fetch client threads.
Instances
(StandardHash header, Show header) => Show (TraceFetchClientState header) Source # | |
Defined in Ouroboros.Network.BlockFetch.ClientState showsPrec :: Int -> TraceFetchClientState header -> ShowS # show :: TraceFetchClientState header -> String # showList :: [TraceFetchClientState header] -> ShowS # |
newtype FetchRequest header Source #
FetchRequest | |
|
Instances
HasHeader header => Semigroup (FetchRequest header) Source # | We sometimes have the opportunity to merge fetch request fragments to reduce the number of separate range request messages that we send. We send one message per fragment. It is better to send fewer requests for bigger ranges, rather than lots of requests for small ranges. We never expect fetch requests to overlap (ie have blocks in common) but we do expect a common case that requests will "touch" so that two ranges could be merged into a single contiguous range. This semigroup instance implements this merging when possible, otherwise the two lists of fragments are just appended. A consequence of merging and sending fewer request messages is that tracking the number of requests in-flight a bit more subtle. To track this accurately we have to look at the old request as well a the updated request after any merging. We meed to account for the difference in the number of fragments in the existing request (if any) and in new request. |
Defined in Ouroboros.Network.BlockFetch.ClientState (<>) :: FetchRequest header -> FetchRequest header -> FetchRequest header # sconcat :: NonEmpty (FetchRequest header) -> FetchRequest header # stimes :: Integral b => b -> FetchRequest header -> FetchRequest header # | |
(StandardHash header, Show header) => Show (FetchRequest header) Source # | |
Defined in Ouroboros.Network.BlockFetch.ClientState showsPrec :: Int -> FetchRequest header -> ShowS # show :: FetchRequest header -> String # showList :: [FetchRequest header] -> ShowS # |
data FetchClientStateVars (m :: Type -> Type) header Source #
A set of variables shared between the block fetch logic thread and each
thread executing the client side of the block fetch protocol. That is, these
are the shared variables per peer. The FetchClientRegistry
contains the
mapping of these for all peers.
The variables are used for communicating from the protocol thread to the decision making thread the status of things with that peer. And in the other direction one shared variable is for providing new fetch requests.
Exception types
data BlockFetchProtocolFailure Source #