MySQL 26.7.0
Source Code Documentation
mysql::csa::Data_source Class Reference

Represents a cached chunk of data that comes from the specific relay log file (events / headers may cross boundaries of Data_source, but one Data_source does not spread across multiple relay log files) Keeps track of the number of bytes currently in use. More...

#include <data_source.h>

Public Types

using Memory_allocator = mysql::allocators::Allocator< uint8_t >
 
using Data_type = std::vector< uint8_t, Memory_allocator >
 

Public Member Functions

 Data_source (Data_type &&data, const std::string &file_name, std::size_t file_offset, std::size_t file_length, bool ends_file)
 Construct from a vector of bytes and metadata of the relay log file this data was fetched from. More...
 
const Data_typedata () const
 Accesses fetched data. More...
 
uint8_t * data_raw ()
 Accesses raw data (reading) More...
 
std::size_t size () const
 Obtains data size. More...
 
const std::string & get_file_name () const
 Get source file name. More...
 
std::size_t get_file_length () const
 Get source file length. More...
 
std::size_t get_file_offset () const
 Return current batch file offset. More...
 
bool ends_file () const
 Checks if this data chunk ends the file. More...
 
virtual ~Data_source ()
 Destructs object. More...
 

Private Attributes

Data_type m_data
 Cached chunk of data. More...
 
std::string m_file_name {""}
 Source relay log name. More...
 
std::size_t m_file_offset {0}
 Source relay log offset. More...
 
std::size_t m_file_length {0}
 Source file length. More...
 
bool m_is_eof {false}
 True if EOF appears after this data chunk. More...
 

Static Private Attributes

static std::atomic< std::size_t > m_used_bytes = 0
 Variable to track the number of cached bytes used. More...
 

Detailed Description

Represents a cached chunk of data that comes from the specific relay log file (events / headers may cross boundaries of Data_source, but one Data_source does not spread across multiple relay log files) Keeps track of the number of bytes currently in use.

Member Typedef Documentation

◆ Data_type

◆ Memory_allocator

Constructor & Destructor Documentation

◆ Data_source()

mysql::csa::Data_source::Data_source ( Data_source::Data_type &&  data,
const std::string &  file_name,
std::size_t  file_offset,
std::size_t  file_length,
bool  ends_file 
)

Construct from a vector of bytes and metadata of the relay log file this data was fetched from.

Parameters
dataData_source gets ownership of this data
file_nameThe relay log file path and name (full path)
file_offsetThe relay log file offset starting from which data was fetched
file_lengthThe number of bytes in the file_name file
ends_fileTrue if this data batch ends the file

◆ ~Data_source()

mysql::csa::Data_source::~Data_source ( )
virtual

Destructs object.

Member Function Documentation

◆ data()

const Data_source::Data_type & mysql::csa::Data_source::data ( ) const

Accesses fetched data.

Returns
Const reference to bytes fetched

◆ data_raw()

uint8_t * mysql::csa::Data_source::data_raw ( )

Accesses raw data (reading)

◆ ends_file()

bool mysql::csa::Data_source::ends_file ( ) const

Checks if this data chunk ends the file.

Returns
True if this data chunk ends the file, false otherwise

◆ get_file_length()

std::size_t mysql::csa::Data_source::get_file_length ( ) const

Get source file length.

Returns
Source file length (number of bytes in the file)

◆ get_file_name()

const std::string & mysql::csa::Data_source::get_file_name ( ) const

Get source file name.

Returns
Source file name

◆ get_file_offset()

std::size_t mysql::csa::Data_source::get_file_offset ( ) const

Return current batch file offset.

Returns
This batch file offset

◆ size()

std::size_t mysql::csa::Data_source::size ( ) const

Obtains data size.

Returns
data size

Member Data Documentation

◆ m_data

Data_type mysql::csa::Data_source::m_data
private

Cached chunk of data.

◆ m_file_length

std::size_t mysql::csa::Data_source::m_file_length {0}
private

Source file length.

◆ m_file_name

std::string mysql::csa::Data_source::m_file_name {""}
private

Source relay log name.

◆ m_file_offset

std::size_t mysql::csa::Data_source::m_file_offset {0}
private

Source relay log offset.

◆ m_is_eof

bool mysql::csa::Data_source::m_is_eof {false}
private

True if EOF appears after this data chunk.

◆ m_used_bytes

std::atomic< std::size_t > mysql::csa::Data_source::m_used_bytes = 0
staticprivate

Variable to track the number of cached bytes used.


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