CatapultServer
v0.5.0.1 (Elephant)
|
A memory-based block storage that loads and saves blocks in memory. More...
Public Member Functions | |
MemoryBlockStorage (const model::BlockElement &nemesisBlockElement) | |
Creates a memory-based block storage around nemesisBlockElement. More... | |
Height | chainHeight () const override |
Gets the number of blocks. More... | |
model::HashRange | loadHashesFrom (Height height, size_t maxHashes) const override |
Returns a range of at most maxHashes hashes starting at height. More... | |
void | saveBlock (const model::BlockElement &blockElement) override |
Saves blockElement. More... | |
void | dropBlocksAfter (Height height) override |
Drops all blocks after height. More... | |
std::shared_ptr< const model::Block > | loadBlock (Height height) const override |
Returns the block at height. More... | |
std::shared_ptr< const model::BlockElement > | loadBlockElement (Height height) const override |
Returns the block element (owning a block) at height. More... | |
std::pair< std::vector< uint8_t >, bool > | loadBlockStatementData (Height height) const override |
Returns the optional block statement data at height. More... | |
void | purge () override |
Purges all blocks from storage. More... | |
Public Member Functions inherited from catapult::io::LightBlockStorage | |
virtual | ~LightBlockStorage ()=default |
Public Member Functions inherited from catapult::utils::NonCopyable | |
constexpr | NonCopyable ()=default |
Default constructor. More... | |
~NonCopyable ()=default | |
Default destructor. More... | |
NonCopyable (const NonCopyable &)=delete | |
Disabled copy constructor. More... | |
NonCopyable & | operator= (const NonCopyable &)=delete |
Disabled assignment operator. More... | |
Private Types | |
using | Blocks = std::map< Height, std::shared_ptr< model::Block > > |
using | BlockElements = std::map< Height, std::shared_ptr< model::BlockElement > > |
using | BlockStatements = std::map< Height, std::shared_ptr< const model::BlockStatement > > |
Private Member Functions | |
void | requireHeight (Height height, const char *description) const |
Private Attributes | |
Blocks | m_blocks |
BlockElements | m_blockElements |
BlockStatements | m_blockStatements |
Height | m_height |
A memory-based block storage that loads and saves blocks in memory.
|
private |
|
private |
|
private |
|
explicit |
Creates a memory-based block storage around nemesisBlockElement.
|
overridevirtual |
Gets the number of blocks.
Implements catapult::io::LightBlockStorage.
|
overridevirtual |
Drops all blocks after height.
Implements catapult::io::LightBlockStorage.
|
overridevirtual |
Returns the block at height.
Implements catapult::io::BlockStorage.
|
overridevirtual |
Returns the block element (owning a block) at height.
Implements catapult::io::BlockStorage.
|
overridevirtual |
Returns the optional block statement data at height.
Implements catapult::io::BlockStorage.
|
overridevirtual |
Returns a range of at most maxHashes hashes starting at height.
Implements catapult::io::LightBlockStorage.
|
overridevirtual |
Purges all blocks from storage.
Implements catapult::io::PrunableBlockStorage.
|
private |
|
overridevirtual |
Saves blockElement.
Implements catapult::io::LightBlockStorage.
|
private |
|
private |
|
private |
|
private |