CatapultServer  v0.5.0.1 (Elephant)
catapult::cache::MemoryUtCacheView Class Reference

A read only view on top of unconfirmed transactions cache. More...

Collaboration diagram for catapult::cache::MemoryUtCacheView:

Public Member Functions

 MemoryUtCacheView (uint64_t maxResponseSize, const TransactionDataContainer &transactionDataContainer, const IdLookup &idLookup, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
 
size_t size () const
 Returns the number of unconfirmed transactions in the cache. More...
 
bool contains (const Hash256 &hash) const
 Returns true if the cache contains an unconfirmed transaction with associated hash, false otherwise. More...
 
void forEach (const TransactionInfoConsumer &consumer) const
 Calls consumer with all transaction infos until all are consumed or false is returned by consumer. More...
 
model::ShortHashRange shortHashes () const
 
UnknownTransactions unknownTransactions (BlockFeeMultiplier minFeeMultiplier, const utils::ShortHashesSet &knownShortHashes) const
 

Private Types

using UnknownTransactions = std::vector< std::shared_ptr< const model::Transaction > >
 
using IdLookup = std::unordered_map< Hash256, size_t, utils::ArrayHasher< Hash256 > >
 
using TransactionInfoConsumer = predicate< const model::TransactionInfo & >
 

Private Attributes

uint64_t m_maxResponseSize
 
const TransactionDataContainerm_transactionDataContainer
 
const IdLookupm_idLookup
 
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
 

Detailed Description

A read only view on top of unconfirmed transactions cache.

Member Typedef Documentation

◆ IdLookup

using catapult::cache::MemoryUtCacheView::IdLookup = std::unordered_map<Hash256, size_t, utils::ArrayHasher<Hash256> >
private

◆ TransactionInfoConsumer

◆ UnknownTransactions

using catapult::cache::MemoryUtCacheView::UnknownTransactions = std::vector<std::shared_ptr<const model::Transaction> >
private

Constructor & Destructor Documentation

◆ MemoryUtCacheView()

catapult::cache::MemoryUtCacheView::MemoryUtCacheView ( uint64_t  maxResponseSize,
const TransactionDataContainer transactionDataContainer,
const IdLookup idLookup,
utils::SpinReaderWriterLock::ReaderLockGuard &&  readLock 
)
explicit

Creates a view around a maximum response size (maxResponseSize), a transaction data container (transactionDataContainer) and an id lookup (idLookup) with lock context readLock.

Member Function Documentation

◆ contains()

bool catapult::cache::MemoryUtCacheView::contains ( const Hash256 hash) const

Returns true if the cache contains an unconfirmed transaction with associated hash, false otherwise.

Here is the caller graph for this function:

◆ forEach()

void catapult::cache::MemoryUtCacheView::forEach ( const TransactionInfoConsumer consumer) const

Calls consumer with all transaction infos until all are consumed or false is returned by consumer.

Here is the caller graph for this function:

◆ shortHashes()

model::ShortHashRange catapult::cache::MemoryUtCacheView::shortHashes ( ) const

Gets a range of short hashes of all transactions in the cache. A short hash consists of the first 4 bytes of the complete hash.

Here is the call graph for this function:

◆ size()

size_t catapult::cache::MemoryUtCacheView::size ( ) const

Returns the number of unconfirmed transactions in the cache.

Here is the caller graph for this function:

◆ unknownTransactions()

MemoryUtCacheView::UnknownTransactions catapult::cache::MemoryUtCacheView::unknownTransactions ( BlockFeeMultiplier  minFeeMultiplier,
const utils::ShortHashesSet knownShortHashes 
) const

Gets a vector of all transactions in the cache that have a fee multiplier at least minFeeMultiplier and do not have a short hash in knownShortHashes.

Here is the call graph for this function:

Member Data Documentation

◆ m_idLookup

const IdLookup& catapult::cache::MemoryUtCacheView::m_idLookup
private

◆ m_maxResponseSize

uint64_t catapult::cache::MemoryUtCacheView::m_maxResponseSize
private

◆ m_readLock

utils::SpinReaderWriterLock::ReaderLockGuard catapult::cache::MemoryUtCacheView::m_readLock
private

◆ m_transactionDataContainer

const TransactionDataContainer& catapult::cache::MemoryUtCacheView::m_transactionDataContainer
private

The documentation for this class was generated from the following files: