ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ChainSync.Codec

Synopsis

Documentation

codecChainSync Source #

Arguments

:: forall header point tip (m :: Type -> Type). MonadST m 
=> (header -> Encoding)

encode header

-> (forall s. Decoder s header)

decode header

-> (point -> Encoding)

encode point

-> (forall s. Decoder s point)

decode point

-> (tip -> Encoding)

encode tip

-> (forall s. Decoder s tip)

decode tip

-> Codec (ChainSync header point tip) DeserialiseFailure m ByteString 

Codec for chain sync that encodes/decodes headers, points & tips.

NOTE: See wrapCBORinCBOR and unwrapCBORinCBOR if you want to use this with a header type that has annotations.

codecChainSyncId :: forall header point tip (m :: Type -> Type). Monad m => Codec (ChainSync header point tip) CodecFailure m (AnyMessage (ChainSync header point tip)) Source #

An identity Codec for the ChainSync protocol. It does not do any serialisation. It keeps the typed messages, wrapped in AnyMessage.

byteLimitsChainSync Source #

Arguments

:: (bytes -> Word)

compute size of bytes

-> ProtocolSizeLimits (ChainSync header point tip) bytes 

Byte Limits

timeLimitsChainSync Source #

Arguments

:: ChainSyncIdleTimeout

idle timeout, the default value defaultChainSyncIdleTimeout.

-> ProtocolTimeLimitsWithRnd (ChainSync header point tip) 

Time Limits

ChainSync Statetimeout (s)
StIdlewaitForever (i.e. never times out)
StNext StCanAwaitshortWait
StNext StMustReply randomly picked using uniform distribution from the range (minChainSyncTimeout, maxChainSyncTimeout), which corresponds to a chance of an empty streak of slots between `0.0001%` and `1%` probability.
StIntersectshortWait

maxChainSyncTimeout :: DiffTime Source #

Chain sync mustReplayTimeout upper bound.

minChainSyncTimeout :: DiffTime Source #

Chain sync mustReplayTimeout lower bound.

data ChainSyncIdleTimeout Source #

ChainSync timeout for the StIdle state, e.g. how long the client can await for MsgRollForward, MsgRollBackward, MsgIntersectFound or MsgIntersectNotFound.