CatapultServer  v0.5.0.1 (Elephant)
catapult::io::FileQueueWriter Class Referencefinal
Inheritance diagram for catapult::io::FileQueueWriter:
Collaboration diagram for catapult::io::FileQueueWriter:

Public Member Functions

 FileQueueWriter (const std::string &directory)
 Creates a file queue writer around directory. More...
 
 FileQueueWriter (const std::string &directory, const std::string &indexFilename)
 Creates a file queue writer around directory containing a (writer) index file (indexFilename). More...
 
void write (const RawBuffer &buffer) override
 
void flush () override
 
- Public Member Functions inherited from catapult::io::OutputStream
virtual ~OutputStream ()=default
 

Private Attributes

boost::filesystem::path m_directory
 
IndexFile m_indexFile
 
uint64_t m_indexValue
 
std::unique_ptr< BufferedOutputFileStreamm_pOutputStream
 

Detailed Description

File based queue writer where each message is represented by a file (with incrementing names) in a directory.

Note
Each call to flush will additionally create a new file.

Constructor & Destructor Documentation

◆ FileQueueWriter() [1/2]

catapult::io::FileQueueWriter::FileQueueWriter ( const std::string &  directory)
explicit

Creates a file queue writer around directory.

◆ FileQueueWriter() [2/2]

catapult::io::FileQueueWriter::FileQueueWriter ( const std::string &  directory,
const std::string &  indexFilename 
)

Creates a file queue writer around directory containing a (writer) index file (indexFilename).

Member Function Documentation

◆ flush()

void catapult::io::FileQueueWriter::flush ( )
overridevirtual

Commits all pending data.

Exceptions
catapult_file_io_errorif flush failed.

Implements catapult::io::OutputStream.

Here is the call graph for this function:

◆ write()

void catapult::io::FileQueueWriter::write ( const RawBuffer &  buffer)
overridevirtual

Writes data pointed to by buffer to this stream.

Exceptions
catapult_file_io_errorif proper amount of data could not be written.

Implements catapult::io::OutputStream.

Member Data Documentation

◆ m_directory

boost::filesystem::path catapult::io::FileQueueWriter::m_directory
private

◆ m_indexFile

IndexFile catapult::io::FileQueueWriter::m_indexFile
private

◆ m_indexValue

uint64_t catapult::io::FileQueueWriter::m_indexValue
private

◆ m_pOutputStream

std::unique_ptr<BufferedOutputFileStream> catapult::io::FileQueueWriter::m_pOutputStream
private

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