CatapultServer  v0.5.0.1 (Elephant)
NamespaceBaseSets.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "NamespaceCacheTypes.h"
27 
28 namespace catapult { namespace cache {
29 
30  using BasicNamespacePatriciaTree = tree::BasePatriciaTree<
31  SerializerHashedKeyEncoder<RootNamespaceHistoryPatriciaTreeSerializer>,
32  PatriciaTreeRdbDataSource,
34 
36  public:
39  };
40 
45  std::shared_ptr<NamespacePatriciaTree::DeltaType> pPatriciaTree;
46  };
47 
49  public:
51  using IsOrderedSet = std::false_type;
52 
53  public:
54  explicit NamespaceBaseSets(const CacheConfiguration& config)
55  : CacheDatabaseMixin(config, { "default", "flat_map", "height_grouping" })
56  , Primary(GetContainerMode(config), database(), 0)
57  , FlatMap(GetContainerMode(config), database(), 1)
60  {}
61 
62  public:
67 
68  public:
70  return { Primary.rebase(), FlatMap.rebase(), HeightGrouping.rebase(), PatriciaTree.rebase() };
71  }
72 
74  return {
78  PatriciaTree.rebaseDetached()
79  };
80  }
81 
82  void commit() {
83  Primary.commit();
84  FlatMap.commit();
86  PatriciaTree.commit();
87  flush();
88  }
89  };
90 }}
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::NamespaceBaseSetDeltaPointers
Definition: NamespaceBaseSets.h:41
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
NamespaceCache.h
ValidatorContext.h
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
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
NamespaceCacheSerializers.h
catapult::cache::CacheDatabaseMixin
Mixin that owns a cache database.
Definition: CacheDatabaseMixin.h:30
catapult::Eternal_Artifact_Duration
constexpr BlockDuration Eternal_Artifact_Duration(0)
Duration of eternal artifact.
catapult::cache::NamespaceBaseSets
Definition: NamespaceBaseSets.h:48
catapult::cache::NamespaceBaseSetDeltaPointers::pPatriciaTree
std::shared_ptr< NamespacePatriciaTree::DeltaType > pPatriciaTree
Definition: NamespaceBaseSets.h:45
BasePatriciaTree.h
catapult::cache::NamespaceBaseSets::PatriciaTree
CachePatriciaTree< NamespacePatriciaTree > PatriciaTree
Definition: NamespaceBaseSets.h:66
NamespaceCacheTypes.h
catapult::cache::NamespaceBaseSets::NamespaceBaseSets
NamespaceBaseSets(const CacheConfiguration &config)
Definition: NamespaceBaseSets.h:54
catapult::utils::BaseValueHasher
Hasher object for a base value.
Definition: Hashers.h:43
catapult::cache::NamespaceBaseSets::rebase
NamespaceBaseSetDeltaPointers rebase()
Definition: NamespaceBaseSets.h:69
catapult::cache::NamespaceBaseSets::FlatMap
NamespaceCacheTypes::FlatMapTypes::BaseSetType FlatMap
Definition: NamespaceBaseSets.h:64
catapult::cache::NamespaceBaseSetDeltaPointers::pPrimary
NamespaceCacheTypes::PrimaryTypes::BaseSetDeltaPointerType pPrimary
Definition: NamespaceBaseSets.h:42
constants.h
Validators.h
catapult::cache::NamespaceBaseSets::IsOrderedSet
std::false_type IsOrderedSet
Indicates the set is not ordered.
Definition: NamespaceBaseSets.h:51
catapult::cache::NamespacePatriciaTree
Definition: NamespaceBaseSets.h:35
catapult::deltaset::BaseSet
Definition: BaseSet.h:52
catapult::cache::NamespaceBaseSets::rebaseDetached
NamespaceBaseSetDeltaPointers rebaseDetached() const
Definition: NamespaceBaseSets.h:73
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
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::NamespaceBaseSets::commit
void commit()
Definition: NamespaceBaseSets.h:82
catapult::cache::detail::UnorderedMapAdapter::BaseSetDeltaPointerType
std::shared_ptr< BaseSetDeltaType > BaseSetDeltaPointerType
Base set delta pointer type.
Definition: CacheDescriptorAdapters.h:87
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::cache::NamespaceBaseSets::HeightGrouping
NamespaceCacheTypes::HeightGroupingTypes::BaseSetType HeightGrouping
Definition: NamespaceBaseSets.h:65
catapult::cache::RootNamespaceHistoryPatriciaTreeSerializer
Definition: NamespaceCacheSerializers.h:36
catapult::cache::NamespaceBaseSets::Primary
NamespaceCacheTypes::PrimaryTypes::BaseSetType Primary
Definition: NamespaceBaseSets.h:63
catapult::cache::CacheDatabaseMixin::flush
void flush()
Flushes the database.
Definition: CacheDatabaseMixin.h:68
catapult::cache::NamespaceBaseSetDeltaPointers::pFlatMap
NamespaceCacheTypes::FlatMapTypes::BaseSetDeltaPointerType pFlatMap
Definition: NamespaceBaseSets.h:43
catapult::cache::BasicNamespacePatriciaTree
tree::BasePatriciaTree< SerializerHashedKeyEncoder< RootNamespaceHistoryPatriciaTreeSerializer >, PatriciaTreeRdbDataSource, utils::BaseValueHasher< NamespaceId > > BasicNamespacePatriciaTree
Definition: NamespaceBaseSets.h:33
catapult::cache::CachePatriciaTree
A wrapper around a patricia tree used by caches.
Definition: CachePatriciaTree.h:30
catapult::cache::NamespaceBaseSetDeltaPointers::pHeightGrouping
NamespaceCacheTypes::HeightGroupingTypes::BaseSetDeltaPointerType pHeightGrouping
Definition: NamespaceBaseSets.h:44