Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.TxSubmission.Inbound.V2.Types
Synopsis
- data PeerTxState txid tx = PeerTxState {
- unacknowledgedTxIds :: !(StrictSeq txid)
- availableTxIds :: !(Map txid SizeInBytes)
- requestedTxIdsInflight :: !NumTxIdsToReq
- requestedTxsInflightSize :: !SizeInBytes
- requestedTxsInflight :: !(Set txid)
- unknownTxs :: !(Set txid)
- score :: !Double
- scoreTs :: !Time
- downloadedTxs :: !(Map txid tx)
- toMempoolTxs :: !(Map txid tx)
- data SharedTxState peeraddr txid tx = SharedTxState {
- peerTxStates :: !(Map peeraddr (PeerTxState txid tx))
- inflightTxs :: !(Map txid Int)
- inflightTxsSize :: !SizeInBytes
- bufferedTxs :: !(Map txid (Maybe tx))
- referenceCounts :: !(Map txid Int)
- timedTxs :: !(Map Time [txid])
- inSubmissionToMempoolTxs :: !(Map txid Int)
- peerRng :: !StdGen
- newtype TxsToMempool txid tx = TxsToMempool {
- listOfTxsToMempool :: [(txid, tx)]
- data TxDecision txid tx = TxDecision {
- txdTxIdsToAcknowledge :: !NumTxIdsToAck
- txdTxIdsToRequest :: !NumTxIdsToReq
- txdPipelineTxIds :: !Bool
- txdTxsToRequest :: !(Map txid SizeInBytes)
- txdTxsToMempool :: !(TxsToMempool txid tx)
- emptyTxDecision :: TxDecision txid tx
- data TraceTxLogic peeraddr txid tx
- = TraceSharedTxState String (SharedTxState peeraddr txid tx)
- | TraceTxDecisions (Map peeraddr (TxDecision txid tx))
- data TxSubmissionInitDelay
- defaultTxSubmissionInitDelay :: TxSubmissionInitDelay
- data ProcessedTxCount = ProcessedTxCount {
- ptxcAccepted :: Int
- ptxcRejected :: Int
- ptxcScore :: Double
- data TxSubmissionLogicVersion
- data TxSubmissionMempoolWriter txid tx idx (m :: Type -> Type) = TxSubmissionMempoolWriter {
- txId :: tx -> txid
- mempoolAddTxs :: [tx] -> m [txid]
- data TraceTxSubmissionInbound txid tx
- = TraceTxSubmissionCollected [txid]
- | TraceTxSubmissionProcessed ProcessedTxCount
- | TraceTxInboundCanRequestMoreTxs Int
- | TraceTxInboundCannotRequestMoreTxs Int
- | TraceTxInboundAddedToMempool [txid] DiffTime
- | TraceTxInboundRejectedFromMempool [txid] DiffTime
- | TraceTxInboundError TxSubmissionProtocolError
- | TraceTxInboundTerminated
- | TraceTxInboundDecision (TxDecision txid tx)
- data TxSubmissionCounters = TxSubmissionCounters {}
- mkTxSubmissionCounters :: Ord txid => SharedTxState peeraddr txid tx -> TxSubmissionCounters
- data TxSubmissionProtocolError
- = ProtocolErrorTxNotRequested
- | ProtocolErrorTxIdsNotRequested
- | (Typeable txid, Show txid, Eq txid) => ProtocolErrorTxSizeError [(txid, SizeInBytes, SizeInBytes)]
PeerTxState
data PeerTxState txid tx Source #
Constructors
PeerTxState | |
Fields
|
Instances
SharedTxState
data SharedTxState peeraddr txid tx Source #
Shared state of all TxSubmission
clients.
New txid
enters unacknowledgedTxIds
it is also added to availableTxIds
and referenceCounts
(see acknowledgeTxIdsImpl
).
When a txid
id is selected to be downloaded, it's added to
requestedTxsInflightSize
(see
pickTxsToDownload
).
When the request arrives, the txid
is removed from inflightTxs
. It
might be added to unknownTxs
if the server didn't have that txid
, or
it's added to bufferedTxs
(see collectTxsImpl
).
Whenever we choose txid
to acknowledge (either in acknowledtxsIdsImpl
,
collectTxsImpl
or
pickTxsToDownload
, we also
recalculate referenceCounts
and only keep live txid
s in other maps (e.g.
availableTxIds
, bufferedTxs
, unknownTxs
).
Constructors
SharedTxState | |
Fields
|
Instances
Decisions
newtype TxsToMempool txid tx Source #
Constructors
TxsToMempool | |
Fields
|
Instances
Monoid (TxsToMempool txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods mempty :: TxsToMempool txid tx # mappend :: TxsToMempool txid tx -> TxsToMempool txid tx -> TxsToMempool txid tx # mconcat :: [TxsToMempool txid tx] -> TxsToMempool txid tx # | |
Semigroup (TxsToMempool txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (<>) :: TxsToMempool txid tx -> TxsToMempool txid tx -> TxsToMempool txid tx # sconcat :: NonEmpty (TxsToMempool txid tx) -> TxsToMempool txid tx # stimes :: Integral b => b -> TxsToMempool txid tx -> TxsToMempool txid tx # | |
(Show txid, Show tx) => Show (TxsToMempool txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TxsToMempool txid tx -> ShowS # show :: TxsToMempool txid tx -> String # showList :: [TxsToMempool txid tx] -> ShowS # | |
(Eq txid, Eq tx) => Eq (TxsToMempool txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TxsToMempool txid tx -> TxsToMempool txid tx -> Bool # (/=) :: TxsToMempool txid tx -> TxsToMempool txid tx -> Bool # |
data TxDecision txid tx Source #
Decision made by the decision logic. Each peer will receive a Decision
.
note: it is rather non-standard to represent a choice between requesting
txid
s and tx
's as a product rather than a sum type. The client will
need to download tx
s first and then send a request for more txids (and
acknowledge some txid
s). Due to pipelining each client will request
decision from the decision logic quite often (every two pipelined requests),
but with this design a decision once taken will make the peer non-active
(e.g. it won't be returned by filterActivePeers
) for longer, and thus the
expensive makeDecision
computation will not need to take that peer into
account.
Constructors
TxDecision | |
Fields
|
Instances
Ord txid => Semigroup (TxDecision txid tx) Source # | A non-commutative semigroup instance. note: this instance must be consistent with |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (<>) :: TxDecision txid tx -> TxDecision txid tx -> TxDecision txid tx # sconcat :: NonEmpty (TxDecision txid tx) -> TxDecision txid tx # stimes :: Integral b => b -> TxDecision txid tx -> TxDecision txid tx # | |
(Show txid, Show tx) => Show (TxDecision txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TxDecision txid tx -> ShowS # show :: TxDecision txid tx -> String # showList :: [TxDecision txid tx] -> ShowS # | |
(Eq txid, Eq tx) => Eq (TxDecision txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TxDecision txid tx -> TxDecision txid tx -> Bool # (/=) :: TxDecision txid tx -> TxDecision txid tx -> Bool # |
emptyTxDecision :: TxDecision txid tx Source #
A no-op decision.
data TraceTxLogic peeraddr txid tx Source #
TxLogic tracer.
Constructors
TraceSharedTxState String (SharedTxState peeraddr txid tx) | |
TraceTxDecisions (Map peeraddr (TxDecision txid tx)) |
Instances
(Show peeraddr, Show txid, Show tx) => Show (TraceTxLogic peeraddr txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TraceTxLogic peeraddr txid tx -> ShowS # show :: TraceTxLogic peeraddr txid tx -> String # showList :: [TraceTxLogic peeraddr txid tx] -> ShowS # |
data TxSubmissionInitDelay Source #
Constructors
TxSubmissionInitDelay DiffTime | |
NoTxSubmissionInitDelay |
Instances
Show TxSubmissionInitDelay Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TxSubmissionInitDelay -> ShowS # show :: TxSubmissionInitDelay -> String # showList :: [TxSubmissionInitDelay] -> ShowS # | |
Eq TxSubmissionInitDelay Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TxSubmissionInitDelay -> TxSubmissionInitDelay -> Bool # (/=) :: TxSubmissionInitDelay -> TxSubmissionInitDelay -> Bool # |
Types shared with V1
Various
data ProcessedTxCount Source #
Constructors
ProcessedTxCount | |
Fields
|
Instances
Show ProcessedTxCount Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> ProcessedTxCount -> ShowS # show :: ProcessedTxCount -> String # showList :: [ProcessedTxCount] -> ShowS # | |
Eq ProcessedTxCount Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: ProcessedTxCount -> ProcessedTxCount -> Bool # (/=) :: ProcessedTxCount -> ProcessedTxCount -> Bool # |
data TxSubmissionLogicVersion Source #
Flag to enable/disable the usage of the new tx-submission logic.
Constructors
TxSubmissionLogicV1 | the legacy |
TxSubmissionLogicV2 | the new |
Instances
Bounded TxSubmissionLogicVersion Source # | |
Enum TxSubmissionLogicVersion Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods succ :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion # pred :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion # toEnum :: Int -> TxSubmissionLogicVersion # fromEnum :: TxSubmissionLogicVersion -> Int # enumFrom :: TxSubmissionLogicVersion -> [TxSubmissionLogicVersion] # enumFromThen :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion -> [TxSubmissionLogicVersion] # enumFromTo :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion -> [TxSubmissionLogicVersion] # enumFromThenTo :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion -> TxSubmissionLogicVersion -> [TxSubmissionLogicVersion] # | |
Show TxSubmissionLogicVersion Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TxSubmissionLogicVersion -> ShowS # show :: TxSubmissionLogicVersion -> String # showList :: [TxSubmissionLogicVersion] -> ShowS # | |
Eq TxSubmissionLogicVersion Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion -> Bool # (/=) :: TxSubmissionLogicVersion -> TxSubmissionLogicVersion -> Bool # |
Mempool API
data TxSubmissionMempoolWriter txid tx idx (m :: Type -> Type) Source #
The consensus layer functionality that the inbound side of the tx submission logic requires.
This is provided to the tx submission logic by the consensus layer.
Constructors
TxSubmissionMempoolWriter | |
Fields
|
Traces
data TraceTxSubmissionInbound txid tx Source #
Constructors
TraceTxSubmissionCollected [txid] | Number of transactions just about to be inserted. |
TraceTxSubmissionProcessed ProcessedTxCount | Just processed transaction pass/fail breakdown. |
TraceTxInboundCanRequestMoreTxs Int | |
TraceTxInboundCannotRequestMoreTxs Int | |
TraceTxInboundAddedToMempool [txid] DiffTime | |
TraceTxInboundRejectedFromMempool [txid] DiffTime | |
TraceTxInboundError TxSubmissionProtocolError | |
TraceTxInboundTerminated | Server received |
TraceTxInboundDecision (TxDecision txid tx) |
Instances
(Show txid, Show tx) => Show (TraceTxSubmissionInbound txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TraceTxSubmissionInbound txid tx -> ShowS # show :: TraceTxSubmissionInbound txid tx -> String # showList :: [TraceTxSubmissionInbound txid tx] -> ShowS # | |
(Eq txid, Eq tx) => Eq (TraceTxSubmissionInbound txid tx) Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TraceTxSubmissionInbound txid tx -> TraceTxSubmissionInbound txid tx -> Bool # (/=) :: TraceTxSubmissionInbound txid tx -> TraceTxSubmissionInbound txid tx -> Bool # |
data TxSubmissionCounters Source #
Constructors
TxSubmissionCounters | |
Fields
|
Instances
Show TxSubmissionCounters Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TxSubmissionCounters -> ShowS # show :: TxSubmissionCounters -> String # showList :: [TxSubmissionCounters] -> ShowS # | |
Eq TxSubmissionCounters Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TxSubmissionCounters -> TxSubmissionCounters -> Bool # (/=) :: TxSubmissionCounters -> TxSubmissionCounters -> Bool # |
mkTxSubmissionCounters :: Ord txid => SharedTxState peeraddr txid tx -> TxSubmissionCounters Source #
Protocol Error
data TxSubmissionProtocolError Source #
Constructors
ProtocolErrorTxNotRequested | |
ProtocolErrorTxIdsNotRequested | |
(Typeable txid, Show txid, Eq txid) => ProtocolErrorTxSizeError [(txid, SizeInBytes, SizeInBytes)] | a list of txid for which the received size and advertised size didn't match. |
Instances
Exception TxSubmissionProtocolError Source # | |
Show TxSubmissionProtocolError Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods showsPrec :: Int -> TxSubmissionProtocolError -> ShowS # show :: TxSubmissionProtocolError -> String # showList :: [TxSubmissionProtocolError] -> ShowS # | |
Eq TxSubmissionProtocolError Source # | |
Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types Methods (==) :: TxSubmissionProtocolError -> TxSubmissionProtocolError -> Bool # (/=) :: TxSubmissionProtocolError -> TxSubmissionProtocolError -> Bool # |