CatapultServer
v0.5.0.1 (Elephant)
CatapultCacheDelta.h
Go to the documentation of this file.
1
21
#pragma once
22
#include "
StateHashInfo.h
"
23
#include "
SubCachePlugin.h
"
24
#include <memory>
25
26
namespace
catapult
{
namespace
cache {
class
ReadOnlyCatapultCache; } }
27
28
namespace
catapult
{
namespace
cache {
29
31
class
CatapultCacheDelta
{
32
public
:
34
explicit
CatapultCacheDelta
(std::vector<std::unique_ptr<SubCacheView>>&& subViews);
35
37
~CatapultCacheDelta
();
38
39
public
:
40
// make this class move only (the definitions are in the source file in order to allow forward declarations)
41
CatapultCacheDelta
(
CatapultCacheDelta
&&);
42
CatapultCacheDelta
&
operator=
(
CatapultCacheDelta
&&);
43
44
public
:
46
template
<
typename
TCache>
47
const
typename
TCache::CacheDeltaType&
sub
()
const
{
48
return
*static_cast<const typename TCache::CacheDeltaType*>(
m_subViews
[
TCache::Id
]->get());
49
}
50
52
template
<
typename
TCache>
53
typename
TCache::CacheDeltaType&
sub
() {
54
return
*static_cast<typename TCache::CacheDeltaType*>(
m_subViews
[
TCache::Id
]->get());
55
}
56
57
public
:
59
StateHashInfo
calculateStateHash
(
Height
height)
const
;
60
62
void
setSubCacheMerkleRoots
(
const
std::vector<Hash256>& subCacheMerkleRoots);
63
64
public
:
66
ReadOnlyCatapultCache
toReadOnly
()
const
;
67
68
private
:
69
std::vector<std::unique_ptr<SubCacheView>>
m_subViews
;
70
};
71
}}
StateHashInfo.h
catapult::cache::CatapultCacheDelta::sub
const TCache::CacheDeltaType & sub() const
Gets a specific sub cache delta view.
Definition:
CatapultCacheDelta.h:47
catapult::cache::CatapultCacheDelta
Delta on top of a catapult cache.
Definition:
CatapultCacheDelta.h:31
Id
NamespaceId Id
Definition:
RootNamespaceHistorySerializer.cpp:100
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::cache::StateHashInfo
Information about a cache state hash.
Definition:
StateHashInfo.h:28
catapult::cache::CatapultCacheDelta::~CatapultCacheDelta
~CatapultCacheDelta()
Destroys the delta.
catapult::cache::CatapultCacheDelta::sub
TCache::CacheDeltaType & sub()
Gets a specific sub cache delta view.
Definition:
CatapultCacheDelta.h:53
catapult::cache::CatapultCacheDelta::operator=
CatapultCacheDelta & operator=(CatapultCacheDelta &&)
catapult::cache::CatapultCacheDelta::calculateStateHash
StateHashInfo calculateStateHash(Height height) const
Calculates the cache state hash given height.
Definition:
CatapultCache.cpp:130
catapult::cache::CatapultCacheDelta::toReadOnly
ReadOnlyCatapultCache toReadOnly() const
Creates a read-only view of this delta.
Definition:
CatapultCache.cpp:155
catapult::cache::CatapultCacheDelta::m_subViews
std::vector< std::unique_ptr< SubCacheView > > m_subViews
Definition:
CatapultCacheDelta.h:69
SubCachePlugin.h
catapult
Definition:
AddressExtractionExtension.cpp:28
catapult::cache::CatapultCacheDelta::CatapultCacheDelta
CatapultCacheDelta(std::vector< std::unique_ptr< SubCacheView >> &&subViews)
Creates a locked catapult cache delta from subViews.
Definition:
CatapultCache.cpp:120
catapult::cache::CatapultCacheDelta::setSubCacheMerkleRoots
void setSubCacheMerkleRoots(const std::vector< Hash256 > &subCacheMerkleRoots)
Sets the merkle roots for all sub caches (subCacheMerkleRoots).
Definition:
CatapultCache.cpp:134
catapult::cache::ReadOnlyCatapultCache
A read-only overlay on top of a catapult cache.
Definition:
ReadOnlyCatapultCache.h:27
catapult-server
src
catapult
cache
CatapultCacheDelta.h
Generated by
1.8.16