Safe Haskell | None |
---|---|
Language | Haskell2010 |
Monadic side of the Mempool implementation.
Using the functions defined in Ouroboros.Consensus.Mempool.Impl.Pure,
a dedicated constructor
openMempool
is provided to encapsulate the mempool
functionality.
The implementation is based on a MempoolEnv that captures the relevant variables to manage the mempool and is then used to craft functions that conform to the Mempool datatype API.
The operations performed on the Mempool are written in a pure fashion in Ouroboros.Consensus.Mempool.Impl.Pure.
Synopsis
- openMempool :: ( IOLike m, LedgerSupportsMempool blk, HasTxId ( GenTx blk), ValidateEnvelope blk) => ResourceRegistry m -> LedgerInterface m blk -> LedgerConfig blk -> MempoolCapacityBytesOverride -> Tracer m ( TraceEventMempool blk) -> ( GenTx blk -> TxSizeInBytes ) -> m ( Mempool m blk TicketNo )
-
data
LedgerInterface
m blk =
LedgerInterface
{
- getCurrentLedgerState :: STM m ( LedgerState blk)
- chainDBLedgerInterface :: ( IOLike m, IsLedger ( LedgerState blk)) => ChainDB m blk -> LedgerInterface m blk
- openMempoolWithoutSyncThread :: ( IOLike m, LedgerSupportsMempool blk, HasTxId ( GenTx blk), ValidateEnvelope blk) => LedgerInterface m blk -> LedgerConfig blk -> MempoolCapacityBytesOverride -> Tracer m ( TraceEventMempool blk) -> ( GenTx blk -> TxSizeInBytes ) -> m ( Mempool m blk TicketNo )
Documentation
openMempool :: ( IOLike m, LedgerSupportsMempool blk, HasTxId ( GenTx blk), ValidateEnvelope blk) => ResourceRegistry m -> LedgerInterface m blk -> LedgerConfig blk -> MempoolCapacityBytesOverride -> Tracer m ( TraceEventMempool blk) -> ( GenTx blk -> TxSizeInBytes ) -> m ( Mempool m blk TicketNo ) Source #
Create a
Mempool m blk TicketNo
in
m
to manipulate the mempool. It
will also fork a thread that syncs the mempool and the ledger when the ledger
changes.
For testing purposes
data LedgerInterface m blk Source #
Abstract interface needed to run a Mempool.
LedgerInterface | |
|
chainDBLedgerInterface :: ( IOLike m, IsLedger ( LedgerState blk)) => ChainDB m blk -> LedgerInterface m blk Source #
Create a
LedgerInterface
from a
ChainDB
.
openMempoolWithoutSyncThread :: ( IOLike m, LedgerSupportsMempool blk, HasTxId ( GenTx blk), ValidateEnvelope blk) => LedgerInterface m blk -> LedgerConfig blk -> MempoolCapacityBytesOverride -> Tracer m ( TraceEventMempool blk) -> ( GenTx blk -> TxSizeInBytes ) -> m ( Mempool m blk TicketNo ) Source #
Unlike
openMempool
, this function does not fork a background thread
that synchronises with the ledger state whenever the later changes.
Intended for testing purposes.