ouroboros-network
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.TxSubmission.Inbound.V2.Types

Synopsis

Shared state

data SharedTxState peeraddr txid Source #

Shared V2 state.

There is no global decision thread. Peer worker threads coordinate by atomically reading and updating this shared state.

Invariants (see sharedTxStateInvariant):

Cross-step (see sharedGenerationBumpInvariant): both counters are monotone non-decreasing, and any transition that changes some other field must advance sharedGeneration or sharedRevision; writeSharedStateIfChanged silently drops a commit that bumps neither.

Constructors

SharedTxState 

Fields

  • sharedTxTable :: !(IntMap (TxEntry peeraddr))

    Active unresolved txs that still participate in leasing, buffering, submission and advertiser tracking.

  • sharedRetainedTxs :: !RetainedTxs

    Accepted txs retained locally for a bounded time so later txid advertisements can be acked without re-requesting the body.

  • sharedTxIdToKey :: !(Map (RawTxId txid) TxKey)

    Forward txid interning table: maps a raw txid to its compact TxKey. Inverse of sharedKeyToTxId.

  • sharedKeyToTxId :: !(IntMap txid)

    Reverse interning table: maps a TxKey back to its txid. Inverse of sharedTxIdToKey.

  • sharedNextTxKey :: !Int

    Next fresh TxKey to allocate; stays strictly greater than every live key.

  • sharedGeneration :: !Word64

    Wake counter. Bumped on transitions that may grant other peers a new option (lease release, new entry accepted into the mempool, cap bump, ...). Parked peers watch this via awaitSharedChange.

  • sharedRevision :: !Word64

    Structural dirty bit. Bumped on most structural changes; used by writeSharedStateIfChanged (paired with sharedGeneration) to skip redundant TVar writes. A change to either counter triggers a write.

Instances

Instances details
(NFData peeraddr, NFData txid, HasRawTxId txid) => NFData (SharedTxState peeraddr txid) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: SharedTxState peeraddr txid -> () #

Generic (SharedTxState peeraddr txid) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep (SharedTxState peeraddr txid) 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (SharedTxState peeraddr txid) = D1 ('MetaData "SharedTxState" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "SharedTxState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "sharedTxTable") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap (TxEntry peeraddr))) :*: (S1 ('MetaSel ('Just "sharedRetainedTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RetainedTxs) :*: S1 ('MetaSel ('Just "sharedTxIdToKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (RawTxId txid) TxKey)))) :*: ((S1 ('MetaSel ('Just "sharedKeyToTxId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap txid)) :*: S1 ('MetaSel ('Just "sharedNextTxKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "sharedGeneration") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "sharedRevision") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))))

Methods

from :: SharedTxState peeraddr txid -> Rep (SharedTxState peeraddr txid) x #

to :: Rep (SharedTxState peeraddr txid) x -> SharedTxState peeraddr txid #

(Show peeraddr, Show txid, HasRawTxId txid) => Show (SharedTxState peeraddr txid) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

showsPrec :: Int -> SharedTxState peeraddr txid -> ShowS #

show :: SharedTxState peeraddr txid -> String #

showList :: [SharedTxState peeraddr txid] -> ShowS #

(Eq peeraddr, Eq txid, HasRawTxId txid) => Eq (SharedTxState peeraddr txid) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

(==) :: SharedTxState peeraddr txid -> SharedTxState peeraddr txid -> Bool #

(/=) :: SharedTxState peeraddr txid -> SharedTxState peeraddr txid -> Bool #

(NoThunks peeraddr, NoThunks txid, HasRawTxId txid) => NoThunks (SharedTxState peeraddr txid) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

noThunks :: Context -> SharedTxState peeraddr txid -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> SharedTxState peeraddr txid -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (SharedTxState peeraddr txid) -> String #

type Rep (SharedTxState peeraddr txid) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (SharedTxState peeraddr txid) = D1 ('MetaData "SharedTxState" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "SharedTxState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "sharedTxTable") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap (TxEntry peeraddr))) :*: (S1 ('MetaSel ('Just "sharedRetainedTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RetainedTxs) :*: S1 ('MetaSel ('Just "sharedTxIdToKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (RawTxId txid) TxKey)))) :*: ((S1 ('MetaSel ('Just "sharedKeyToTxId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap txid)) :*: S1 ('MetaSel ('Just "sharedNextTxKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "sharedGeneration") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "sharedRevision") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))))

RetainedTxs with helper functions

data RetainedTxs Source #

Keys of transactions tx-submission knows are in the mempool, kept for a a limited time.

A key enters whenever we learns that the tx is in the mempool:

  • a body we submitted is accepted, or
  • a peer announces a txid, or delivers a body, that the mempool already holds. Could be due to earlier fetches, or the TX may have arrived through the LocalTxSubmission protocol.

In each case the key is dropped from the active sharedTxTable and inserted here with deadline now + bufferedTxsMinLifetime (re-insert keeps the later deadline). A key leaves only when that deadline passes and the shared-state sweep removes it, independent of whether peers have acked it yet.

While retained a key counts as resolved: its txid may be acked to the announcing peers, and a re-announced txid or late-arriving body is treated as already handled rather than re-fetched. A rejected tx is not retained, it stays claimable in sharedTxTable so peers retry it.

Backed by two indexes:

  • retainedQueue is keyed on Time for cheap earliest-expiry queries.
  • retainedSet shadows the keys for O(min(n, W)) retainedMember queries (the hot path: every received txid is checked here).

Both are kept in lockstep by the 'retained*' helpers below.

Instances

Instances details
NFData RetainedTxs Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: RetainedTxs -> () #

Generic RetainedTxs Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep RetainedTxs 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep RetainedTxs = D1 ('MetaData "RetainedTxs" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "RetainedTxs" 'PrefixI 'True) (S1 ('MetaSel ('Just "retainedQueue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntPSQ Time ())) :*: S1 ('MetaSel ('Just "retainedSet") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet)))
Show RetainedTxs Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq RetainedTxs Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

NoThunks RetainedTxs Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep RetainedTxs Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep RetainedTxs = D1 ('MetaData "RetainedTxs" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "RetainedTxs" 'PrefixI 'True) (S1 ('MetaSel ('Just "retainedQueue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntPSQ Time ())) :*: S1 ('MetaSel ('Just "retainedSet") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet)))

Traces

data TraceTxLogic peeraddr txid tx Source #

TxLogic tracer.

Constructors

TraceSharedTxState (SharedTxState peeraddr txid) 

Instances

Instances details
(HasRawTxId txid, Show peeraddr, Show txid) => Show (TraceTxLogic peeraddr txid tx) Source # 
Instance details

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 #

const_MAX_TX_SIZE_DISCREPANCY :: SizeInBytes Source #

We check advertised sizes in a fuzzy way. The advertised and received sizes need to agree up to this discrepancy.

Types shared with V1

Various

data ProcessedTxCount Source #

Constructors

ProcessedTxCount 

Fields

data TxSubmissionLogicVersion Source #

Flag to enable/disable the usage of the new tx-submission logic.

Constructors

TxSubmissionLogicV1

the legacy V1

TxSubmissionLogicV2

the new V2

Mempool API

data TxSubmissionMempoolWriter txid tx idx (m :: Type -> Type) err 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

  • txId :: tx -> txid

    Compute the transaction id from a transaction.

    This is used in the protocol handler to verify a full transaction matches a previously given transaction id.

  • mempoolAddTxs :: [tx] -> m ([txid], [(txid, err)])

    Supply a batch of transactions to the mempool. They are either accepted or rejected individually, but in the order supplied.

    Return list of valid tx's added to the mempool and a list of invalid tx's with the corresponding error.

Traces

data TxSubmissionCounters Source #

Low-cost monotonic counters for the V2 peer protocol and coordination path.

These counters are updated incrementally at the points where V2 performs protocol sends, receives replies, or cheaply classifies received bodies. They are kept separate from SharedTxState so that emission can read a small dedicated counter cell without scanning protocol state.

Constructors

TxSubmissionCounters 

Fields

  • txIdMessagesSent :: !Word64

    Number of txid request messages sent (MsgRequestTxIds, blocking or pipelined).

  • txIdsRequested :: !Word64

    Total number of txids requested across all txid request messages (sum of NumTxIdsToReq values).

  • txIdRepliesReceived :: !Word64

    Number of txid reply messages received (MsgReplyTxIds).

  • txIdsReceived :: !Word64

    Total number of txid-size pairs received across all txid replies.

  • txMessagesSent :: !Word64

    Number of tx body request messages sent (MsgRequestTxs).

  • txsRequested :: !Word64

    Total number of tx bodies requested across all body request messages.

  • txRepliesReceived :: !Word64

    Number of tx body reply messages received (MsgReplyTxs).

  • txsReceived :: !Word64

    Total number of tx bodies received across all body replies.

  • txsOmitted :: !Word64

    Number of requested tx bodies the peer omitted from its reply.

  • lateBodies :: !Word64

    Number of tx bodies received after the local state had already resolved them (txid was found in the mempool before the body arrived).

  • txsAccepted :: !Word64

    Tx bodies resolved into the mempool (includes txs found already present before attempting submission).

  • txsRejected :: !Word64

    Tx bodies rejected by the mempool.

  • txIdBlockingReqsSent :: !Word64

    Txid request messages sent as blocking requests.

  • txIdPipelinedReqsSent :: !Word64

    Txid request messages sent as pipelined (non-blocking) requests.

  • txIdBlockingWaitMs :: !Word64

    Cumulative milliseconds spent waiting for replies to blocking txid requests. High values indicate the system is mostly idle (no new transactions available from peers).

  • txPipelineWaitMs :: !Word64

    Cumulative milliseconds the pipeline was active, measured from the first MsgRequestTxs send until all pipelined requests (both body and txid) have been replied to and the pipeline fully drains. Proxy for the "loading" state where the peer is actively downloading transactions.

  • txSubmissionWaitMs :: !Word64

    Cumulative milliseconds spent inside mempoolAddTxs. Covers both normal submission latency and time blocked due to a full mempool. High values relative to the other duration fields indicate mempool backpressure.

Instances

Instances details
NFData TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: TxSubmissionCounters -> () #

Monoid TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Semigroup TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Generic TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep TxSubmissionCounters 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep TxSubmissionCounters = D1 ('MetaData "TxSubmissionCounters" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "TxSubmissionCounters" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "txIdMessagesSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txIdsRequested") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txIdRepliesReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txIdsReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :*: ((S1 ('MetaSel ('Just "txMessagesSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txsRequested") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txRepliesReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txsReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) :*: (((S1 ('MetaSel ('Just "txsOmitted") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "lateBodies") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txsAccepted") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txsRejected") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :*: ((S1 ('MetaSel ('Just "txIdBlockingReqsSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txIdPipelinedReqsSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txIdBlockingWaitMs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "txPipelineWaitMs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txSubmissionWaitMs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))))))
Show TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep TxSubmissionCounters Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep TxSubmissionCounters = D1 ('MetaData "TxSubmissionCounters" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "TxSubmissionCounters" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "txIdMessagesSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txIdsRequested") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txIdRepliesReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txIdsReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :*: ((S1 ('MetaSel ('Just "txMessagesSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txsRequested") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txRepliesReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txsReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) :*: (((S1 ('MetaSel ('Just "txsOmitted") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "lateBodies") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txsAccepted") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txsRejected") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :*: ((S1 ('MetaSel ('Just "txIdBlockingReqsSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txIdPipelinedReqsSent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "txIdBlockingWaitMs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "txPipelineWaitMs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txSubmissionWaitMs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))))))

Protocol Error

data RequestedTxBatch Source #

A batch of transaction body requests sent to a peer.

Tracks the set of requested txids and the total expected size in bytes for the batch. Used to manage inflight requests and match responses to the original request.

Constructors

RequestedTxBatch 

Fields

Instances

Instances details
NFData RequestedTxBatch Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: RequestedTxBatch -> () #

Generic RequestedTxBatch Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep RequestedTxBatch 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep RequestedTxBatch = D1 ('MetaData "RequestedTxBatch" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "RequestedTxBatch" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedTxBatchSet") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "requestedTxBatchSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes)))
Show RequestedTxBatch Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq RequestedTxBatch Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

NoThunks RequestedTxBatch Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep RequestedTxBatch Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep RequestedTxBatch = D1 ('MetaData "RequestedTxBatch" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "RequestedTxBatch" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedTxBatchSet") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "requestedTxBatchSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes)))

data TxLease peeraddr Source #

The current download lease for a tx body.

A tx is either currently leased to a peer until a deadline or it is unowned and became claimable at a specific time. Peers use their decayed score as an additional per-peer delay after that claimable time before attempting to steal the lease.

Constructors

TxLeased !peeraddr !Time 
TxClaimable !Time 

Instances

Instances details
NFData peeraddr => NFData (TxLease peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: TxLease peeraddr -> () #

Generic (TxLease peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep (TxLease peeraddr) 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (TxLease peeraddr) = D1 ('MetaData "TxLease" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "TxLeased" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 peeraddr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Time)) :+: C1 ('MetaCons "TxClaimable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Time)))

Methods

from :: TxLease peeraddr -> Rep (TxLease peeraddr) x #

to :: Rep (TxLease peeraddr) x -> TxLease peeraddr #

Show peeraddr => Show (TxLease peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

showsPrec :: Int -> TxLease peeraddr -> ShowS #

show :: TxLease peeraddr -> String #

showList :: [TxLease peeraddr] -> ShowS #

Eq peeraddr => Eq (TxLease peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

(==) :: TxLease peeraddr -> TxLease peeraddr -> Bool #

(/=) :: TxLease peeraddr -> TxLease peeraddr -> Bool #

NoThunks peeraddr => NoThunks (TxLease peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

noThunks :: Context -> TxLease peeraddr -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> TxLease peeraddr -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (TxLease peeraddr) -> String #

type Rep (TxLease peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (TxLease peeraddr) = D1 ('MetaData "TxLease" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "TxLeased" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 peeraddr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Time)) :+: C1 ('MetaCons "TxClaimable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Time)))

data TxEntry peeraddr Source #

Shared per-tx state.

V2 keeps all cross-peer coordination at tx granularity. The first peer that advertises a new txid becomes its initial owner. If the lease expires without a successful outcome, the tx becomes claimable and another eligible advertiser may atomically claim it.

Per-peer attempt detail is tracked in each peer's PeerTxInFlight TVar (owned by withPeer). The shared entry only carries aggregate counts: how many peers are currently attempting this body and whether any peer is mid mempool submission.

Constructors

TxEntry 

Fields

  • txLease :: !(TxLease peeraddr)

    Current owner lease for downloading the tx body. When TxClaimable, the embedded Time also doubles as the last-activity stamp used by the orphan sweep.

    Invariant: while TxLeased to a registered peer, that peer's pifLeased contains this key (stale leases left behind by inflight-cap theft are tolerated).

  • txAttempt :: !Int

    Number of peers currently attempting the body (claimed lease and/or buffered locally). Incremented on claim, decremented on omit lease release PeerSubmitTxs transition (the submitting peer no longer counts as an attempter).

    Invariant: equals the number of registered peers whose pifAttempting contains this key.

  • txInSubmission :: !Bool

    At least one peer is currently inside mempoolAddTxs for this body. Other peers skip PeerSubmitTxs for the key while it is set. STM serialisation guarantees at most one peer is the submitter at any moment.

    Invariant: true iff some registered peer's pifSubmitting contains this key.

  • currentMaxInflightMultiplicity :: !Int

    Effective per-tx inflight multiplicity cap.

    Initialised from txInflightMultiplicity of the policy when the entry is created, and bumped by one when a peer's attempt sits past inflightTimeout without reaching submission, allowing another peer to attempt in parallel.

Instances

Instances details
NFData peeraddr => NFData (TxEntry peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: TxEntry peeraddr -> () #

Generic (TxEntry peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep (TxEntry peeraddr) 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (TxEntry peeraddr) = D1 ('MetaData "TxEntry" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "TxEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "txLease") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxLease peeraddr)) :*: S1 ('MetaSel ('Just "txAttempt") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "txInSubmission") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "currentMaxInflightMultiplicity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))))

Methods

from :: TxEntry peeraddr -> Rep (TxEntry peeraddr) x #

to :: Rep (TxEntry peeraddr) x -> TxEntry peeraddr #

Show peeraddr => Show (TxEntry peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

showsPrec :: Int -> TxEntry peeraddr -> ShowS #

show :: TxEntry peeraddr -> String #

showList :: [TxEntry peeraddr] -> ShowS #

Eq peeraddr => Eq (TxEntry peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

(==) :: TxEntry peeraddr -> TxEntry peeraddr -> Bool #

(/=) :: TxEntry peeraddr -> TxEntry peeraddr -> Bool #

NoThunks peeraddr => NoThunks (TxEntry peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

noThunks :: Context -> TxEntry peeraddr -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> TxEntry peeraddr -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (TxEntry peeraddr) -> String #

type Rep (TxEntry peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (TxEntry peeraddr) = D1 ('MetaData "TxEntry" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "TxEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "txLease") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxLease peeraddr)) :*: S1 ('MetaSel ('Just "txAttempt") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "txInSubmission") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "currentMaxInflightMultiplicity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))))

data PeerAction Source #

The next peer-local action chosen by the V2 worker thread.

V2 drives progress from the peer thread itself. Shared state only decides whether a peer is allowed to perform an action; the peer thread then carries it out directly.

Constructors

PeerDoNothing !Word64 !(Maybe DiffTime)

No immediate work is available. The peer should wait for either a shared-state generation change or the optional timeout.

PeerRequestTxIds !NumTxIdsToAck !NumTxIdsToReq

Send a txid protocol message acknowledging the first argument and requesting the second argument.

PeerRequestTxs ![TxKey]

Request tx bodies for the given internally keyed txs from this peer.

PeerSubmitTxs ![TxKey]

Submit the buffered txs identified by the given keys to the local mempool.

Instances

Instances details
NFData PeerAction Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: PeerAction -> () #

Generic PeerAction Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Show PeerAction Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq PeerAction Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerAction Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

data PeerPhase Source #

Coarse phase of a peer worker thread.

The phase is used when deciding whether a peer is currently eligible to claim an expired tx lease.

Constructors

PeerIdle

The peer worker is idle and may claim work for advertised txs.

PeerWaitingTxIds

The peer worker is waiting for a txid reply from the remote peer.

PeerWaitingTxs

The peer worker is waiting for a tx-body reply from the remote peer.

PeerSubmittingToMempool

The peer worker is submitting buffered txs to the local mempool.

Instances

Instances details
NFData PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: PeerPhase -> () #

Generic PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep PeerPhase 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerPhase = D1 ('MetaData "PeerPhase" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) ((C1 ('MetaCons "PeerIdle" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PeerWaitingTxIds" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PeerWaitingTxs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PeerSubmittingToMempool" 'PrefixI 'False) (U1 :: Type -> Type)))
Show PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Ord PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

NoThunks PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerPhase Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerPhase = D1 ('MetaData "PeerPhase" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) ((C1 ('MetaCons "PeerIdle" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PeerWaitingTxIds" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PeerWaitingTxs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PeerSubmittingToMempool" 'PrefixI 'False) (U1 :: Type -> Type)))

data PeerScore Source #

Peer usefulness score.

Lower is better. The current score is also interpreted as milliseconds of extra delay before an idle peer may steal a claimable or expired tx lease.

Constructors

PeerScore 

Instances

Instances details
NFData PeerScore Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: PeerScore -> () #

Generic PeerScore Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep PeerScore 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerScore = D1 ('MetaData "PeerScore" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "PeerScore" 'PrefixI 'True) (S1 ('MetaSel ('Just "peerScoreValue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "peerScoreTs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Time)))
Show PeerScore Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq PeerScore Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

NoThunks PeerScore Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerScore Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerScore = D1 ('MetaData "PeerScore" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "PeerScore" 'PrefixI 'True) (S1 ('MetaSel ('Just "peerScoreValue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "peerScoreTs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Time)))

data PeerTxLocalState tx Source #

Per-peer protocol state.

Owned by the worker thread for one peer. Includes the peer's coarse protocol phase (peerPhase), which is purely peer-local: only this peer's own scheduler reads and updates it, so it doesn't belong in shared state.

Invariants (see peerTxLocalStateInvariant):

Constructors

PeerTxLocalState 

Fields

Instances

Instances details
NFData tx => NFData (PeerTxLocalState tx) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: PeerTxLocalState tx -> () #

Generic (PeerTxLocalState tx) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep (PeerTxLocalState tx) 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (PeerTxLocalState tx) = D1 ('MetaData "PeerTxLocalState" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "PeerTxLocalState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "peerPhase") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PeerPhase) :*: S1 ('MetaSel ('Just "peerUnacknowledgedTxIds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq TxKey))) :*: (S1 ('MetaSel ('Just "peerAvailableTxIds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap SizeInBytes)) :*: (S1 ('MetaSel ('Just "peerRequestedTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "peerRequestedTxBatches") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq RequestedTxBatch))))) :*: ((S1 ('MetaSel ('Just "peerRequestedTxsSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes) :*: (S1 ('MetaSel ('Just "peerRequestedTxIds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NumTxIdsToReq) :*: S1 ('MetaSel ('Just "peerDownloadedTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap tx)))) :*: (S1 ('MetaSel ('Just "peerDownloadStartTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Time)) :*: (S1 ('MetaSel ('Just "peerScore") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PeerScore) :*: S1 ('MetaSel ('Just "peerLastTxIdReplyWasEmpty") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))))))
Show tx => Show (PeerTxLocalState tx) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq tx => Eq (PeerTxLocalState tx) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

NoThunks tx => NoThunks (PeerTxLocalState tx) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (PeerTxLocalState tx) Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep (PeerTxLocalState tx) = D1 ('MetaData "PeerTxLocalState" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "PeerTxLocalState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "peerPhase") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PeerPhase) :*: S1 ('MetaSel ('Just "peerUnacknowledgedTxIds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq TxKey))) :*: (S1 ('MetaSel ('Just "peerAvailableTxIds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap SizeInBytes)) :*: (S1 ('MetaSel ('Just "peerRequestedTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "peerRequestedTxBatches") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq RequestedTxBatch))))) :*: ((S1 ('MetaSel ('Just "peerRequestedTxsSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes) :*: (S1 ('MetaSel ('Just "peerRequestedTxIds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NumTxIdsToReq) :*: S1 ('MetaSel ('Just "peerDownloadedTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (IntMap tx)))) :*: (S1 ('MetaSel ('Just "peerDownloadStartTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Time)) :*: (S1 ('MetaSel ('Just "peerScore") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PeerScore) :*: S1 ('MetaSel ('Just "peerLastTxIdReplyWasEmpty") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))))))

data PeerTxInFlight Source #

Per-peer in-flight tracking, owned by withPeer.

The peer thread updates this TVar in the same STM transaction as the shared TxEntry so the two stay coherent. Two readers:

  • On exception, withPeers bracket finalizer reads it and reverses each per-peer contribution: releases any held lease, decrements txAttempt for each attempted key, clears txInSubmission for any in-flight submission.
  • The sweep walks every live peer's TVar to compute the union of advertised keys and skips those entries when looking for orphans to retire (the entry is still wanted by an active peer that may simply be slow to claim).

Invariant: pifAttempting and pifSubmitting are disjoint; a key moves from the former to the latter atomically on the submit transition. pifLeased is a subset of their union.

Constructors

PeerTxInFlight 

Fields

Instances

Instances details
NFData PeerTxInFlight Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: PeerTxInFlight -> () #

Generic PeerTxInFlight Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep PeerTxInFlight 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerTxInFlight = D1 ('MetaData "PeerTxInFlight" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "PeerTxInFlight" 'PrefixI 'True) ((S1 ('MetaSel ('Just "pifAdvertised") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "pifLeased") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet)) :*: (S1 ('MetaSel ('Just "pifAttempting") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: (S1 ('MetaSel ('Just "pifSubmitting") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "pifAcksPending") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet)))))
Show PeerTxInFlight Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Eq PeerTxInFlight Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

NoThunks PeerTxInFlight Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerTxInFlight Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep PeerTxInFlight = D1 ('MetaData "PeerTxInFlight" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'False) (C1 ('MetaCons "PeerTxInFlight" 'PrefixI 'True) ((S1 ('MetaSel ('Just "pifAdvertised") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "pifLeased") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet)) :*: (S1 ('MetaSel ('Just "pifAttempting") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: (S1 ('MetaSel ('Just "pifSubmitting") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet) :*: S1 ('MetaSel ('Just "pifAcksPending") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IntSet)))))

newtype TxKey Source #

Compact internal transaction key used by V2 state.

Constructors

TxKey 

Fields

Instances

Instances details
NFData TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

rnf :: TxKey -> () #

Enum TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Generic TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Associated Types

type Rep TxKey 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep TxKey = D1 ('MetaData "TxKey" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'True) (C1 ('MetaCons "TxKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unTxKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

Methods

from :: TxKey -> Rep TxKey x #

to :: Rep TxKey x -> TxKey #

Show TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

showsPrec :: Int -> TxKey -> ShowS #

show :: TxKey -> String #

showList :: [TxKey] -> ShowS #

Eq TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

(==) :: TxKey -> TxKey -> Bool #

(/=) :: TxKey -> TxKey -> Bool #

Ord TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

Methods

compare :: TxKey -> TxKey -> Ordering #

(<) :: TxKey -> TxKey -> Bool #

(<=) :: TxKey -> TxKey -> Bool #

(>) :: TxKey -> TxKey -> Bool #

(>=) :: TxKey -> TxKey -> Bool #

max :: TxKey -> TxKey -> TxKey #

min :: TxKey -> TxKey -> TxKey #

NoThunks TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep TxKey Source # 
Instance details

Defined in Ouroboros.Network.TxSubmission.Inbound.V2.Types

type Rep TxKey = D1 ('MetaData "TxKey" "Ouroboros.Network.TxSubmission.Inbound.V2.Types" "ouroboros-network-1.1.0.0-inplace" 'True) (C1 ('MetaCons "TxKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unTxKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

lookupTxKey :: HasRawTxId txid => txid -> SharedTxState peeraddr txid -> Maybe TxKey Source #

resolveTxKey :: HasCallStack => SharedTxState peeraddr txid -> TxKey -> txid Source #

internTxId :: HasRawTxId txid => txid -> SharedTxState peeraddr txid -> (RawTxId txid, TxKey, SharedTxState peeraddr txid) Source #

Intern a txid into the shared lookup tables. Returns the txid's raw form, its stable TxKey (existing if already interned, freshly allocated otherwise), and the resulting shared state.

internTxIds :: (Foldable f, HasRawTxId txid) => f txid -> SharedTxState peeraddr txid -> (Map (RawTxId txid) TxKey, SharedTxState peeraddr txid) Source #

diffTimeToMilliseconds :: DiffTime -> Word64 Source #

Convert a non-negative DiffTime to whole milliseconds (truncated).

Works directly on the underlying picosecond Integer to avoid the realToFrac detour through Rational and Double.