ouroboros-network
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.TxSubmission.Mempool.Simple

Description

The module should be imported qualified.

Synopsis

Documentation

newtype Mempool (m :: Type -> Type) txid tx Source #

A simple in-memory mempool implementation.

Constructors

Mempool (StrictTVar m (MempoolSeq txid tx)) 

data MempoolSeq txid tx Source #

Constructors

MempoolSeq 

Fields

data WithIndex tx Source #

Constructors

WithIndex 

Fields

empty :: MonadSTM m => m (Mempool m txid tx) Source #

new :: (MonadSTM m, Ord txid) => (tx -> txid) -> [tx] -> m (Mempool m txid tx) Source #

read :: MonadSTM m => Mempool m txid tx -> m [tx] Source #

getReader :: forall tx txid (m :: Type -> Type). (MonadSTM m, Ord txid) => (tx -> txid) -> (tx -> SizeInBytes) -> Mempool m txid tx -> TxSubmissionMempoolReader txid tx Integer m Source #

data TxSubmissionMempoolReader txid tx idx (m :: Type -> Type) Source #

The consensus layer functionality that the inbound and outbound side of the tx submission logic requires.

This is provided to the tx submission logic by the consensus layer.

Constructors

TxSubmissionMempoolReader 

Fields

getWriter Source #

Arguments

:: forall tx txid failure m. (MonadSTM m, MonadTime m, Ord txid) 
=> failure

duplicate tx error

-> (tx -> txid)

get transaction hash

-> (UTCTime -> [tx] -> STM m [Either (txid, failure) tx])

validate a tx in an STM transaction, this allows acquiring and updating validation context.

-> ([(txid, failure)] -> m ())

handle invalid txs, e.g. logging, throwing exceptions, etc

-> Mempool m txid tx

mempool

-> TxSubmissionMempoolWriter txid tx Integer m failure 

A simple mempool writer.

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.