MySQL 8.0.39
Source Code Documentation
|
It is an Truncatable_ostream which provides encryption feature. More...
#include <binlog_ostream.h>
Public Member Functions | |
~Binlog_encryption_ostream () override | |
bool | open (std::unique_ptr< Truncatable_ostream > down_ostream) |
Initialize the context used in the encryption stream and write encryption header into down stream. More... | |
bool | open (std::unique_ptr< Truncatable_ostream > down_ostream, std::unique_ptr< Rpl_encryption_header > header) |
Initialize the context used in the encryption stream based on the header passed as parameter. More... | |
std::pair< bool, std::string > | reencrypt () |
Re-encrypt the encrypted binary/relay log file header by replacing its binlog encryption key id with the current one and its encrypted file password with the new one, which is got by encrypting its file password with the current binlog encryption key. More... | |
void | close () |
bool | write (const unsigned char *buffer, my_off_t length) override |
Write some bytes into the output stream. More... | |
bool | truncate (my_off_t offset) override |
Truncate some data at the end of the output stream. More... | |
bool | seek (my_off_t offset) override |
Put the write position to a given offset. More... | |
bool | flush () override |
Flush data. More... | |
bool | sync () override |
Sync. More... | |
int | get_header_size () |
Return the encrypted file header size. More... | |
Public Member Functions inherited from Truncatable_ostream | |
~Truncatable_ostream () override=default | |
Public Member Functions inherited from Basic_ostream | |
virtual | ~Basic_ostream ()=default |
Private Attributes | |
std::unique_ptr< Truncatable_ostream > | m_down_ostream |
std::unique_ptr< Rpl_encryption_header > | m_header |
std::unique_ptr< Stream_cipher > | m_encryptor |
It is an Truncatable_ostream which provides encryption feature.
It can be setup into an stream pipeline. In the pipeline, it encrypts the data from up stream and then feeds the encrypted data into down stream.
|
override |
void Binlog_encryption_ostream::close | ( | ) |
|
overridevirtual |
int Binlog_encryption_ostream::get_header_size | ( | ) |
Return the encrypted file header size.
bool Binlog_encryption_ostream::open | ( | std::unique_ptr< Truncatable_ostream > | down_ostream | ) |
Initialize the context used in the encryption stream and write encryption header into down stream.
[in] | down_ostream | The stream for storing encrypted data. |
false | Success |
true | Error. |
bool Binlog_encryption_ostream::open | ( | std::unique_ptr< Truncatable_ostream > | down_ostream, |
std::unique_ptr< Rpl_encryption_header > | header | ||
) |
Initialize the context used in the encryption stream based on the header passed as parameter.
It shall be used when opening an ostream for a stream that was already encrypted (the cypher password already exists).
[in] | down_ostream | the stream for storing encrypted data. |
[in] | header | the encryption header to setup the cypher. |
false | Success. |
true | Error. |
std::pair< bool, std::string > Binlog_encryption_ostream::reencrypt | ( | ) |
Re-encrypt the encrypted binary/relay log file header by replacing its binlog encryption key id with the current one and its encrypted file password with the new one, which is got by encrypting its file password with the current binlog encryption key.
false | Success with an empty error message. |
true | Error with an error message. |
|
overridevirtual |
Put the write position to a given offset.
The offset counts from the beginning of the file.
[in] | offset | Where the write position will be |
false | Success |
true | Error |
Implements Truncatable_ostream.
|
overridevirtual |
|
overridevirtual |
Truncate some data at the end of the output stream.
[in] | offset | Where the output stream will be truncated to. |
false | Success |
true | Error |
Implements Truncatable_ostream.
|
overridevirtual |
Write some bytes into the output stream.
When all data is written into the stream successfully, then it return false. Otherwise, true is returned. It will never returns false when partial data is written into the stream.
[in] | buffer | Data to be written |
[in] | length | Length of the data |
false | Success. |
true | Error. |
Implements Basic_ostream.
|
private |
|
private |
|
private |