CatapultServer  v0.5.0.1 (Elephant)
catapult::harvesting::UnlockedAccountsModifier Class Reference

A write only view on top of unlocked accounts. More...

Inheritance diagram for catapult::harvesting::UnlockedAccountsModifier:
Collaboration diagram for catapult::harvesting::UnlockedAccountsModifier:

Public Member Functions

 UnlockedAccountsModifier (size_t maxUnlockedAccounts, std::vector< crypto::KeyPair > &keyPairs, utils::SpinReaderWriterLock::ReaderLockGuard &&readLock)
 Creates a view around maxUnlockedAccounts and keyPairs with lock context readLock. More...
 
UnlockedAccountsAddResult add (crypto::KeyPair &&keyPair)
 Adds (unlocks) the account identified by key pair (keyPair). More...
 
void remove (const Key &publicKey)
 Removes (locks) the account identified by the public key (publicKey). More...
 
void removeIf (const KeyPredicate &predicate)
 Removes all accounts for which predicate returns true. More...
 

Private Types

using KeyPredicate = predicate< const Key & >
 

Private Attributes

size_t m_maxUnlockedAccounts
 
std::vector< crypto::KeyPair > & m_keyPairs
 
utils::SpinReaderWriterLock::ReaderLockGuard m_readLock
 
utils::SpinReaderWriterLock::WriterLockGuard m_writeLock
 

Additional Inherited Members

- Private 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...
 

Detailed Description

A write only view on top of unlocked accounts.

Member Typedef Documentation

◆ KeyPredicate

Constructor & Destructor Documentation

◆ UnlockedAccountsModifier()

catapult::harvesting::UnlockedAccountsModifier::UnlockedAccountsModifier ( size_t  maxUnlockedAccounts,
std::vector< crypto::KeyPair > &  keyPairs,
utils::SpinReaderWriterLock::ReaderLockGuard &&  readLock 
)
inline

Creates a view around maxUnlockedAccounts and keyPairs with lock context readLock.

Member Function Documentation

◆ add()

UnlockedAccountsAddResult catapult::harvesting::UnlockedAccountsModifier::add ( crypto::KeyPair &&  keyPair)

Adds (unlocks) the account identified by key pair (keyPair).

◆ remove()

void catapult::harvesting::UnlockedAccountsModifier::remove ( const Key publicKey)

Removes (locks) the account identified by the public key (publicKey).

◆ removeIf()

void catapult::harvesting::UnlockedAccountsModifier::removeIf ( const KeyPredicate predicate)

Removes all accounts for which predicate returns true.

Here is the call graph for this function:

Member Data Documentation

◆ m_keyPairs

std::vector<crypto::KeyPair>& catapult::harvesting::UnlockedAccountsModifier::m_keyPairs
private

◆ m_maxUnlockedAccounts

size_t catapult::harvesting::UnlockedAccountsModifier::m_maxUnlockedAccounts
private

◆ m_readLock

utils::SpinReaderWriterLock::ReaderLockGuard catapult::harvesting::UnlockedAccountsModifier::m_readLock
private

◆ m_writeLock

utils::SpinReaderWriterLock::WriterLockGuard catapult::harvesting::UnlockedAccountsModifier::m_writeLock
private

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