Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- fetchLogicIterations :: ( HasHeader header, HasHeader block, HeaderHash header ~ HeaderHash block, MonadDelay m, MonadMonotonicTime m, MonadSTM m, Ord peer, Hashable peer) => Tracer m [ TraceLabelPeer peer ( FetchDecision [ Point header])] -> Tracer m ( TraceLabelPeer peer ( TraceFetchClientState header)) -> FetchDecisionPolicy header -> FetchTriggerVariables peer header m -> FetchNonTriggerVariables peer header block m -> m Void
-
data
FetchDecisionPolicy
header =
FetchDecisionPolicy
{
- maxInFlightReqsPerPeer :: Word
- maxConcurrencyBulkSync :: Word
- maxConcurrencyDeadline :: Word
- decisionLoopInterval :: DiffTime
- peerSalt :: Int
- plausibleCandidateChain :: HasCallStack => AnchoredFragment header -> AnchoredFragment header -> Bool
- compareCandidateChains :: HasCallStack => AnchoredFragment header -> AnchoredFragment header -> Ordering
- blockFetchSize :: header -> SizeInBytes
-
data
FetchTriggerVariables
peer header m =
FetchTriggerVariables
{
- readStateCurrentChain :: STM m ( AnchoredFragment header)
- readStateCandidateChains :: STM m ( Map peer ( AnchoredFragment header))
- readStatePeerStatus :: STM m ( Map peer ( PeerFetchStatus header))
-
data
FetchNonTriggerVariables
peer header block m =
FetchNonTriggerVariables
{
- readStateFetchedBlocks :: STM m ( Point block -> Bool )
- readStatePeerStateVars :: STM m ( Map peer ( FetchClientStateVars m header))
- readStatePeerGSVs :: STM m ( Map peer PeerGSV )
- readStateFetchMode :: STM m FetchMode
- readStateFetchedMaxSlotNo :: STM m MaxSlotNo
- type FetchDecision result = Either FetchDecline result
-
data
FetchDecline
- = FetchDeclineChainNotPlausible
- | FetchDeclineChainNoIntersection
- | FetchDeclineAlreadyFetched
- | FetchDeclineInFlightThisPeer
- | FetchDeclineInFlightOtherPeer
- | FetchDeclinePeerShutdown
- | FetchDeclinePeerSlow
- | FetchDeclineReqsInFlightLimit ! Word
- | FetchDeclineBytesInFlightLimit ! SizeInBytes ! SizeInBytes ! SizeInBytes
- | FetchDeclinePeerBusy ! SizeInBytes ! SizeInBytes ! SizeInBytes
- | FetchDeclineConcurrencyLimit ! FetchMode ! Word
- data FetchMode
- data TraceLabelPeer peerid a = TraceLabelPeer peerid a
-
data
TraceFetchClientState
header
- = AddedFetchRequest ( FetchRequest header) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header)
- | AcknowledgedFetchRequest ( FetchRequest header)
- | SendFetchRequest ( AnchoredFragment header)
- | StartedFetchBatch ( ChainRange ( Point header)) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header)
- | CompletedBlockFetch ( Point header) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header) NominalDiffTime SizeInBytes
- | CompletedFetchBatch ( ChainRange ( Point header)) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header)
- | RejectedFetchBatch ( ChainRange ( Point header)) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header)
- | ClientTerminating Int
Documentation
fetchLogicIterations :: ( HasHeader header, HasHeader block, HeaderHash header ~ HeaderHash block, MonadDelay m, MonadMonotonicTime m, MonadSTM m, Ord peer, Hashable peer) => Tracer m [ TraceLabelPeer peer ( FetchDecision [ Point header])] -> Tracer m ( TraceLabelPeer peer ( TraceFetchClientState header)) -> FetchDecisionPolicy header -> FetchTriggerVariables peer header m -> FetchNonTriggerVariables peer header block m -> m Void Source #
data FetchDecisionPolicy header Source #
FetchDecisionPolicy | |
|
data FetchTriggerVariables peer header m Source #
STM actions to read various state variables that the fetch logic depends upon. Any change in these variables is a trigger to re-evaluate the decision on what blocks to fetch.
Note that this is a "level trigger" not an "edge trigger": we do not have to re-evaluate on every change, it is sufficient to re-evaluate at some stage after one or more changes. This means it is ok to get somewhat behind, and it is not necessary to determine exactly what changed, just that there was some change.
FetchTriggerVariables | |
|
data FetchNonTriggerVariables peer header block m Source #
STM actions to read various state variables that the fetch logic uses. While the decisions do make use of the values of these variables, it is not necessary to re-evaluate when these variables change.
FetchNonTriggerVariables | |
|
type FetchDecision result = Either FetchDecline result Source #
Throughout the decision making process we accumulate reasons to decline to fetch any blocks. This type is used to wrap intermediate and final results.
data FetchDecline Source #
All the various reasons we can decide not to fetch blocks from a peer.
Instances
Eq FetchDecline Source # | |
Defined in Ouroboros.Network.BlockFetch.Decision (==) :: FetchDecline -> FetchDecline -> Bool Source # (/=) :: FetchDecline -> FetchDecline -> Bool Source # |
|
Show FetchDecline Source # | |
Defined in Ouroboros.Network.BlockFetch.Decision |
FetchModeBulkSync |
Use this mode when we are catching up on the chain but are stil well behind. In this mode the fetch logic will optimise for throughput rather than latency. |
FetchModeDeadline |
Use this mode for block-producing nodes that have a known deadline to produce a block and need to get the best chain before that. In this mode the fetch logic will optimise for picking the best chain within the given deadline. |
data TraceLabelPeer peerid a Source #
A peer label for use in
Tracer
s. This annotates tracer output as being
associated with a given peer identifier.
TraceLabelPeer peerid a |
Instances
Functor ( TraceLabelPeer peerid) | |
Defined in Network.Mux.Trace fmap :: (a -> b) -> TraceLabelPeer peerid a -> TraceLabelPeer peerid b Source # (<$) :: a -> TraceLabelPeer peerid b -> TraceLabelPeer peerid a Source # |
|
( Eq peerid, Eq a) => Eq ( TraceLabelPeer peerid a) | |
Defined in Network.Mux.Trace (==) :: TraceLabelPeer peerid a -> TraceLabelPeer peerid a -> Bool Source # (/=) :: TraceLabelPeer peerid a -> TraceLabelPeer peerid a -> Bool Source # |
|
( Show peerid, Show a) => Show ( TraceLabelPeer peerid a) | |
Defined in Network.Mux.Trace |
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.
AddedFetchRequest ( FetchRequest header) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header) |
The block fetch decision thread has added a new fetch instruction consisting of one or more individual request ranges. |
AcknowledgedFetchRequest ( FetchRequest header) |
Mark the point when the fetch client picks up the request added
by the block fetch decision thread. Note that this event can happen
fewer times than the
|
SendFetchRequest ( AnchoredFragment header) |
Mark the point when fetch request for a fragment is actually sent over the wire. |
StartedFetchBatch ( ChainRange ( Point header)) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header) |
Mark the start of receiving a streaming batch of blocks. This will
be followed by one or more
|
CompletedBlockFetch ( Point header) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header) NominalDiffTime SizeInBytes |
Mark the completion of of receiving a single block within a streaming batch of blocks. |
CompletedFetchBatch ( ChainRange ( Point header)) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header) |
Mark the successful end of receiving a streaming batch of blocks |
RejectedFetchBatch ( ChainRange ( Point header)) ( PeerFetchInFlight header) PeerFetchInFlightLimits ( PeerFetchStatus header) |
If the other peer rejects our request then we have this event
instead of
|
ClientTerminating Int |
The client is terminating. Log the number of outstanding requests. |
Instances
( StandardHash header, Show header) => Show ( TraceFetchClientState header) Source # | |
Defined in Ouroboros.Network.BlockFetch.ClientState |