24#ifndef MYSQL_CSA_STORAGE_RELAY_LOG_DATA_SOURCE_H
25#define MYSQL_CSA_STORAGE_RELAY_LOG_DATA_SOURCE_H
48 using Data_type = std::vector<uint8_t, Memory_allocator>;
58 std::size_t file_offset, std::size_t file_length,
bool ends_file);
66 std::size_t
size()
const;
Represents a cached chunk of data that comes from the specific relay log file (events / headers may c...
Definition: data_source.h:45
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.
Definition: data_source.cpp:32
const std::string & get_file_name() const
Get source file name.
Definition: data_source.cpp:51
std::vector< uint8_t, Memory_allocator > Data_type
Definition: data_source.h:48
static std::atomic< std::size_t > m_used_bytes
Variable to track the number of cached bytes used.
Definition: data_source.h:86
const Data_type & data() const
Accesses fetched data.
Definition: data_source.cpp:45
std::size_t size() const
Obtains data size.
Definition: data_source.cpp:49
bool m_is_eof
True if EOF appears after this data chunk.
Definition: data_source.h:94
std::size_t get_file_length() const
Get source file length.
Definition: data_source.cpp:53
virtual ~Data_source()
Destructs object.
Definition: data_source.cpp:47
std::size_t m_file_offset
Source relay log offset.
Definition: data_source.h:90
uint8_t * data_raw()
Accesses raw data (reading)
Definition: data_source.cpp:43
bool ends_file() const
Checks if this data chunk ends the file.
Definition: data_source.cpp:57
std::size_t m_file_length
Source file length.
Definition: data_source.h:92
Data_type m_data
Cached chunk of data.
Definition: data_source.h:84
std::size_t get_file_offset() const
Return current batch file offset.
Definition: data_source.cpp:55
std::string m_file_name
Source relay log name.
Definition: data_source.h:88
Allocator class that uses a polymorphic Memory_resource to allocate memory.
std::string file_name(Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0pre_8_0_30.cc:45
Definition: channel.cpp:28
std::shared_ptr< Data_source > Data_source_sptr
Definition: data_source.h:39