CatapultServer  v0.5.0.1 (Elephant)
catapult::io::FileBlockStorage Class Referencefinal

File-based block storage. More...

Inheritance diagram for catapult::io::FileBlockStorage:
Collaboration diagram for catapult::io::FileBlockStorage:

Classes

class  HashFile
 

Public Member Functions

 FileBlockStorage (const std::string &dataDirectory, FileBlockStorageMode mode=FileBlockStorageMode::Hash_Index)
 
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::BlockloadBlock (Height height) const override
 Returns the block at height. More...
 
std::shared_ptr< const model::BlockElementloadBlockElement (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...
 
NonCopyableoperator= (const NonCopyable &)=delete
 Disabled assignment operator. More...
 

Private Member Functions

void requireHeight (Height height, const char *description) const
 

Private Attributes

std::string m_dataDirectory
 
FileBlockStorageMode m_mode
 
HashFile m_hashFile
 
IndexFile m_indexFile
 

Detailed Description

File-based block storage.

Constructor & Destructor Documentation

◆ FileBlockStorage()

catapult::io::FileBlockStorage::FileBlockStorage ( const std::string &  dataDirectory,
FileBlockStorageMode  mode = FileBlockStorageMode::Hash_Index 
)
explicit

Creates a file-based block storage, where blocks will be stored inside dataDirectory with specified storage mode.

Member Function Documentation

◆ chainHeight()

Height catapult::io::FileBlockStorage::chainHeight ( ) const
overridevirtual

Gets the number of blocks.

Implements catapult::io::LightBlockStorage.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dropBlocksAfter()

void catapult::io::FileBlockStorage::dropBlocksAfter ( Height  height)
overridevirtual

Drops all blocks after height.

Implements catapult::io::LightBlockStorage.

Here is the call graph for this function:

◆ loadBlock()

std::shared_ptr< const model::Block > catapult::io::FileBlockStorage::loadBlock ( Height  height) const
overridevirtual

Returns the block at height.

Implements catapult::io::BlockStorage.

Here is the call graph for this function:

◆ loadBlockElement()

std::shared_ptr< const model::BlockElement > catapult::io::FileBlockStorage::loadBlockElement ( Height  height) const
overridevirtual

Returns the block element (owning a block) at height.

Implements catapult::io::BlockStorage.

Here is the call graph for this function:

◆ loadBlockStatementData()

std::pair< std::vector< uint8_t >, bool > catapult::io::FileBlockStorage::loadBlockStatementData ( Height  height) const
overridevirtual

Returns the optional block statement data at height.

Implements catapult::io::BlockStorage.

Here is the call graph for this function:

◆ loadHashesFrom()

model::HashRange catapult::io::FileBlockStorage::loadHashesFrom ( Height  height,
size_t  maxHashes 
) const
overridevirtual

Returns a range of at most maxHashes hashes starting at height.

Implements catapult::io::LightBlockStorage.

Here is the call graph for this function:

◆ purge()

void catapult::io::FileBlockStorage::purge ( )
overridevirtual

Purges all blocks from storage.

Implements catapult::io::PrunableBlockStorage.

Here is the call graph for this function:

◆ requireHeight()

void catapult::io::FileBlockStorage::requireHeight ( Height  height,
const char *  description 
) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveBlock()

void catapult::io::FileBlockStorage::saveBlock ( const model::BlockElement blockElement)
overridevirtual

Saves blockElement.

Implements catapult::io::LightBlockStorage.

Here is the call graph for this function:

Member Data Documentation

◆ m_dataDirectory

std::string catapult::io::FileBlockStorage::m_dataDirectory
private

◆ m_hashFile

HashFile catapult::io::FileBlockStorage::m_hashFile
private

◆ m_indexFile

IndexFile catapult::io::FileBlockStorage::m_indexFile
private

◆ m_mode

FileBlockStorageMode catapult::io::FileBlockStorage::m_mode
private

The documentation for this class was generated from the following files: