CatapultServer  v0.5.0.1 (Elephant)
LocalNodeStateFileStorage.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "catapult/types.h"
24 
25 namespace catapult {
26  namespace cache {
27  class CacheStorage;
28  class CatapultCache;
29  class CatapultCacheDelta;
30  struct SupplementalData;
31  }
32  namespace config { struct NodeConfiguration; }
33  namespace extensions { struct LocalNodeStateRef; }
34  namespace model { class ChainScore; }
35  namespace plugins { class PluginManager; }
36  namespace state { struct CatapultState; }
37 }
38 
39 namespace catapult { namespace extensions {
40 
42  struct StateHeights {
45 
48  };
49 
51  bool HasSerializedState(const config::CatapultDirectory& directory);
52 
55  const config::CatapultDirectory& directory,
56  const LocalNodeStateRef& stateRef,
57  const plugins::PluginManager& pluginManager);
58 
61  public:
63  explicit LocalNodeStateSerializer(const config::CatapultDirectory& directory);
64 
65  public:
67  void save(const cache::CatapultCache& cache, const state::CatapultState& state, const model::ChainScore& score) const;
68 
70  void save(
71  const cache::CatapultCacheDelta& cacheDelta,
72  const std::vector<std::unique_ptr<const cache::CacheStorage>>& cacheStorages,
73  const state::CatapultState& state,
74  const model::ChainScore& score,
75  Height height) const;
76 
78  void moveTo(const config::CatapultDirectory& destinationDirectory);
79 
80  private:
82  };
83 
86  const config::CatapultDataDirectory& dataDirectory,
87  const config::NodeConfiguration& nodeConfig,
88  const cache::CatapultCache& cache,
89  const state::CatapultState& state,
90  const model::ChainScore& score);
91 }}
catapult::extensions::StateHeights::Storage
Height Storage
Storage height.
Definition: LocalNodeStateFileStorage.h:47
CacheStorage.h
catapult::extensions::LocalNodeStateSerializer::m_directory
config::CatapultDirectory m_directory
Definition: LocalNodeStateFileStorage.h:81
catapult::config::CatapultDataDirectory
Catapult data directory.
Definition: CatapultDataDirectory.h:61
catapult::extensions::LocalNodeStateSerializer::save
void save(const cache::CatapultCache &cache, const state::CatapultState &state, const model::ChainScore &score) const
Saves state composed of cache, state and score.
Definition: LocalNodeStateFileStorage.cpp:153
catapult::cache::CatapultCacheDelta
Delta on top of a catapult cache.
Definition: CatapultCacheDelta.h:31
catapult::extensions::LocalNodeStateRef
A reference to a local node's basic state.
Definition: LocalNodeStateRef.h:34
catapult::config::NodeConfiguration
Node configuration settings.
Definition: NodeConfiguration.h:33
catapult::plugins::PluginManager
A manager for registering plugins.
Definition: PluginManager.h:51
catapult::extensions::SaveStateToDirectoryWithCheckpointing
void SaveStateToDirectoryWithCheckpointing(const config::CatapultDataDirectory &dataDirectory, const config::NodeConfiguration &nodeConfig, const cache::CatapultCache &cache, const state::CatapultState &state, const model::ChainScore &score)
Serializes state composed of cache, state and score with checkpointing to dataDirectory given nodeCon...
Definition: LocalNodeStateFileStorage.cpp:192
SupplementalDataStorage.h
CatapultDataDirectory.h
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::model::ChainScore
Definition: ChainScore.h:30
catapult::extensions::StateHeights
Information about state heights.
Definition: LocalNodeStateFileStorage.h:42
IndexFile.h
catapult::config::CatapultDirectory
Catapult directory.
Definition: CatapultDataDirectory.h:30
BufferedFileStream.h
catapult::extensions::LoadStateFromDirectory
StateHeights LoadStateFromDirectory(const config::CatapultDirectory &directory, const LocalNodeStateRef &stateRef, const plugins::PluginManager &pluginManager)
Loads catapult state into stateRef from directory given pluginManager.
Definition: LocalNodeStateFileStorage.cpp:96
NodeConfiguration.h
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::state::CatapultState
Stateful catapult information.
Definition: CatapultState.h:27
catapult::extensions::StateHeights::Cache
Height Cache
Cache height.
Definition: LocalNodeStateFileStorage.h:44
StackLogger.h
CatapultCache.h
catapult::extensions::HasSerializedState
bool HasSerializedState(const config::CatapultDirectory &directory)
Returns true if serialized state is present in directory.
Definition: LocalNodeStateFileStorage.cpp:55
LocalNodeStateRef.h
catapult::extensions::LocalNodeStateSerializer::LocalNodeStateSerializer
LocalNodeStateSerializer(const config::CatapultDirectory &directory)
Creates a serializer around specified directory.
Definition: LocalNodeStateFileStorage.cpp:150
types.h
PluginManager.h
ChainScore
model::ChainScore ChainScore
Definition: tools/health/main.cpp:43
catapult::extensions::LocalNodeStateSerializer::moveTo
void moveTo(const config::CatapultDirectory &destinationDirectory)
Moves serialized state to destinationDirectory.
Definition: LocalNodeStateFileStorage.cpp:176
catapult
Definition: AddressExtractionExtension.cpp:28
NemesisBlockLoader.h
LocalNodeChainScore.h
BlockChainSyncHandlers.h
LocalNodeStateFileStorage.h
catapult::extensions::LocalNodeStateSerializer
Serializes local node state.
Definition: LocalNodeStateFileStorage.h:60
BlockStorageCache.h
FilesystemUtils.h