CatapultServer  v0.5.0.1 (Elephant)
BlockStorage.h
Go to the documentation of this file.
1 
21 #pragma once
26 #include <memory>
27 
28 namespace catapult { namespace io {
29 
32  public:
33  virtual ~LightBlockStorage() = default;
34 
35  public:
37  virtual Height chainHeight() const = 0;
38 
40  virtual model::HashRange loadHashesFrom(Height height, size_t maxHashes) const = 0;
41 
43  virtual void saveBlock(const model::BlockElement& blockElement) = 0;
44 
46  virtual void dropBlocksAfter(Height height) = 0;
47  };
48 
51  public:
53  virtual std::shared_ptr<const model::Block> loadBlock(Height height) const = 0;
54 
56  virtual std::shared_ptr<const model::BlockElement> loadBlockElement(Height height) const = 0;
57 
59  virtual std::pair<std::vector<uint8_t>, bool> loadBlockStatementData(Height height) const = 0;
60  };
61 
64  public:
66  virtual void purge() = 0;
67  };
68 }}
catapult::io::LightBlockStorage
Minimalistic interface for block storage (does not allow block loading).
Definition: BlockStorage.h:31
catapult::io::BlockStorage::loadBlock
virtual std::shared_ptr< const model::Block > loadBlock(Height height) const =0
Returns the block at height.
catapult::io::BlockStorage::loadBlockStatementData
virtual std::pair< std::vector< uint8_t >, bool > loadBlockStatementData(Height height) const =0
Returns the optional block statement data at height.
catapult::io::BlockStorage::loadBlockElement
virtual std::shared_ptr< const model::BlockElement > loadBlockElement(Height height) const =0
Returns the block element (owning a block) at height.
catapult::io::LightBlockStorage::loadHashesFrom
virtual model::HashRange loadHashesFrom(Height height, size_t maxHashes) const =0
Returns a range of at most maxHashes hashes starting at height.
catapult::io::PrunableBlockStorage
Interface that allows saving, loading and pruning blocks.
Definition: BlockStorage.h:63
catapult::model::EntityRange
Represents a range of entities.
Definition: EntityRange.h:31
Elements.h
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::io::LightBlockStorage::~LightBlockStorage
virtual ~LightBlockStorage()=default
catapult::io::LightBlockStorage::dropBlocksAfter
virtual void dropBlocksAfter(Height height)=0
Drops all blocks after height.
catapult::io::LightBlockStorage::chainHeight
virtual Height chainHeight() const =0
Gets the number of blocks.
EntityInfo.h
catapult::model::BlockElement
Processing element for a block composed of a block and metadata.
Definition: Elements.h:55
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::io::PrunableBlockStorage::purge
virtual void purge()=0
Purges all blocks from storage.
catapult::io::BlockStorage
Interface for saving and loading blocks.
Definition: BlockStorage.h:50
catapult::utils::NonCopyable
A class that can neither be copied nor moved.
Definition: NonCopyable.h:26
RangeTypes.h
NonCopyable.h
catapult::io::LightBlockStorage::saveBlock
virtual void saveBlock(const model::BlockElement &blockElement)=0
Saves blockElement.