CatapultServer  v0.5.0.1 (Elephant)
MosaicBaseSets.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "MosaicCacheSerializers.h"
23 #include "MosaicCacheTypes.h"
27 
28 namespace catapult { namespace cache {
29 
30  using BasicMosaicPatriciaTree = tree::BasePatriciaTree<
31  SerializerHashedKeyEncoder<MosaicCacheDescriptor::Serializer>,
32  PatriciaTreeRdbDataSource,
34 
36  public:
39  };
40 
44  std::shared_ptr<MosaicPatriciaTree::DeltaType> pPatriciaTree;
45  };
46 
48  public:
50  using IsOrderedSet = std::false_type;
51 
52  public:
53  explicit MosaicBaseSets(const CacheConfiguration& config)
54  : CacheDatabaseMixin(config, { "default", "height_grouping" })
55  , Primary(GetContainerMode(config), database(), 0)
58  {}
59 
60  public:
64 
65  public:
67  return { Primary.rebase(), HeightGrouping.rebase(), PatriciaTree.rebase() };
68  }
69 
71  return {
74  PatriciaTree.rebaseDetached()
75  };
76  }
77 
78  void commit() {
79  Primary.commit();
81  PatriciaTree.commit();
82  flush();
83  }
84  };
85 }}
catapult::cache::MosaicBaseSets
Definition: MosaicBaseSets.h:47
catapult::validators::DEFINE_STATEFUL_VALIDATOR
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto &notification, 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;})
catapult::cache::MosaicBaseSets::HeightGrouping
MosaicCacheTypes::HeightGroupingTypes::BaseSetType HeightGrouping
Definition: MosaicBaseSets.h:62
MosaicCacheTypes.h
catapult::deltaset::BaseSet::commit
void commit(TArgs &&... args)
Definition: BaseSet.h:114
CachePatriciaTree.h
catapult::cache::CacheDatabaseMixin::hasPatriciaTreeSupport
bool hasPatriciaTreeSupport() const
Returns true if patricia tree support is enabled.
Definition: CacheDatabaseMixin.h:50
catapult::cache::MosaicBaseSets::MosaicBaseSets
MosaicBaseSets(const CacheConfiguration &config)
Definition: MosaicBaseSets.h:53
catapult::Amount
utils::BaseValue< uint64_t, Amount_tag > Amount
Definition: src/catapult/types.h:76
ValidatorContext.h
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::cache::MosaicBaseSetDeltaPointers::pPatriciaTree
std::shared_ptr< MosaicPatriciaTree::DeltaType > pPatriciaTree
Definition: MosaicBaseSets.h:44
catapult::model::First_Optional_Property
constexpr size_t First_Optional_Property
Index of first optional property.
Definition: MosaicProperty.h:84
catapult::cache::MosaicCacheDescriptor::Serializer
MosaicEntryPrimarySerializer Serializer
Definition: MosaicCacheTypes.h:63
catapult::tree::BasePatriciaTree
A base patricia tree.
Definition: BasePatriciaTree.h:30
catapult::cache::CacheDatabaseMixin::GetContainerMode
static deltaset::ConditionalContainerMode GetContainerMode(const CacheConfiguration &config)
Gets the container mode specified by config.
Definition: CacheDatabaseMixin.h:61
catapult::deltaset::BaseSet::rebaseDetached
std::shared_ptr< DeltaType > rebaseDetached() const
Definition: BaseSet.h:106
catapult::cache::MosaicEntryPrimarySerializer
Primary serializer for mosaic cache.
Definition: MosaicCacheSerializers.h:30
catapult::cache::MosaicBaseSets::Primary
MosaicCacheTypes::PrimaryTypes::BaseSetType Primary
Definition: MosaicBaseSets.h:61
catapult::cache::CacheDatabaseMixin
Mixin that owns a cache database.
Definition: CacheDatabaseMixin.h:30
Value
uint32_t Value
Definition: BlockScorer.cpp:32
catapult::cache::MosaicBaseSets::commit
void commit()
Definition: MosaicBaseSets.h:78
MosaicCache.h
BasePatriciaTree.h
catapult::cache::MosaicBaseSetDeltaPointers::pHeightGrouping
MosaicCacheTypes::HeightGroupingTypes::BaseSetDeltaPointerType pHeightGrouping
Definition: MosaicBaseSets.h:43
catapult::cache::BasicMosaicPatriciaTree
tree::BasePatriciaTree< SerializerHashedKeyEncoder< MosaicCacheDescriptor::Serializer >, PatriciaTreeRdbDataSource, utils::BaseValueHasher< MosaicId > > BasicMosaicPatriciaTree
Definition: MosaicBaseSets.h:33
catapult::utils::BaseValueHasher
Hasher object for a base value.
Definition: Hashers.h:43
catapult::cache::MosaicBaseSetDeltaPointers
Definition: MosaicBaseSets.h:41
catapult::cache::MosaicBaseSets::IsOrderedSet
std::false_type IsOrderedSet
Indicates the set is not ordered.
Definition: MosaicBaseSets.h:50
catapult::deltaset::BaseSet
Definition: BaseSet.h:52
catapult::cache::MosaicPatriciaTree
Definition: MosaicBaseSets.h:35
catapult::deltaset::BaseSet::rebase
std::shared_ptr< DeltaType > rebase()
Returns a delta based on the same original elements as this set.
Definition: BaseSet.h:95
AccountStateCache.h
catapult::cache::MosaicBaseSets::PatriciaTree
CachePatriciaTree< MosaicPatriciaTree > PatriciaTree
Definition: MosaicBaseSets.h:63
catapult::cache::CacheDatabaseMixin::database
CacheDatabase & database()
Gets the database.
Definition: CacheDatabaseMixin.h:55
catapult::cache::CacheConfiguration
Cache configuration.
Definition: CacheConfiguration.h:37
catapult::validators::ValidationResult::Success
Validation succeeded.
PatriciaTreeEncoderAdapters.h
catapult::cache::detail::UnorderedMapAdapter::BaseSetDeltaPointerType
std::shared_ptr< BaseSetDeltaType > BaseSetDeltaPointerType
Base set delta pointer type.
Definition: CacheDescriptorAdapters.h:87
MosaicCacheSerializers.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::cache::MosaicBaseSetDeltaPointers::pPrimary
MosaicCacheTypes::PrimaryTypes::BaseSetDeltaPointerType pPrimary
Definition: MosaicBaseSets.h:42
catapult::cache::MosaicBaseSets::rebase
MosaicBaseSetDeltaPointers rebase()
Definition: MosaicBaseSets.h:66
catapult::cache::MosaicBaseSets::rebaseDetached
MosaicBaseSetDeltaPointers rebaseDetached() const
Definition: MosaicBaseSets.h:70
catapult::cache::CacheDatabaseMixin::flush
void flush()
Flushes the database.
Definition: CacheDatabaseMixin.h:68
catapult::cache::CachePatriciaTree
A wrapper around a patricia tree used by caches.
Definition: CachePatriciaTree.h:30
Validators.h