24#ifndef BINLOG_ISTREAM_INCLUDED
25#define BINLOG_ISTREAM_INCLUDED
134 bool open(std::unique_ptr<Basic_seekable_istream> down_istream,
202 virtual std::unique_ptr<Basic_seekable_istream>
open_file(
244 std::unique_ptr<Basic_seekable_istream>
open_file(
256 std::unique_ptr<Basic_seekable_istream>
open_file(
Base class of binlog input files.
Definition: binlog_istream.h:157
bool open(const char *file_name)
Open a binlog file.
Definition: binlog_istream.cc:183
bool seek(my_off_t position) override
Puts the read position to a given offset.
Definition: binlog_istream.cc:204
virtual std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name)=0
Open the system layer file.
bool read_binlog_magic()
Read binlog magic from binlog file and check if it is valid binlog magic.
Definition: binlog_istream.cc:135
ssize_t read(unsigned char *buffer, size_t length) override
Read some bytes from the input stream.
Definition: binlog_istream.cc:198
Basic_binlog_ifile & operator=(const Basic_binlog_ifile &)=delete
my_off_t length() override
Get length of the binlog file.
Definition: binlog_istream.cc:213
const std::string & file_name() const
Definition: binlog_istream.h:186
my_off_t position() const
Definition: binlog_istream.h:183
my_off_t m_position
The binlog's position where it is reading.
Definition: binlog_istream.h:217
Binlog_read_error * m_error
It is convenient for caller to share a Binlog_read_error object between streams.
Definition: binlog_istream.h:210
~Basic_binlog_ifile() override
Definition: binlog_istream.cc:178
bool is_open() const
Definition: binlog_istream.h:184
std::string m_file_name
Name of the file opened.
Definition: binlog_istream.h:221
Basic_binlog_ifile(Binlog_read_error *binlog_read_error)
Definition: binlog_istream.cc:173
std::unique_ptr< Basic_seekable_istream > m_istream
It is the entry of the low level stream pipeline.
Definition: binlog_istream.h:219
void close()
Close the binlog file it is reading.
Definition: binlog_istream.cc:191
Basic_binlog_ifile(const Basic_binlog_ifile &)=delete
The abstract class for seekable input streams which have fixed length and provide seek operation.
Definition: basic_istream.h:58
Seekable_istream with decryption feature.
Definition: binlog_istream.h:118
bool seek(my_off_t offset) override
Puts the read position to a given offset.
Definition: binlog_istream.cc:121
~Binlog_encryption_istream() override
Definition: binlog_istream.cc:133
bool open(std::unique_ptr< Basic_seekable_istream > down_istream, Binlog_read_error *binlog_read_error)
Initialize the context used in the decryption stream.
Definition: binlog_istream.cc:78
ssize_t read(unsigned char *buffer, size_t length) override
Read some bytes from the input stream.
Definition: binlog_istream.cc:114
void close()
Closes the stream.
Definition: binlog_istream.cc:108
std::unique_ptr< Basic_seekable_istream > m_down_istream
Definition: binlog_istream.h:149
my_off_t length() override
The total length of the stream.
Definition: binlog_istream.cc:129
std::unique_ptr< Stream_cipher > m_decryptor
Definition: binlog_istream.h:147
Binlog input file.
Definition: binlog_istream.h:239
std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name) override
Open the system layer file.
Definition: binlog_istream.cc:217
It defines the error types which could happen when reading binlog files or deserializing binlog event...
Definition: binlog_istream.h:37
bool has_error() const
Definition: binlog_istream.h:80
Error_type get_type() const
Return the error encountered when reading events.
Definition: binlog_istream.h:86
Binlog_read_error(Error_type type)
Definition: binlog_istream.h:78
Error_type
Possible errors which happens when reading an event.
Definition: binlog_istream.h:42
@ EVENT_TOO_LARGE
Definition: binlog_istream.h:61
@ MEM_ALLOCATE
Definition: binlog_istream.h:56
@ BOGUS
Definition: binlog_istream.h:52
@ SUCCESS
Definition: binlog_istream.h:44
@ SYSTEM_IO
Definition: binlog_istream.h:54
@ READ_ENCRYPTED_LOG_FILE_IS_NOT_SUPPORTED
Definition: binlog_istream.h:73
@ CANNOT_GET_FILE_PASSWORD
Definition: binlog_istream.h:72
@ ERROR_DECRYPTING_FILE
Definition: binlog_istream.h:74
@ READ_EOF
Definition: binlog_istream.h:50
@ HEADER_IO_FAILURE
Definition: binlog_istream.h:68
@ TRUNC_EVENT
Definition: binlog_istream.h:58
@ CANNOT_OPEN
Definition: binlog_istream.h:66
@ BAD_BINLOG_MAGIC
Definition: binlog_istream.h:70
@ INVALID_EVENT
Definition: binlog_istream.h:64
@ TRUNC_FD_EVENT
Definition: binlog_istream.h:60
@ CHECKSUM_FAILURE
Definition: binlog_istream.h:62
@ INVALID_ENCRYPTION_HEADER
Definition: binlog_istream.h:71
Binlog_read_error()=default
bool set_type(Error_type type)
Set m_error to error.
Definition: binlog_istream.h:104
Error_type m_type
Definition: binlog_istream.h:110
const char * get_str() const
Return error message of the error type.
Definition: binlog_istream.cc:34
bool has_fatal_error() const
Definition: binlog_istream.h:81
Relaylog input file.
Definition: binlog_istream.h:251
std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name) override
Open the system layer file.
Definition: binlog_istream.cc:228
ulonglong my_off_t
Definition: my_inttypes.h:72
Common header for many mysys elements.
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
required string type
Definition: replication_group_member_actions.proto:34
This file includes the major components for encrypting/decrypting binary log files.