CatapultServer  v0.5.0.1 (Elephant)
UtUpdater.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ChainFunctions.h"
23 #include "ExecutionConfiguration.h"
27 
28 namespace catapult {
29  namespace cache {
30  class CatapultCache;
31  class UtCache;
32  class UtCacheModifierProxy;
33  }
34 }
35 
36 namespace catapult { namespace chain {
37 
39  class UtUpdater {
40  public:
42  enum class TransactionSource {
44  New,
45 
47  Reverted,
48 
50  Existing
51  };
52 
54  struct ThrottleContext {
57 
60 
63 
66  };
67 
70 
71  public:
77  UtUpdater(
78  cache::UtCache& transactionsCache,
79  const cache::CatapultCache& confirmedCatapultCache,
80  BlockFeeMultiplier minFeeMultiplier,
81  const ExecutionConfiguration& executionConfig,
82  const TimeSupplier& timeSupplier,
83  const FailedTransactionSink& failedTransactionSink,
84  const Throttle& throttle);
85 
87  ~UtUpdater();
88 
89  public:
91  void update(const std::vector<model::TransactionInfo>& utInfos);
92 
95  void update(const utils::HashPointerSet& confirmedTransactionHashes, const std::vector<model::TransactionInfo>& utInfos);
96 
97  private:
98  class Impl;
99  std::unique_ptr<Impl> m_pImpl;
100  };
101 }}
ExecutionConfiguration.h
catapult::chain::UtUpdater::Impl::m_timeSupplier
TimeSupplier m_timeSupplier
Definition: UtUpdater.cpp:201
catapult::chain::UtUpdater::update
void update(const std::vector< model::TransactionInfo > &utInfos)
Updates this cache by applying new transaction infos in utInfos.
Definition: UtUpdater.cpp:226
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::chain::UtUpdater::UtUpdater
UtUpdater(cache::UtCache &transactionsCache, const cache::CatapultCache &confirmedCatapultCache, BlockFeeMultiplier minFeeMultiplier, const ExecutionConfiguration &executionConfig, const TimeSupplier &timeSupplier, const FailedTransactionSink &failedTransactionSink, const Throttle &throttle)
Definition: UtUpdater.cpp:206
catapult::chain::UtUpdater::Impl::apply
void apply(const ApplyState &applyState, const std::vector< model::TransactionInfo > &utInfos, TransactionSource transactionSource)
Definition: UtUpdater.cpp:106
catapult::cache::RelockableDetachedCatapultCache::rebaseAndLock
std::unique_ptr< CatapultCacheDelta > rebaseAndLock()
Rebases and locks the (detached) catapult cache delta.
Definition: RelockableDetachedCatapultCache.cpp:88
catapult::chain::UtUpdater::TransactionSource::Reverted
A previously committed transaction that was reverted.
Parser.debug
def debug(*args)
Definition: Parser.py:46
catapult::validators::IsValidationResultSuccess
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
catapult::chain::UtUpdater
Provides batch updating of an unconfirmed transactions cache.
Definition: UtUpdater.h:39
catapult::cache::BasicTransactionsCache::modifier
virtual TTransactionsCacheModifierProxy modifier()=0
Gets a write only view of the cache.
catapult::observers::ObserverContext
Context passed to all the observers.
Definition: ObserverContext.h:78
UtUpdater.h
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
catapult::chain::UtUpdater::Impl::m_minFeeMultiplier
BlockFeeMultiplier m_minFeeMultiplier
Definition: UtUpdater.cpp:199
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::cache::UtCacheModifierProxy::removeAll
std::vector< model::TransactionInfo > removeAll()
Removes all transactions from the cache.
Definition: UtCache.h:50
UtCache.h
catapult::chain::UtUpdater::Impl::m_throttle
UtUpdater::Throttle m_throttle
Definition: UtUpdater.cpp:203
catapult::chain::ExecutionConfiguration::Network
model::NetworkInfo Network
Network info.
Definition: ExecutionConfiguration.h:39
catapult::chain::FailedTransactionSink
consumer< const model::Transaction &, const Hash256 &, validators::ValidationResult > FailedTransactionSink
Indicates a transaction with the specified hash failed validation.
Definition: ChainFunctions.h:33
catapult::chain::ProcessingNotificationSubscriber::enableUndo
void enableUndo()
Enables subsequent notifications to be undone.
Definition: ProcessingNotificationSubscriber.cpp:44
catapult::chain::ProcessingNotificationSubscriber
A notification subscriber that processes notifications.
Definition: ProcessingNotificationSubscriber.h:29
ObserverTypes.h
catapult::cache::BasicTransactionsCacheModifierProxy::add
bool add(const TTransactionInfo &transactionInfo)
Definition: BasicTransactionsCache.h:65
catapult::model::TransactionInfo
A transaction and its associated metadata.
Definition: EntityInfo.h:104
catapult::chain::ExecutionConfiguration::pObserver
ObserverPointer pObserver
Observer.
Definition: ExecutionConfiguration.h:42
catapult::utils::BaseValue< uint32_t, BlockFeeMultiplier_tag >
catapult::chain::UtUpdater::~UtUpdater
~UtUpdater()
Destroys the updater.
catapult::chain::UtUpdater::Throttle
predicate< const model::TransactionInfo &, const ThrottleContext & > Throttle
Function signature for throttling cache additions.
Definition: UtUpdater.h:69
ChainResults.h
catapult::chain::UtUpdater::Impl::update
void update(const std::vector< model::TransactionInfo > &utInfos)
Definition: UtUpdater.cpp:65
catapult::validators::ValidatorContext
Contextual information passed to stateful validators.
Definition: ValidatorContext.h:32
catapult::chain::UtUpdater::Impl::addAll
void addAll(cache::UtCacheModifierProxy &modifier, const std::vector< model::TransactionInfo > &utInfos)
Definition: UtUpdater.cpp:191
catapult::chain::ExecutionConfiguration
Configuration for executing entities.
Definition: ExecutionConfiguration.h:30
catapult::chain::UtUpdater::ThrottleContext::TransactionSource
UtUpdater::TransactionSource TransactionSource
Transaction source.
Definition: UtUpdater.h:56
catapult::cache::UtCache
An interface for caching unconfirmed transactions.
Definition: UtCache.h:56
HexFormatter.h
catapult::chain::UtUpdater::Impl::m_failedTransactionSink
FailedTransactionSink m_failedTransactionSink
Definition: UtUpdater.cpp:202
catapult::cache::UtCacheModifierProxy
Definition: UtCache.h:39
catapult::chain::ProcessingNotificationSubscriber::undo
void undo()
Undoes all executions since enableUndo was first called.
Definition: ProcessingNotificationSubscriber.cpp:48
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::chain::UtUpdater::Impl::m_executionConfig
ExecutionConfiguration m_executionConfig
Definition: UtUpdater.cpp:200
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::state::CatapultState
Stateful catapult information.
Definition: CatapultState.h:27
catapult::chain::UtUpdater::ThrottleContext
Contextual information passed to throttle.
Definition: UtUpdater.h:54
EntityInfo.h
catapult::chain::UtUpdater::Impl
Definition: UtUpdater.cpp:45
CatapultCache.h
CATAPULT_LOG_LEVEL
#define CATAPULT_LOG_LEVEL(LEVEL)
Writes a log entry to the default logger with LEVEL severity.
Definition: Logging.h:336
catapult::chain::UtUpdater::Impl::throttle
bool throttle(const model::TransactionInfo &utInfo, TransactionSource transactionSource, const ApplyState &applyState, cache::ReadOnlyCatapultCache &cache) const
Definition: UtUpdater.cpp:183
catapult::model::WeakEntityInfo
WeakEntityInfoT< VerifiableEntity > WeakEntityInfo
Definition: WeakEntityInfo.h:128
catapult::chain::UtUpdater::TransactionSource::Existing
An existing transaction that is reapplied.
catapult::chain::UtUpdater::Impl::m_transactionsCache
cache::UtCache & m_transactionsCache
Definition: UtUpdater.cpp:197
catapult::cache::RelockableDetachedCatapultCache::height
Height height() const
Gets the current cache height.
Definition: RelockableDetachedCatapultCache.cpp:80
catapult::cache::RelockableDetachedCatapultCache::getAndTryLock
std::unique_ptr< CatapultCacheDelta > getAndTryLock()
Definition: RelockableDetachedCatapultCache.cpp:84
catapult::chain::UtUpdater::Impl::m_detachedCatapultCache
cache::RelockableDetachedCatapultCache m_detachedCatapultCache
Definition: UtUpdater.cpp:198
catapult::chain::ProcessingNotificationSubscriber::result
validators::ValidationResult result() const
Gets the aggregate result of processed notifications.
Definition: ProcessingNotificationSubscriber.cpp:40
ReadOnlyCatapultCache.h
catapult::chain::ExecutionConfiguration::ResolverContextFactory
ResolverContextFactoryFunc ResolverContextFactory
Resolver context factory.
Definition: ExecutionConfiguration.h:51
ChainFunctions.h
FeeUtils.h
ArraySet.h
catapult::chain::TimeSupplier
supplier< Timestamp > TimeSupplier
Supplies a timestamp.
Definition: ChainFunctions.h:39
catapult::chain::UtUpdater::Impl::update
void update(const utils::HashPointerSet &confirmedTransactionHashes, const std::vector< model::TransactionInfo > &utInfos)
Definition: UtUpdater.cpp:80
catapult::chain::ExecutionConfiguration::pNotificationPublisher
PublisherPointer pNotificationPublisher
Notification publisher.
Definition: ExecutionConfiguration.h:48
catapult::chain::UtUpdater::Impl::apply
void apply(const ApplyState &applyState, const std::vector< model::TransactionInfo > &utInfos, TransactionSource transactionSource, const predicate< const model::TransactionInfo & > &filter)
Definition: UtUpdater.cpp:110
catapult::chain::UtUpdater::TransactionSource
TransactionSource
Sources of transactions that can be updated.
Definition: UtUpdater.h:42
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::validators::IsValidationResultFailure
constexpr bool IsValidationResultFailure(ValidationResult result)
Returns a value indicating whether the validation result is a failure.
Definition: ValidationResult.h:95
UnconfirmedCatapultCache
cache::CatapultCacheDelta & UnconfirmedCatapultCache
Definition: UtUpdater.cpp:41
catapult::cache::RelockableDetachedCatapultCache
A relockable detached catapult cache.
Definition: RelockableDetachedCatapultCache.h:30
catapult::chain::UtUpdater::Impl::Impl
Impl(cache::UtCache &transactionsCache, const cache::CatapultCache &confirmedCatapultCache, BlockFeeMultiplier minFeeMultiplier, const ExecutionConfiguration &executionConfig, const TimeSupplier &timeSupplier, const FailedTransactionSink &failedTransactionSink, const Throttle &throttle)
Definition: UtUpdater.cpp:47
catapult::validators::MapToLogLevel
constexpr utils::LogLevel MapToLogLevel(ValidationResult result)
Maps validation result to an appropriate logging level.
Definition: ValidationResult.h:100
catapult::model::CalculateTransactionFee
Amount CalculateTransactionFee(BlockFeeMultiplier feeMultiplier, const Transaction &transaction)
Calculates the fee for transaction contained in block with feeMultiplier.
Definition: FeeUtils.cpp:26
catapult::utils::HashPointerSet
ArrayPointerSet< Hash256 > HashPointerSet
A hash pointer set.
Definition: ArraySet.h:70
ProcessingNotificationSubscriber.h
catapult::chain::UtUpdater::ThrottleContext::TransactionsCache
const cache::UtCacheModifierProxy & TransactionsCache
Unconfirmed transactions cache.
Definition: UtUpdater.h:65
catapult::chain::UtUpdater::m_pImpl
std::unique_ptr< Impl > m_pImpl
Definition: UtUpdater.h:98
Modifier
cache::UtCacheModifierProxy & Modifier
Definition: UtUpdater.cpp:40
catapult::chain::ExecutionConfiguration::pValidator
ValidatorPointer pValidator
Stateful validator.
Definition: ExecutionConfiguration.h:45
catapult::cache::ReadOnlyCatapultCache
A read-only overlay on top of a catapult cache.
Definition: ReadOnlyCatapultCache.h:27
catapult::chain::UtUpdater::ThrottleContext::CacheHeight
Height CacheHeight
Cache height.
Definition: UtUpdater.h:59
catapult::chain::UtUpdater::ThrottleContext::UnconfirmedCatapultCache
const cache::ReadOnlyCatapultCache & UnconfirmedCatapultCache
Unconfirmed catapult cache.
Definition: UtUpdater.h:62
RelockableDetachedCatapultCache.h
catapult::chain::UtUpdater::TransactionSource::New
A new transaction that is added for the first time.