24#ifndef BINLOG_ISTREAM_INCLUDED
25#define BINLOG_ISTREAM_INCLUDED
136 bool open(std::unique_ptr<Basic_seekable_istream> down_istream,
204 virtual std::unique_ptr<Basic_seekable_istream>
open_file(
246 std::unique_ptr<Basic_seekable_istream>
open_file(
258 std::unique_ptr<Basic_seekable_istream>
open_file(
Base class of binlog input files.
Definition: binlog_istream.h:159
bool open(const char *file_name)
Open a binlog file.
Definition: binlog_istream.cc:186
bool seek(my_off_t position) override
Puts the read position to a given offset.
Definition: binlog_istream.cc:207
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:138
ssize_t read(unsigned char *buffer, size_t length) override
Read some bytes from the input stream.
Definition: binlog_istream.cc:201
Basic_binlog_ifile & operator=(const Basic_binlog_ifile &)=delete
my_off_t length() override
Get length of the binlog file.
Definition: binlog_istream.cc:216
const std::string & file_name() const
Definition: binlog_istream.h:188
my_off_t position() const
Definition: binlog_istream.h:185
my_off_t m_position
The binlog's position where it is reading.
Definition: binlog_istream.h:219
Binlog_read_error * m_error
It is convenient for caller to share a Binlog_read_error object between streams.
Definition: binlog_istream.h:212
~Basic_binlog_ifile() override
Definition: binlog_istream.cc:181
bool is_open() const
Definition: binlog_istream.h:186
std::string m_file_name
Name of the file opened.
Definition: binlog_istream.h:223
Basic_binlog_ifile(Binlog_read_error *binlog_read_error)
Definition: binlog_istream.cc:176
std::unique_ptr< Basic_seekable_istream > m_istream
It is the entry of the low level stream pipeline.
Definition: binlog_istream.h:221
void close()
Close the binlog file it is reading.
Definition: binlog_istream.cc:194
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:60
Seekable_istream with decryption feature.
Definition: binlog_istream.h:120
bool seek(my_off_t offset) override
Puts the read position to a given offset.
Definition: binlog_istream.cc:124
~Binlog_encryption_istream() override
Definition: binlog_istream.cc:136
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:81
ssize_t read(unsigned char *buffer, size_t length) override
Read some bytes from the input stream.
Definition: binlog_istream.cc:117
void close()
Closes the stream.
Definition: binlog_istream.cc:111
std::unique_ptr< Basic_seekable_istream > m_down_istream
Definition: binlog_istream.h:151
my_off_t length() override
The total length of the stream.
Definition: binlog_istream.cc:132
std::unique_ptr< Stream_cipher > m_decryptor
Definition: binlog_istream.h:149
Binlog input file.
Definition: binlog_istream.h:241
std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name) override
Open the system layer file.
Definition: binlog_istream.cc:220
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:82
Error_type get_type() const
Return the error encountered when reading events.
Definition: binlog_istream.h:88
Binlog_read_error(Error_type type)
Definition: binlog_istream.h:80
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
@ EVENT_UNSUPPORTED_NEW_VERSION
Definition: binlog_istream.h:76
@ 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:106
Error_type m_type
Definition: binlog_istream.h:112
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:83
Relaylog input file.
Definition: binlog_istream.h:253
std::unique_ptr< Basic_seekable_istream > open_file(const char *file_name) override
Open the system layer file.
Definition: binlog_istream.cc:231
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:418
required string type
Definition: replication_group_member_actions.proto:34
This file includes the major components for encrypting/decrypting binary log files.