CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
30 #include <unordered_map>
32 namespace catapult {
namespace cache {
class PtData; } }
34 namespace catapult {
namespace cache {
36 using PtDataContainer = std::unordered_map<Hash256, PtData, utils::ArrayHasher<Hash256>>;
47 uint64_t maxResponseSize,
ShortHash ToShortHash(const Hash256 &hash)
Gets the short hash corresponding to hash.
Definition: ShortHash.h:42
std::set< state::TimestampedHash > & m_timestampedHashes
Definition: MemoryPtCache.cpp:257
A cosignature.
Definition: Cosignature.h:29
model::WeakCosignedTransactionInfo find(const Hash256 &hash) const
Finds a partial transaction in the cache with associated hash or returns nullptr if no such transacti...
Definition: MemoryPtCache.cpp:106
A delegating proxy around a memory-based cache.
Definition: MemoryCacheProxy.h:29
std::unordered_map< Hash256, PtData, utils::ArrayHasher< Hash256 > > PtDataContainer
Definition: MemoryPtCache.h:36
Wrapper around a transaction and its cosignatures.
Definition: WeakCosignedTransactionInfo.h:29
DetachedTransactionInfo copy() const
Creates a (shallow) copy of this info.
Definition: EntityInfo.h:92
std::unordered_map< utils::ShortHash, utils::ShortHash, utils::ShortHashHasher > ShortHashPairMap
A map composed of short hash pairs where the key is the transaction short hash and the value is the c...
Definition: ShortHashPair.h:57
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
model::WeakCosignedTransactionInfo weakCosignedTransactionInfo() const
Definition: MemoryPtCache.cpp:58
void Sha3_256(const RawBuffer &dataBuffer, Hash256 &hash) noexcept
Calculates the 256-bit SHA3 hash of dataBuffer into hash.
Definition: Hashes.cpp:81
Definition: CosignedTransactionInfo.h:30
MemoryCacheOptions m_options
Definition: MemoryPtCache.h:88
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: MemoryPtCache.cpp:258
uint64_t MaxCacheSize
Maximum size of the cache.
Definition: MemoryCacheOptions.h:44
Definition: MemoryPtCache.cpp:30
const std::vector< model::Cosignature > & cosignatures() const
Definition: MemoryPtCache.cpp:50
const Hash256 & entityHash() const
Definition: MemoryPtCache.cpp:46
Represents a range of entities.
Definition: EntityRange.h:31
A delegating proxy around a MemoryPtCache.
Definition: MemoryPtCache.h:97
void LogSizes(const char *name, size_t actual, uint64_t max)
Logs cache sizes for a cache with name at specified levels of fullness given its actual and max sizes...
Definition: CacheSizeLogger.h:27
auto begin() const
Returns a const iterator that represents the first entity.
Definition: EntityRange.h:420
Definition: MemoryPtCache.cpp:267
ReaderLockGuard acquireReader()
Blocks until a reader lock can be acquired.
Definition: SpinReaderWriterLock.h:153
std::vector< model::Cosignature > m_cosignatures
Definition: MemoryPtCache.cpp:88
static EntityRange PrepareFixed(size_t numElements, uint8_t **ppRangeData=nullptr)
Definition: EntityRange.h:265
MemoryPtCacheView(uint64_t maxResponseSize, const PtDataContainer &transactionDataContainer, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
Definition: MemoryPtCache.cpp:93
ShortHashPairRange shortHashPairs() const
Definition: MemoryPtCache.cpp:113
const Hash256 & cosignaturesHash() const
Definition: MemoryPtCache.cpp:54
utils::SpinReaderWriterLock::WriterLockGuard m_writeLock
Definition: MemoryPtCache.cpp:259
state::TimestampedHash timestampedHash() const
Definition: MemoryPtCache.cpp:62
uint64_t MaxResponseSize
Maximum response size.
Definition: MemoryCacheOptions.h:41
utils::SpinReaderWriterLock m_lock
Definition: MemoryPtCache.h:93
uint64_t m_maxCacheSize
Definition: MemoryPtCache.cpp:255
~MemoryPtCache() override
Destroys a partial transactions cache.
const PtDataContainer & m_transactionDataContainer
Definition: MemoryPtCache.h:67
model::DetachedTransactionInfo transactionInfo() const
Definition: MemoryPtCache.cpp:38
MemoryPtCacheView view() const
Gets a read only view based on this cache.
Definition: MemoryPtCache.cpp:279
uint64_t size
Definition: MemoryCounters.cpp:65
Represents a hash with attached timestamp.
Definition: TimestampedHash.h:31
bool add(const Key &signer, const Signature &signature)
Definition: MemoryPtCache.cpp:67
std::shared_ptr< const model::Transaction > transaction() const
Definition: MemoryPtCache.cpp:42
PtDataContainer TransactionDataContainer
Definition: MemoryPtCache.cpp:268
model::DetachedTransactionInfo m_transactionInfo
Definition: MemoryPtCache.cpp:86
A reader lock guard.
Definition: SpinReaderWriterLock.h:99
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: MemoryPtCache.h:68
CompareChainsOptions m_options
Definition: CompareChains.cpp:165
UnknownTransactionInfos unknownTransactions(const ShortHashPairMap &knownShortHashPairs) const
Gets a vector of all unknown transaction infos in the cache that do not have a short hash pair in kno...
Definition: MemoryPtCache.cpp:126
size_t size() const
Returns the number of partial transactions in the cache.
Definition: MemoryPtCache.cpp:102
utils::BaseValue< uint64_t, Timestamp_tag > Timestamp
Definition: src/catapult/types.h:73
A read only view on top of partial transactions cache.
Definition: MemoryPtCache.h:39
std::shared_ptr< TEntity > pEntity
Entity pointer.
Definition: EntityInfo.h:45
Definition: AddressExtractionExtension.cpp:28
Cache for all partial transactions.
Definition: MemoryPtCache.h:72
An interface for caching partial transactions.
Definition: PtCache.h:71
uint64_t m_maxResponseSize
Definition: MemoryPtCache.h:66
MemoryPtCache(const MemoryCacheOptions &options)
Creates a partial transactions cache around options.
Definition: MemoryPtCache.cpp:272
Hash256 EntityHash
Transaction entity hash.
Definition: CosignedTransactionInfo.h:32
Options for customizing the behavior of a memory based cache.
Definition: MemoryCacheOptions.h:27
Hash256 EntityHash
Entity hash.
Definition: EntityInfo.h:48
std::vector< Cosignature > Cosignatures
Cosignatures (optional).
Definition: CosignedTransactionInfo.h:38
std::unique_ptr< Impl > m_pImpl
Definition: MemoryPtCache.h:92
std::set< state::TimestampedHash > TimestampedHashes
Definition: MemoryPtCache.cpp:269
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
std::shared_ptr< const Transaction > pTransaction
Transaction pointer (optional).
Definition: CosignedTransactionInfo.h:35
PtDataContainer & m_transactionDataContainer
Definition: MemoryPtCache.cpp:256
Definition: SpinReaderWriterLock.h:36
PtCacheModifierProxy modifier() override
Gets a write only view of the cache.
Definition: MemoryPtCache.cpp:284
Hash256 m_cosignaturesHash
Definition: MemoryPtCache.cpp:87
Definition: EntityInfo.h:77
PtData(const model::DetachedTransactionInfo &transactionInfo)
Definition: MemoryPtCache.cpp:32
std::vector< model::CosignedTransactionInfo > UnknownTransactionInfos
Definition: MemoryPtCache.h:41