CatapultServer  v0.5.0.1 (Elephant)
AccountStateBaseSets.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "AccountStateCacheTypes.h"
27 
28 namespace catapult { namespace cache {
29 
30  using BasicAccountStatePatriciaTree = tree::BasePatriciaTree<
31  SerializerHashedKeyEncoder<AccountStatePatriciaTreeSerializer>,
32  PatriciaTreeRdbDataSource,
34 
36  public:
39  };
40 
44  std::shared_ptr<AccountStatePatriciaTree::DeltaType> pPatriciaTree;
45  };
46 
48  public:
50  using IsOrderedSet = std::false_type;
51 
52  public:
53  explicit AccountStateBaseSets(const CacheConfiguration& config)
54  : CacheDatabaseMixin(config, { "default", "key_lookup" })
55  , Primary(GetContainerMode(config), database(), 0)
56  , KeyLookupMap(GetContainerMode(config), database(), 1)
58  {}
59 
60  public:
64 
65  public:
67  return { Primary.rebase(), KeyLookupMap.rebase(), PatriciaTree.rebase() };
68  }
69 
71  return { Primary.rebaseDetached(), KeyLookupMap.rebaseDetached(), PatriciaTree.rebaseDetached() };
72  }
73 
74  void commit() {
75  Primary.commit();
77  PatriciaTree.commit();
78  flush();
79  }
80  };
81 }}
catapult::cache::AccountStateBaseSets::Primary
AccountStateCacheTypes::PrimaryTypes::BaseSetType Primary
Definition: AccountStateBaseSets.h:61
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::AccountStateBaseSets::rebaseDetached
AccountStateBaseSetDeltaPointers rebaseDetached() const
Definition: AccountStateBaseSets.h:70
catapult::tree::BasePatriciaTree
A base patricia tree.
Definition: BasePatriciaTree.h:30
catapult::cache::AccountStateBaseSets::commit
void commit()
Definition: AccountStateBaseSets.h:74
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::CacheDatabaseMixin
Mixin that owns a cache database.
Definition: CacheDatabaseMixin.h:30
catapult::cache::AccountStateBaseSetDeltaPointers
Definition: AccountStateBaseSets.h:41
catapult::cache::AccountStateBaseSets::rebase
AccountStateBaseSetDeltaPointers rebase()
Definition: AccountStateBaseSets.h:66
BasePatriciaTree.h
catapult::cache::AccountStatePatriciaTreeSerializer
Definition: AccountStateCacheSerializers.h:33
catapult::cache::AccountStateBaseSets::PatriciaTree
CachePatriciaTree< AccountStatePatriciaTree > PatriciaTree
Definition: AccountStateBaseSets.h:63
catapult::cache::BasicAccountStatePatriciaTree
tree::BasePatriciaTree< SerializerHashedKeyEncoder< AccountStatePatriciaTreeSerializer >, PatriciaTreeRdbDataSource, utils::ArrayHasher< Address > > BasicAccountStatePatriciaTree
Definition: AccountStateBaseSets.h:33
catapult::cache::AccountStateBaseSets::IsOrderedSet
std::false_type IsOrderedSet
Indicates the set is not ordered.
Definition: AccountStateBaseSets.h:50
catapult::deltaset::BaseSet
Definition: BaseSet.h:52
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::cache::AccountStatePatriciaTree
Definition: AccountStateBaseSets.h:35
PatriciaTreeEncoderAdapters.h
catapult::cache::AccountStateBaseSets
Definition: AccountStateBaseSets.h:47
AccountStateCacheSerializers.h
catapult::cache::detail::UnorderedMapAdapter::BaseSetDeltaPointerType
std::shared_ptr< BaseSetDeltaType > BaseSetDeltaPointerType
Base set delta pointer type.
Definition: CacheDescriptorAdapters.h:87
catapult::cache::AccountStateBaseSets::AccountStateBaseSets
AccountStateBaseSets(const CacheConfiguration &config)
Definition: AccountStateBaseSets.h:53
catapult
Definition: AddressExtractionExtension.cpp:28
AccountStateCacheTypes.h
catapult::cache::AccountStateBaseSetDeltaPointers::pPatriciaTree
std::shared_ptr< AccountStatePatriciaTree::DeltaType > pPatriciaTree
Definition: AccountStateBaseSets.h:44
catapult::cache::AccountStateBaseSets::KeyLookupMap
AccountStateCacheTypes::KeyLookupMapTypes::BaseSetType KeyLookupMap
Definition: AccountStateBaseSets.h:62
catapult::cache::CacheDatabaseMixin::flush
void flush()
Flushes the database.
Definition: CacheDatabaseMixin.h:68
catapult::cache::AccountStateBaseSetDeltaPointers::pPrimary
AccountStateCacheTypes::PrimaryTypes::BaseSetDeltaPointerType pPrimary
Definition: AccountStateBaseSets.h:42
catapult::cache::CachePatriciaTree
A wrapper around a patricia tree used by caches.
Definition: CachePatriciaTree.h:30
catapult::cache::AccountStateBaseSetDeltaPointers::pKeyLookupMap
AccountStateCacheTypes::KeyLookupMapTypes::BaseSetDeltaPointerType pKeyLookupMap
Definition: AccountStateBaseSets.h:43
catapult::utils::ArrayHasher
Definition: Hashers.h:32