CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace harvesting {
29 #define UNLOCKED_ACCOUNTS_ADD_RESULT_LIST \
34 ENUM_VALUE(Failure_Harvesting_Ineligible) \
37 ENUM_VALUE(Failure_Harvesting_Blocked) \
40 ENUM_VALUE(Failure_Server_Limit)
42 #define ENUM_VALUE(LABEL) LABEL,
57 const std::vector<crypto::KeyPair>& keyPairs,
93 size_t maxUnlockedAccounts,
94 std::vector<crypto::KeyPair>& keyPairs,
utils::SpinReaderWriterLock::WriterLockGuard m_writeLock
Definition: UnlockedAccounts.h:116
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto ¬ification, const auto &context) { cache::ImportanceView view(context.Cache.template sub< cache::AccountStateCache >());return view.canHarvest(notification.Signer, context.Height) ? ValidationResult::Success :Failure_Core_Block_Harvester_Ineligible;})
std::vector< crypto::KeyPair > & m_keyPairs
Definition: UnlockedAccounts.h:114
UnlockedAccountsView view() const
Gets a read only view of the unlocked accounts.
Definition: UnlockedAccounts.cpp:86
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
UnlockedAccountsModifier modifier()
Gets a write only view of the unlocked accounts.
Definition: UnlockedAccounts.cpp:91
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
std::ostream & operator<<(std::ostream &out, UnlockedAccountsAddResult value)
Insertion operator for outputting value to out.
ValidationResult
Enumeration of all possible validation results.
Definition: ValidationResult.h:51
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: UnlockedAccounts.h:82
std::vector< crypto::KeyPair > m_keyPairs
Definition: UnlockedAccounts.h:135
A write only view on top of unlocked accounts.
Definition: UnlockedAccounts.h:86
DECLARE_SERVICE_REGISTRAR() HashCache()
Definition: HashCacheService.cpp:46
UnlockedAccounts(size_t maxUnlockedAccounts)
Creates an unlocked accounts container that allows at most maxUnlockedAccounts unloced accounts.
Definition: UnlockedAccounts.h:123
size_t m_maxUnlockedAccounts
Definition: UnlockedAccounts.h:134
ReaderLockGuard acquireReader()
Blocks until a reader lock can be acquired.
Definition: SpinReaderWriterLock.h:153
UnlockedAccountsAddResult add(crypto::KeyPair &&keyPair)
Adds (unlocks) the account identified by key pair (keyPair).
Definition: UnlockedAccounts.cpp:54
size_t size() const
Returns the number of unlocked accounts.
Definition: UnlockedAccounts.cpp:42
A read only view on top of unlocked accounts.
Definition: UnlockedAccounts.h:53
A writer lock guard.
Definition: SpinReaderWriterLock.h:83
Container of all unlocked (harvesting candidate) accounts.
Definition: UnlockedAccounts.h:120
Represents a pair of private key with associated public key.
Definition: KeyPair.h:33
AliasedDataNotification< MosaicId, Namespace_Aliased_MosaicId_Notification > AliasedMosaicIdNotification
Notification of an aliased mosaic id.
Definition: AliasNotifications.h:122
auto end() const
Returns a const iterator to the element following the last element of the underlying container.
Definition: UnlockedAccounts.h:76
const std::vector< crypto::KeyPair > & m_keyPairs
Definition: UnlockedAccounts.h:81
bool contains(const Key &publicKey) const
Returns true if the public key belongs to an unlocked account, false otherwise.
Definition: UnlockedAccounts.cpp:46
NotificationType
Enumeration of all possible notification types.
Definition: NotificationType.h:43
UnlockedAccountsModifier(size_t maxUnlockedAccounts, std::vector< crypto::KeyPair > &keyPairs, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
Creates a view around maxUnlockedAccounts and keyPairs with lock context readLock.
Definition: UnlockedAccounts.h:92
predicate< const Key & > KeyPredicate
Definition: UnlockedAccounts.h:88
def info(*args)
Definition: forwardsValidation.py:12
static constexpr auto AliasedType
Definition: UnlinkAliasedDataConsistencyValidator.cpp:58
AliasedDataNotification< Address, Namespace_Aliased_Address_Notification > AliasedAddressNotification
Notification of an aliased address.
Definition: AliasNotifications.h:119
A class that can be moved but not copied.
Definition: NonCopyable.h:43
UnlockedAccountsAddResult
Possible results of an add (unlock) operation.
Definition: UnlockedAccounts.h:44
utils::SpinReaderWriterLock m_lock
Definition: UnlockedAccounts.h:136
A reader lock guard.
Definition: SpinReaderWriterLock.h:99
void remove(const Key &publicKey)
Removes (locks) the account identified by the public key (publicKey).
Definition: UnlockedAccounts.cpp:65
Definition: AddressExtractionExtension.cpp:28
UnlockedAccountsView(const std::vector< crypto::KeyPair > &keyPairs, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
Creates a view around keyPairs with lock context readLock.
Definition: UnlockedAccounts.h:56
size_t m_maxUnlockedAccounts
Definition: UnlockedAccounts.h:113
#define DEFINE_UNLINK_ALIASED_DATA_VALIDATOR(VALIDATOR_NAME, TRAITS_NAME)
Definition: UnlinkAliasedDataConsistencyValidator.cpp:51
void removeIf(const KeyPredicate &predicate)
Removes all accounts for which predicate returns true.
Definition: UnlockedAccounts.cpp:71
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
auto begin() const
Returns a const iterator to the first element of the underlying container.
Definition: UnlockedAccounts.h:71
Definition: SpinReaderWriterLock.h:36
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
Definition: UnlockedAccounts.h:115