23#ifndef BINLOG_ISTREAM_INCLUDED
24#define BINLOG_ISTREAM_INCLUDED
133 bool open(std::unique_ptr<Basic_seekable_istream> down_istream,
201 virtual std::unique_ptr<Basic_seekable_istream>
open_file(
243 std::unique_ptr<Basic_seekable_istream>
open_file(
255 std::unique_ptr<Basic_seekable_istream>
open_file(
Base class of binlog input files.
Definition: binlog_istream.h:156
bool open(const char *file_name)
Open a binlog file.
Definition: binlog_istream.cc:182
bool seek(my_off_t position) override
Puts the read position to a given offset.
Definition: binlog_istream.cc:203
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:134
ssize_t read(unsigned char *buffer, size_t length) override
Read some bytes from the input stream.
Definition: binlog_istream.cc:197
Basic_binlog_ifile & operator=(const Basic_binlog_ifile &)=delete
my_off_t length() override
Get length of the binlog file.
Definition: binlog_istream.cc:212
const std::string & file_name() const
Definition: binlog_istream.h:185
my_off_t position() const
Definition: binlog_istream.h:182
my_off_t m_position
The binlog's position where it is reading.
Definition: binlog_istream.h:216
Binlog_read_error * m_error
It is convenient for caller to share a Binlog_read_error object between streams.
Definition: binlog_istream.h:209
~Basic_binlog_ifile() override
Definition: binlog_istream.cc:177
bool is_open() const
Definition: binlog_istream.h:183
std::string m_file_name
Name of the file opened.
Definition: binlog_istream.h:220
Basic_binlog_ifile(Binlog_read_error *binlog_read_error)
Definition: binlog_istream.cc:172
std::unique_ptr< Basic_seekable_istream > m_istream
It is the entry of the low level stream pipeline.
Definition: binlog_istream.h:218
void close()
Close the binlog file it is reading.
Definition: binlog_istream.cc:190
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:59
Seekable_istream with decryption feature.
Definition: binlog_istream.h:117
bool seek(my_off_t offset) override
Puts the read position to a given offset.
Definition: binlog_istream.cc:120
~Binlog_encryption_istream() override
Definition: binlog_istream.cc:132
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:77
ssize_t read(unsigned char *buffer, size_t length) override
Read some bytes from the input stream.
Definition: binlog_istream.cc:113
void close()
Closes the stream.
Definition: binlog_istream.cc:107
std::unique_ptr< Basic_seekable_istream > m_down_istream
Definition: binlog_istream.h:148
my_off_t length() override
The total length of the stream.
Definition: binlog_istream.cc:128
std::unique_ptr< Stream_cipher > m_decryptor
Definition: binlog_istream.h:146
Binlog input file.
Definition: binlog_istream.h:238
std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name) override
Open the system layer file.
Definition: binlog_istream.cc:216
It defines the error types which could happen when reading binlog files or deserializing binlog event...
Definition: binlog_istream.h:36
bool has_error() const
Definition: binlog_istream.h:79
Error_type get_type() const
Return the error encountered when reading events.
Definition: binlog_istream.h:85
Binlog_read_error(Error_type type)
Definition: binlog_istream.h:77
Error_type
Possible errors which happens when reading an event.
Definition: binlog_istream.h:41
@ EVENT_TOO_LARGE
Definition: binlog_istream.h:60
@ MEM_ALLOCATE
Definition: binlog_istream.h:55
@ BOGUS
Definition: binlog_istream.h:51
@ SUCCESS
Definition: binlog_istream.h:43
@ SYSTEM_IO
Definition: binlog_istream.h:53
@ READ_ENCRYPTED_LOG_FILE_IS_NOT_SUPPORTED
Definition: binlog_istream.h:72
@ CANNOT_GET_FILE_PASSWORD
Definition: binlog_istream.h:71
@ ERROR_DECRYPTING_FILE
Definition: binlog_istream.h:73
@ READ_EOF
Definition: binlog_istream.h:49
@ HEADER_IO_FAILURE
Definition: binlog_istream.h:67
@ TRUNC_EVENT
Definition: binlog_istream.h:57
@ CANNOT_OPEN
Definition: binlog_istream.h:65
@ BAD_BINLOG_MAGIC
Definition: binlog_istream.h:69
@ INVALID_EVENT
Definition: binlog_istream.h:63
@ TRUNC_FD_EVENT
Definition: binlog_istream.h:59
@ CHECKSUM_FAILURE
Definition: binlog_istream.h:61
@ INVALID_ENCRYPTION_HEADER
Definition: binlog_istream.h:70
Binlog_read_error()=default
bool set_type(Error_type type)
Set m_error to error.
Definition: binlog_istream.h:103
Error_type m_type
Definition: binlog_istream.h:109
const char * get_str() const
Return error message of the error type.
Definition: binlog_istream.cc:33
bool has_fatal_error() const
Definition: binlog_istream.h:80
Relaylog input file.
Definition: binlog_istream.h:250
std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name) override
Open the system layer file.
Definition: binlog_istream.cc:227
ulonglong my_off_t
Definition: my_inttypes.h:71
Common header for many mysys elements.
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:419
required string type
Definition: replication_group_member_actions.proto:33
This file includes the major components for encrypting/decrypting binary log files.