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

Ouroboros.Network.BlockFetch.State

Synopsis

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 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.

Constructors

FetchTriggerVariables 

Fields

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.

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 FetchMode Source #

Constructors

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.

Instances

Instances details
Eq FetchMode Source # 
Instance details

Defined in Ouroboros.Network.BlockFetch.Decision

Show FetchMode Source # 
Instance details

Defined in Ouroboros.Network.BlockFetch.Decision

data TraceLabelPeer peerid a Source #

A peer label for use in Tracers. This annotates tracer output as being associated with a given peer identifier.

Constructors

TraceLabelPeer peerid a 

Instances

Instances details
Functor (TraceLabelPeer peerid) 
Instance details

Defined in Network.Mux.Trace

Methods

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) 
Instance details

Defined in Network.Mux.Trace

Methods

(==)TraceLabelPeer peerid a → TraceLabelPeer peerid a → Bool Source #

(/=)TraceLabelPeer peerid a → TraceLabelPeer peerid a → Bool Source #

(Show peerid, Show a) ⇒ Show (TraceLabelPeer peerid a) 
Instance details

Defined in Network.Mux.Trace

Methods

showsPrecIntTraceLabelPeer peerid a → ShowS Source #

showTraceLabelPeer peerid a → String Source #

showList ∷ [TraceLabelPeer peerid a] → ShowS Source #

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.

Constructors

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 AddedFetchRequest due to fetch request merging.

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 and a final CompletedFetchBatch.

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 StartedFetchBatch and CompletedFetchBatch.

ClientTerminating Int

The client is terminating. Log the number of outstanding requests.

Instances

Instances details
(StandardHash header, Show header) ⇒ Show (TraceFetchClientState header) Source # 
Instance details

Defined in Ouroboros.Network.BlockFetch.ClientState