CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
26 namespace catapult {
namespace deltaset {
30 template<
typename T,
typename =
void>
52 template<
typename TKeyTraits,
typename TStorageSet,
typename TMemorySet>
62 using StorageFlag = std::integral_constant<ConditionalContainerMode, ConditionalContainerMode::Storage>;
63 using MemoryFlag = std::integral_constant<ConditionalContainerMode, ConditionalContainerMode::Memory>;
92 return !(*
this == rhs);
123 template<
typename... TStorageArgs>
126 m_pContainer1 = std::make_unique<StorageSetType>(std::forward<TStorageArgs>(storageArgs)...);
167 template<
typename TPruningBoundary>
168 void prune(
const TPruningBoundary& pruningBoundary) {
180 template<
typename TKeyTraits2,
typename TStorageSet2,
typename TMemorySet2>
183 template<
typename TKeyTraits2,
typename TStorageSet2,
typename TMemorySet2>
189 template<
typename TKeyTraits,
typename TStorageSet,
typename TMemorySet>
197 template<
typename TKeyTraits,
typename TStorageSet,
typename TMemorySet>
207 template<
typename TKeyTraits,
typename TStorageSet,
typename TMemorySet>
214 template<
typename TKeyTraits,
typename TStorageSet,
typename TMemorySet,
typename TPruningBoundary>
216 container.
prune(pruningBoundary);
typename MemorySetType::value_type value_type
Definition: ConditionalContainer.h:58
Notifies the arrival of a transaction.
Definition: Notifications.h:231
ConditionalIterator()=default
Creates an uninitialized iterator.
ConditionalIterator cend() const
Returns a const iterator to the element following the last element of the underlying set.
Definition: ConditionalContainer.h:144
ConditionalIterator find(const typename TKeyTraits::KeyType &key) const
Searches for key in this set.
Definition: ConditionalContainer.h:151
bool empty() const
Gets a value indicating whether or not this set is empty.
Definition: ConditionalContainer.h:133
ConditionalContainerMode
Possible conditional container modes.
Definition: ConditionalContainer.h:43
TStorageSet StorageSetType
Definition: ConditionalContainer.h:55
void UpdateSet(TStorageSet &elements, const DeltaElements< TMemorySet > &deltas)
Applies all changes in deltas to elements.
Definition: BaseSetCommitPolicy.h:29
bool IsSetIterable(const TSet &)
Returns true if set is iterable.
Definition: BaseSetIterationView.h:61
DEFINE_OBSERVER(AccountAddress, model::AccountAddressNotification, [](const auto ¬ification, const auto &context) { DefaultAccountVisitor visitor(context);visitor.visit(notification.Address);})
const TSet & SelectIterableSet(const TSet &set)
Selects the iterable set from set.
Definition: BaseSetIterationView.h:67
Synchronized cache composed of hash lock info information.
Definition: HashLockInfoCache.h:33
Slim wrapper around changed elements.
Definition: DeltaElements.h:27
static constexpr auto Receipt_Type
Definition: CompletedAggregateObserver.cpp:36
ConditionalIterator(typename StorageSetType::const_iterator &&iter, StorageFlag)
Creates a conditional iterator around iter for a storage container.
Definition: ConditionalContainer.h:73
std::unique_ptr< StorageSetType > m_pContainer1
Definition: ConditionalContainer.h:176
std::integral_constant< ConditionalContainerMode, ConditionalContainerMode::Memory > MemoryFlag
Definition: ConditionalContainer.h:63
model::TransactionNotification Notification
Definition: CompletedAggregateObserver.cpp:29
typename T::hasher hasher
Definition: ConditionalContainer.h:37
ConditionalIterator(typename MemorySetType::const_iterator &&iter, MemoryFlag)
Creates a conditional iterator around iter for a memory container.
Definition: ConditionalContainer.h:79
const friend TMemorySet2 & SelectIterableSet(const ConditionalContainer< TKeyTraits2, TStorageSet2, TMemorySet2 > &set)
MemorySetType::const_iterator m_memoryIter
Definition: ConditionalContainer.h:108
std::integral_constant< ConditionalContainerMode, ConditionalContainerMode::Storage > StorageFlag
Definition: ConditionalContainer.h:62
ConditionalContainerMode m_mode
Definition: ConditionalContainer.h:109
ConditionalContainer()
Creates a memory conditional container with mode.
Definition: ConditionalContainer.h:118
TMemorySet MemorySetType
Definition: ConditionalContainer.h:56
typename is_type_expression< T, Enable >::type is_type_expression_t
true if the expression is valid and evaluates to a type, false otherwise.
Definition: Traits.h:98
A const iterator.
Definition: ConditionalContainer.h:67
size_t size() const
Gets the size of this set.
Definition: ConditionalContainer.h:138
bool operator!=(const ConditionalIterator &rhs) const
Returns true if this iterator is not equal to rhs.
Definition: ConditionalContainer.h:91
void update(const DeltaElements< MemorySetType > &deltas)
Applies all changes in deltas to the underlying container.
Definition: ConditionalContainer.h:159
const auto * operator->() const
Returns a const pointer to the current element.
Definition: ConditionalContainer.h:97
void PruneBaseSet(ConditionalContainer< TKeyTraits, TStorageSet, TMemorySet > &container, const TPruningBoundary &pruningBoundary)
Definition: ConditionalContainer.h:215
std::unique_ptr< MemorySetType > m_pContainer2
Definition: ConditionalContainer.h:177
ConditionalContainer(ConditionalContainerMode mode, TStorageArgs &&... storageArgs)
Definition: ConditionalContainer.h:124
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
Definition: AddressExtractionExtension.cpp:28
Definition: ConditionalContainer.h:31
friend bool IsSetIterable(const ConditionalContainer< TKeyTraits2, TStorageSet2, TMemorySet2 > &set)
void prune(const TPruningBoundary &pruningBoundary)
Optionally prunes underlying container using pruningBoundary.
Definition: ConditionalContainer.h:168
typename TMemorySet ::key_compare key_compare
Definition: ConditionalContainer.h:32
A conditional container that delegates to either a storage or a memory backed container.
Definition: ConditionalContainer.h:53
StorageSetType::const_iterator m_storageIter
Definition: ConditionalContainer.h:107
bool operator==(const ConditionalIterator &rhs) const
Returns true if this iterator is equal to rhs.
Definition: ConditionalContainer.h:86
const auto & operator*() const
Returns a const reference to the current element.
Definition: ConditionalContainer.h:102
typename T::key_equal key_equal
Definition: ConditionalContainer.h:38