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

Basic delta on top of the account state cache. More...

Inheritance diagram for catapult::cache::BasicAccountStateCacheDelta:
Collaboration diagram for catapult::cache::BasicAccountStateCacheDelta:

Classes

struct  ArrayHeightPairHasher
 
struct  HighValueAddressesTuple
 Tuple composed of information about high value addresses that is returned by highValueAddresses. More...
 

Public Types

using ReadOnlyView = ReadOnlyAccountStateCache
 
- Public Types inherited from catapult::cache::ConstAccessorMixin< TSet, TCacheDescriptor, TValueAdapter >
using const_iterator = detail::CacheFindIterator< TCacheDescriptor, TValueAdapter, SetIteratorType, const ValueType >
 Find (const) iterator. More...
 
- Public Types inherited from catapult::cache::MutableAccessorMixin< TSet, TCacheDescriptor, TValueAdapter >
using iterator = detail::CacheFindIterator< TCacheDescriptor, TValueAdapter, SetIteratorType, ValueType >
 Find (mutable) iterator. More...
 

Public Member Functions

 BasicAccountStateCacheDelta (const AccountStateCacheTypes::BaseSetDeltaPointers &accountStateSets, const AccountStateCacheTypes::Options &options, const model::AddressSet &highValueAddresses)
 Creates a delta around accountStateSets, options and highValueAddresses. More...
 
model::NetworkIdentifier networkIdentifier () const
 Gets the network identifier. More...
 
uint64_t importanceGrouping () const
 Gets the network importance grouping. More...
 
Amount minHarvesterBalance () const
 Gets the minimum harvester balance. More...
 
MosaicId harvestingMosaicId () const
 Gets the harvesting mosaic id. More...
 
void addAccount (const Address &address, Height addressHeight)
 If not present, adds an account to the cache at given height (addressHeight) using address. More...
 
void addAccount (const Key &publicKey, Height publicKeyHeight)
 
void addAccount (const state::AccountState &accountState)
 If not present, adds an account to the cache using information in accountState. More...
 
void queueRemove (const Address &address, Height height)
 
void queueRemove (const Key &publicKey, Height height)
 
void commitRemovals ()
 Commits all queued removals. More...
 
HighValueAddressesTuple highValueAddresses () const
 Gets all high value addresses. More...
 
- Public Member Functions inherited from catapult::utils::MoveOnly
constexpr MoveOnly ()=default
 Default constructor. More...
 
 ~MoveOnly ()=default
 Default destructor. More...
 
 MoveOnly (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
 MoveOnly (MoveOnly &&)=default
 Default move constructor. More...
 
MoveOnlyoperator= (const MoveOnly &)=delete
 Disabled assignment operator. More...
 
MoveOnlyoperator= (MoveOnly &&)=default
 Default move assignment operator. More...
 
- Public Member Functions inherited from catapult::cache::ContainsMixin< TSet, TCacheDescriptor >
 ContainsMixin (const TSet &set)
 Creates a mixin around set. More...
 
bool contains (const KeyType &key) const
 Gets a value indicating whether or not the cache contains an element with key. More...
 
- Public Member Functions inherited from catapult::cache::ConstAccessorMixin< TSet, TCacheDescriptor, TValueAdapter >
 ConstAccessorMixin (const TSet &set)
 Creates a mixin around set. More...
 
const_iterator find (const KeyType &key) const
 Finds the cache value identified by key. More...
 
- Public Member Functions inherited from catapult::cache::MutableAccessorMixin< TSet, TCacheDescriptor, TValueAdapter >
 MutableAccessorMixin (TSet &set)
 Creates a mixin around set. More...
 
iterator find (const KeyType &key)
 Finds the cache value identified by key. More...
 
- Public Member Functions inherited from catapult::cache::PatriciaTreeDeltaMixin< TSet, TTree >
 PatriciaTreeDeltaMixin (TSet &set, const std::shared_ptr< TTree > &pTree)
 Creates a mixin around delta set and pTree. More...
 
bool supportsMerkleRoot () const
 Returns true if merkle root is supported. More...
 
std::pair< Hash256, bool > tryGetMerkleRoot () const
 Tries to get the merkle root if supported. More...
 
void updateMerkleRoot (Height height)
 Recalculates the merkle root given the specified chain height if supported. More...
 
void setMerkleRoot (const Hash256 &merkleRoot)
 

Private Types

template<typename TArray >
using ArrayHeightPair = std::pair< Height, TArray >
 
template<typename TArray >
using QueuedRemovalSet = std::unordered_set< ArrayHeightPair< TArray >, ArrayHeightPairHasher< TArray > >
 

Private Member Functions

 BasicAccountStateCacheDelta (const AccountStateCacheTypes::BaseSetDeltaPointers &accountStateSets, const AccountStateCacheTypes::Options &options, const model::AddressSet &highValueAddresses, std::unique_ptr< AccountStateCacheDeltaMixins::KeyLookupAdapter > &&pKeyLookupAdapter)
 
Address getAddress (const Key &publicKey)
 
void remove (const Address &address, Height height)
 
void remove (const Key &publicKey, Height height)
 

Private Attributes

AccountStateCacheTypes::PrimaryTypes::BaseSetDeltaPointerType m_pStateByAddress
 
AccountStateCacheTypes::KeyLookupMapTypes::BaseSetDeltaPointerType m_pKeyToAddress
 
const AccountStateCacheTypes::Optionsm_options
 
const model::AddressSetm_highValueAddresses
 
std::unique_ptr< AccountStateCacheDeltaMixins::KeyLookupAdapterm_pKeyLookupAdapter
 
QueuedRemovalSet< Addressm_queuedRemoveByAddress
 
QueuedRemovalSet< Keym_queuedRemoveByPublicKey
 

Detailed Description

Basic delta on top of the account state cache.

Member Typedef Documentation

◆ ArrayHeightPair

template<typename TArray >
using catapult::cache::BasicAccountStateCacheDelta::ArrayHeightPair = std::pair<Height, TArray>
private

◆ QueuedRemovalSet

template<typename TArray >
using catapult::cache::BasicAccountStateCacheDelta::QueuedRemovalSet = std::unordered_set<ArrayHeightPair<TArray>, ArrayHeightPairHasher<TArray> >
private

◆ ReadOnlyView

Constructor & Destructor Documentation

◆ BasicAccountStateCacheDelta() [1/2]

catapult::cache::BasicAccountStateCacheDelta::BasicAccountStateCacheDelta ( const AccountStateCacheTypes::BaseSetDeltaPointers accountStateSets,
const AccountStateCacheTypes::Options options,
const model::AddressSet highValueAddresses 
)

Creates a delta around accountStateSets, options and highValueAddresses.

◆ BasicAccountStateCacheDelta() [2/2]

catapult::cache::BasicAccountStateCacheDelta::BasicAccountStateCacheDelta ( const AccountStateCacheTypes::BaseSetDeltaPointers accountStateSets,
const AccountStateCacheTypes::Options options,
const model::AddressSet highValueAddresses,
std::unique_ptr< AccountStateCacheDeltaMixins::KeyLookupAdapter > &&  pKeyLookupAdapter 
)
private

Member Function Documentation

◆ addAccount() [1/3]

void catapult::cache::BasicAccountStateCacheDelta::addAccount ( const Address address,
Height  addressHeight 
)

If not present, adds an account to the cache at given height (addressHeight) using address.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addAccount() [2/3]

void catapult::cache::BasicAccountStateCacheDelta::addAccount ( const Key publicKey,
Height  publicKeyHeight 
)

If not present, adds an account to the cache using publicKey. If public key has not been known earlier, its height is set to publicKeyHeight.

Here is the call graph for this function:

◆ addAccount() [3/3]

void catapult::cache::BasicAccountStateCacheDelta::addAccount ( const state::AccountState accountState)

If not present, adds an account to the cache using information in accountState.

Here is the call graph for this function:

◆ commitRemovals()

void catapult::cache::BasicAccountStateCacheDelta::commitRemovals ( )

Commits all queued removals.

Here is the call graph for this function:

◆ getAddress()

Address catapult::cache::BasicAccountStateCacheDelta::getAddress ( const Key publicKey)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ harvestingMosaicId()

MosaicId catapult::cache::BasicAccountStateCacheDelta::harvestingMosaicId ( ) const

Gets the harvesting mosaic id.

Here is the caller graph for this function:

◆ highValueAddresses()

BasicAccountStateCacheDelta::HighValueAddressesTuple catapult::cache::BasicAccountStateCacheDelta::highValueAddresses ( ) const

Gets all high value addresses.

Here is the call graph for this function:

◆ importanceGrouping()

uint64_t catapult::cache::BasicAccountStateCacheDelta::importanceGrouping ( ) const

Gets the network importance grouping.

Here is the caller graph for this function:

◆ minHarvesterBalance()

Amount catapult::cache::BasicAccountStateCacheDelta::minHarvesterBalance ( ) const

Gets the minimum harvester balance.

Here is the caller graph for this function:

◆ networkIdentifier()

model::NetworkIdentifier catapult::cache::BasicAccountStateCacheDelta::networkIdentifier ( ) const

Gets the network identifier.

Here is the caller graph for this function:

◆ queueRemove() [1/2]

void catapult::cache::BasicAccountStateCacheDelta::queueRemove ( const Address address,
Height  height 
)

If height matches the height at which account was added, queues removal of account's address information from the cache, therefore queuing complete removal of the account from the cache.

◆ queueRemove() [2/2]

void catapult::cache::BasicAccountStateCacheDelta::queueRemove ( const Key publicKey,
Height  height 
)

If height matches the height at which account was added, queues removal of account's publicKey information from the cache.

◆ remove() [1/2]

void catapult::cache::BasicAccountStateCacheDelta::remove ( const Address address,
Height  height 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove() [2/2]

void catapult::cache::BasicAccountStateCacheDelta::remove ( const Key publicKey,
Height  height 
)
private
Here is the call graph for this function:

Member Data Documentation

◆ m_highValueAddresses

const model::AddressSet& catapult::cache::BasicAccountStateCacheDelta::m_highValueAddresses
private

◆ m_options

const AccountStateCacheTypes::Options& catapult::cache::BasicAccountStateCacheDelta::m_options
private

◆ m_pKeyLookupAdapter

std::unique_ptr<AccountStateCacheDeltaMixins::KeyLookupAdapter> catapult::cache::BasicAccountStateCacheDelta::m_pKeyLookupAdapter
private

◆ m_pKeyToAddress

AccountStateCacheTypes::KeyLookupMapTypes::BaseSetDeltaPointerType catapult::cache::BasicAccountStateCacheDelta::m_pKeyToAddress
private

◆ m_pStateByAddress

AccountStateCacheTypes::PrimaryTypes::BaseSetDeltaPointerType catapult::cache::BasicAccountStateCacheDelta::m_pStateByAddress
private

◆ m_queuedRemoveByAddress

QueuedRemovalSet<Address> catapult::cache::BasicAccountStateCacheDelta::m_queuedRemoveByAddress
private

◆ m_queuedRemoveByPublicKey

QueuedRemovalSet<Key> catapult::cache::BasicAccountStateCacheDelta::m_queuedRemoveByPublicKey
private

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