CatapultServer  v0.5.0.1 (Elephant)
catapult::io Namespace Reference

Classes

class  BlockChangeSubscriber
 Block change subscriber. More...
 
class  BlockStorage
 Interface for saving and loading blocks. More...
 
class  BlockStorageCache
 
class  BlockStorageModifier
 A write only view on top of block storage. More...
 
class  BlockStorageView
 A read only view on top of block storage. More...
 
class  BufferedInputFileStream
 Provides a buffered input stream around raw file. More...
 
class  BufferedOutputFileStream
 Provides a buffered output stream around raw file. More...
 
class  BufferInputStreamAdapter
 Adapt a typed buffer to be used as an input stream. More...
 
struct  CachedData
 
class  FileBlockStorage
 File-based block storage. More...
 
class  FileLock
 Lock based on an underlying lock file. More...
 
class  FileQueueReader
 File based queue reader where each message is represented by a file (with incrementing names) in a directory. More...
 
class  FileQueueWriter
 
class  IndexFile
 Index file containing a uint64_t value. More...
 
class  InputStream
 Reader interface. More...
 
class  LightBlockStorage
 Minimalistic interface for block storage (does not allow block loading). More...
 
class  OutputStream
 Writer interface. More...
 
class  PrunableBlockStorage
 Interface that allows saving, loading and pruning blocks. More...
 
class  RawFile
 Wrapper for low-level i/o operations on files. More...
 
struct  SizeCalculatingOutputStream
 Stream implementation for calculating the stream size. More...
 
class  StringOutputStream
 String output stream. More...
 

Typedefs

using FdType = FileLock::FdType
 

Enumerations

enum  FileBlockStorageMode { FileBlockStorageMode::Hash_Index, FileBlockStorageMode::None }
 File block storage modes. More...
 
enum  OpenMode { OpenMode::Read_Only, OpenMode::Read_Write, OpenMode::Read_Append }
 Defines mode of opening the file. More...
 
enum  LockMode { LockMode::None, LockMode::File }
 Defines locking mode for the file. More...
 

Functions

std::unique_ptr< BlockStorageCreateAggregateBlockStorage (std::unique_ptr< BlockStorage > &&pStorage, std::unique_ptr< BlockChangeSubscriber > &&pBlockChangeSubscriber)
 Creates an aggregate block storage that delegates to pStorage and publishes block changes to pBlockChangeSubscriber. More...
 
void WriteBlockElement (const model::BlockElement &blockElement, OutputStream &outputStream)
 Writes blockElement into outputStream. More...
 
std::shared_ptr< model::BlockElementReadBlockElement (InputStream &inputStream)
 
void WriteBlockStatement (const model::BlockStatement &blockStatement, OutputStream &outputStream)
 Writes blockStatement into outputStream. More...
 
void ReadBlockStatement (InputStream &inputStream, model::BlockStatement &blockStatement)
 Reads block statement from inputStream into blockStatement. More...
 
std::unique_ptr< BlockChangeSubscriberCreateBlockStorageChangeSubscriber (std::unique_ptr< LightBlockStorage > &&pStorage)
 Creates a block change subscriber around a block storage (pStorage). More...
 
template<typename TIo >
void WriteEntity (TIo &output, const model::SizePrefixedEntity &entity)
 Writes size prefixed entity into output. More...
 
template<typename TEntity , typename TIo >
std::unique_ptr< TEntity > ReadEntity (TIo &input)
 Reads size prefixed entity from input. More...
 
void PurgeDirectory (const std::string &directory)
 Deletes everything in directory but does not delete the directory itself. More...
 
void MoveBlockFiles (PrunableBlockStorage &sourceStorage, BlockStorage &destinationStorage, Height startHeight)
 Moves block files starting at startHeight from sourceStorage to destinationStorage. More...
 
template<typename TIo , typename TValue , typename TTag , typename TBaseValue >
void Write (TIo &output, const utils::BasicBaseValue< TValue, TTag, TBaseValue > &value)
 Writes base value into output. More...
 
template<typename TIo >
void Write64 (TIo &output, uint64_t value)
 Writes value into output. More...
 
template<typename TIo >
void Write32 (TIo &output, uint32_t value)
 Writes value into output. More...
 
template<typename TIo >
void Write16 (TIo &output, uint16_t value)
 Writes value into output. More...
 
template<typename TIo >
void Write8 (TIo &output, uint8_t value)
 Writes value into output. More...
 
template<typename TIo , typename TValue , typename TTag , typename TBaseValue >
void Read (TIo &input, utils::BasicBaseValue< TValue, TTag, TBaseValue > &value)
 Reads base value from input. More...
 
template<typename TIo >
auto Read64 (TIo &input)
 Reads value from input. More...
 
template<typename TIo >
auto Read32 (TIo &input)
 Reads value from input. More...
 
template<typename TIo >
auto Read16 (TIo &input)
 Reads value from input. More...
 
template<typename TIo >
auto Read8 (TIo &input)
 Reads value from input. More...
 
template<typename TValue , typename TIo , typename X = std::enable_if_t<utils::traits::is_pod_v<TValue>>>
TValue Read (TIo &input)
 Reads data of type TValue from input. More...
 
void WriteTransactionInfo (const model::TransactionInfo &transactionInfo, OutputStream &outputStream)
 Writes transactionInfo into outputStream. More...
 
void ReadTransactionInfo (InputStream &inputStream, model::TransactionInfo &transactionInfo)
 Reads transaction info from inputStream into transactionInfo. More...
 
void WriteTransactionInfos (const model::TransactionInfosSet &transactionInfos, OutputStream &outputStream)
 Writes transactionInfos into outputStream. More...
 
void ReadTransactionInfos (InputStream &inputStream, model::TransactionInfosSet &transactionInfos)
 Reads transaction infos from inputStream into transactionInfos. More...
 

Variables

constexpr size_t Default_Stream_Buffer_Size = 4096
 Default stream buffer size. More...
 

Typedef Documentation

◆ FdType

Enumeration Type Documentation

◆ FileBlockStorageMode

File block storage modes.

Enumerator
Hash_Index 

Maintain hash-based index.

None 

None.

◆ LockMode

Defines locking mode for the file.

Enumerator
None 

Don't use any locking.

File 

Use file-based locking.

◆ OpenMode

Defines mode of opening the file.

Enumerator
Read_Only 

Open file in read-only mode.

Read_Write 

Open file for both reading and writing. Removes the file if it exists.

Read_Append 

Open file for both reading and writing.

Function Documentation

◆ CreateAggregateBlockStorage()

std::unique_ptr< BlockStorage > catapult::io::CreateAggregateBlockStorage ( std::unique_ptr< BlockStorage > &&  pStorage,
std::unique_ptr< BlockChangeSubscriber > &&  pBlockChangeSubscriber 
)

Creates an aggregate block storage that delegates to pStorage and publishes block changes to pBlockChangeSubscriber.

Here is the caller graph for this function:

◆ CreateBlockStorageChangeSubscriber()

std::unique_ptr< BlockChangeSubscriber > catapult::io::CreateBlockStorageChangeSubscriber ( std::unique_ptr< LightBlockStorage > &&  pStorage)

Creates a block change subscriber around a block storage (pStorage).

◆ MoveBlockFiles()

void catapult::io::MoveBlockFiles ( PrunableBlockStorage sourceStorage,
BlockStorage destinationStorage,
Height  startHeight 
)

Moves block files starting at startHeight from sourceStorage to destinationStorage.

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

◆ PurgeDirectory()

void catapult::io::PurgeDirectory ( const std::string &  directory)

Deletes everything in directory but does not delete the directory itself.

Here is the caller graph for this function:

◆ Read() [1/2]

template<typename TValue , typename TIo , typename X = std::enable_if_t<utils::traits::is_pod_v<TValue>>>
TValue catapult::io::Read ( TIo &  input)

Reads data of type TValue from input.

Here is the call graph for this function:

◆ Read() [2/2]

template<typename TIo , typename TValue , typename TTag , typename TBaseValue >
void catapult::io::Read ( TIo &  input,
utils::BasicBaseValue< TValue, TTag, TBaseValue > &  value 
)

Reads base value from input.

Here is the caller graph for this function:

◆ Read16()

template<typename TIo >
auto catapult::io::Read16 ( TIo &  input)

Reads value from input.

Here is the caller graph for this function:

◆ Read32()

template<typename TIo >
auto catapult::io::Read32 ( TIo &  input)

Reads value from input.

Here is the caller graph for this function:

◆ Read64()

template<typename TIo >
auto catapult::io::Read64 ( TIo &  input)

Reads value from input.

Here is the caller graph for this function:

◆ Read8()

template<typename TIo >
auto catapult::io::Read8 ( TIo &  input)

Reads value from input.

Here is the caller graph for this function:

◆ ReadBlockElement()

std::shared_ptr< model::BlockElement > catapult::io::ReadBlockElement ( InputStream inputStream)

Reads block element from inputStream into an allocated block element.

Note
Shared pointer is returned for memory management reasons.
Here is the caller graph for this function:

◆ ReadBlockStatement()

void catapult::io::ReadBlockStatement ( InputStream inputStream,
model::BlockStatement blockStatement 
)

Reads block statement from inputStream into blockStatement.

Here is the caller graph for this function:

◆ ReadEntity()

template<typename TEntity , typename TIo >
std::unique_ptr<TEntity> catapult::io::ReadEntity ( TIo &  input)

Reads size prefixed entity from input.

Here is the call graph for this function:

◆ ReadTransactionInfo()

void catapult::io::ReadTransactionInfo ( InputStream inputStream,
model::TransactionInfo transactionInfo 
)

Reads transaction info from inputStream into transactionInfo.

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

◆ ReadTransactionInfos()

void catapult::io::ReadTransactionInfos ( InputStream inputStream,
model::TransactionInfosSet transactionInfos 
)

Reads transaction infos from inputStream into transactionInfos.

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

◆ Write()

template<typename TIo , typename TValue , typename TTag , typename TBaseValue >
void catapult::io::Write ( TIo &  output,
const utils::BasicBaseValue< TValue, TTag, TBaseValue > &  value 
)

Writes base value into output.

Here is the caller graph for this function:

◆ Write16()

template<typename TIo >
void catapult::io::Write16 ( TIo &  output,
uint16_t  value 
)

Writes value into output.

Here is the caller graph for this function:

◆ Write32()

template<typename TIo >
void catapult::io::Write32 ( TIo &  output,
uint32_t  value 
)

Writes value into output.

Here is the caller graph for this function:

◆ Write64()

template<typename TIo >
void catapult::io::Write64 ( TIo &  output,
uint64_t  value 
)

Writes value into output.

Here is the caller graph for this function:

◆ Write8()

template<typename TIo >
void catapult::io::Write8 ( TIo &  output,
uint8_t  value 
)

Writes value into output.

Here is the caller graph for this function:

◆ WriteBlockElement()

void catapult::io::WriteBlockElement ( const model::BlockElement blockElement,
OutputStream outputStream 
)

Writes blockElement into outputStream.

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

◆ WriteBlockStatement()

void catapult::io::WriteBlockStatement ( const model::BlockStatement blockStatement,
OutputStream outputStream 
)

Writes blockStatement into outputStream.

Here is the caller graph for this function:

◆ WriteEntity()

template<typename TIo >
void catapult::io::WriteEntity ( TIo &  output,
const model::SizePrefixedEntity entity 
)

Writes size prefixed entity into output.

Here is the caller graph for this function:

◆ WriteTransactionInfo()

void catapult::io::WriteTransactionInfo ( const model::TransactionInfo transactionInfo,
OutputStream outputStream 
)

Writes transactionInfo into outputStream.

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

◆ WriteTransactionInfos()

void catapult::io::WriteTransactionInfos ( const model::TransactionInfosSet transactionInfos,
OutputStream outputStream 
)

Writes transactionInfos into outputStream.

Here is the call graph for this function:

Variable Documentation

◆ Default_Stream_Buffer_Size

constexpr size_t catapult::io::Default_Stream_Buffer_Size = 4096
constexpr

Default stream buffer size.