MySQL 9.1.0
Source Code Documentation
|
Seekable_istream with decryption feature. More...
#include <binlog_istream.h>
Public Member Functions | |
~Binlog_encryption_istream () override | |
bool | open (std::unique_ptr< Basic_seekable_istream > down_istream, Binlog_read_error *binlog_read_error) |
Initialize the context used in the decryption stream. More... | |
void | close () |
Closes the stream. More... | |
ssize_t | read (unsigned char *buffer, size_t length) override |
Read some bytes from the input stream. More... | |
bool | seek (my_off_t offset) override |
Puts the read position to a given offset. More... | |
my_off_t | length () override |
The total length of the stream. More... | |
Public Member Functions inherited from Basic_seekable_istream | |
~Basic_seekable_istream () override=default | |
Public Member Functions inherited from Basic_istream | |
virtual | ~Basic_istream ()=default |
Private Attributes | |
std::unique_ptr< Stream_cipher > | m_decryptor |
std::unique_ptr< Basic_seekable_istream > | m_down_istream |
Seekable_istream with decryption feature.
It can be setup into an stream pipeline. In the pipeline, it decrypts the data from down stream and then feeds the decrypted data into up stream.
|
override |
void Binlog_encryption_istream::close | ( | ) |
Closes the stream.
It also closes the down stream and the decryptor.
|
overridevirtual |
The total length of the stream.
Implements Basic_seekable_istream.
bool Binlog_encryption_istream::open | ( | std::unique_ptr< Basic_seekable_istream > | down_istream, |
Binlog_read_error * | binlog_read_error | ||
) |
Initialize the context used in the decryption stream.
[in] | down_istream | The down stream where the encrypted data is stored. |
[in] | binlog_read_error | Binlog_encryption_istream doesn't own a Binlog_read_error. So the caller should provide one to it. When error happens, the error type will be set into 'binlog_read_error'. |
false | Succeed. |
true | Error. |
|
overridevirtual |
Read some bytes from the input stream.
It should read exact 'length' bytes unless error happens or it reaches the end of the stream. It should block when reaching the end of a pipe that is not closed.
[out] | buffer | Where data will be put in. |
[in] | length | The number of bytes that you want to read. length should not be larger than max long. |
'length' | Read 'length' bytes successfully |
>=0 | Reach EOF, return the number of bytes actually read. It is between 0 and length-1. |
-1 | Error. |
Implements Basic_istream.
|
overridevirtual |
Puts the read position to a given offset.
The offset counts from the beginning of the stream. In case an implementing class transforms the data in a way that does not preserve positions, the offset here will be relative to the bytes that are read out from the stream, not relative to the bytes in lower layer storage.
it is allowed for a subclass to return success even if the position is greater than the size of the file. Error may be returned by the next read for this case. Users should call length() if they need to check that the position is within bounds.
[in] | offset | Where the read position will be. |
false | Success |
true | Error |
Implements Basic_seekable_istream.
|
private |
|
private |