MySQL 8.4.3
Source Code Documentation
Binlog_cache_storage Class Reference

Byte container that provides a storage for serializing session binlog events. More...

#include <binlog_ostream.h>

Inheritance diagram for Binlog_cache_storage:
[legend]

Public Member Functions

 ~Binlog_cache_storage () override
 
bool open (my_off_t cache_size, my_off_t max_cache_size)
 
void close ()
 
bool write (const unsigned char *buffer, my_off_t length) override
 Write some bytes into the output stream. More...
 
bool truncate (my_off_t offset)
 Truncates some data at the end of the binlog cache. More...
 
bool reset ()
 Reset status and drop all data. More...
 
size_t disk_writes () const
 Returns the count of disk writes. More...
 
const char * tmp_file_name () const
 Returns the name of the temporary file. More...
 
bool copy_to (Basic_ostream *ostream, bool *ostream_error=nullptr)
 Copy all data to a output stream. More...
 
my_off_t length () const
 Returns data length. More...
 
bool is_empty () const
 Returns true if binlog cache is empty. More...
 
- Public Member Functions inherited from Basic_ostream
virtual ~Basic_ostream ()=default
 

Private Attributes

Truncatable_ostreamm_pipeline_head = nullptr
 
IO_CACHE_binlog_cache_storage m_file
 

Detailed Description

Byte container that provides a storage for serializing session binlog events.

This way of arranging the classes separates storage layer and binlog layer, hides the implementation detail of low level storage.

Constructor & Destructor Documentation

◆ ~Binlog_cache_storage()

Binlog_cache_storage::~Binlog_cache_storage ( )
override

Member Function Documentation

◆ close()

void Binlog_cache_storage::close ( )

◆ copy_to()

bool Binlog_cache_storage::copy_to ( Basic_ostream ostream,
bool *  ostream_error = nullptr 
)
inline

Copy all data to a output stream.

This function hides the internal implementation of storage detail. So it will not disturb the callers if the implementation of Binlog_cache_storage is changed. If we add a pipeline stream in this class, then we need to change the implementation of this function. But callers are not affected.

Parameters
[out]ostreamWhere the data will be copied into
[out]ostream_errorIt will be set to true if an error happens on ostream and the pointer is not null. It is valid only when the function returns true.
Return values
falseSuccess
trueError happens in either the istream or ostream.

◆ disk_writes()

size_t Binlog_cache_storage::disk_writes ( ) const
inline

Returns the count of disk writes.

◆ is_empty()

bool Binlog_cache_storage::is_empty ( ) const
inline

Returns true if binlog cache is empty.

◆ length()

my_off_t Binlog_cache_storage::length ( ) const
inline

Returns data length.

◆ open()

bool Binlog_cache_storage::open ( my_off_t  cache_size,
my_off_t  max_cache_size 
)

◆ reset()

bool Binlog_cache_storage::reset ( )
inline

Reset status and drop all data.

It looks like a cache was never used after reset.

◆ tmp_file_name()

const char * Binlog_cache_storage::tmp_file_name ( ) const
inline

Returns the name of the temporary file.

◆ truncate()

bool Binlog_cache_storage::truncate ( my_off_t  offset)
inline

Truncates some data at the end of the binlog cache.

Parameters
[in]offsetWhere the binlog cache will be truncated to.
Return values
falseSuccess
trueError

◆ write()

bool Binlog_cache_storage::write ( const unsigned char *  buffer,
my_off_t  length 
)
inlineoverridevirtual

Write some bytes into the output stream.

When all data is written into the stream successfully, then it return false. Otherwise, true is returned. It will never returns false when partial data is written into the stream.

Parameters
[in]bufferData to be written
[in]lengthLength of the data
Return values
falseSuccess.
trueError.

Implements Basic_ostream.

Member Data Documentation

◆ m_file

IO_CACHE_binlog_cache_storage Binlog_cache_storage::m_file
private

◆ m_pipeline_head

Truncatable_ostream* Binlog_cache_storage::m_pipeline_head = nullptr
private

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