24#ifndef MYSQL_BINLOG_EVENT_COMPRESSION_PAYLOAD_EVENT_BUFFER_ISTREAM_H
25#define MYSQL_BINLOG_EVENT_COMPRESSION_PAYLOAD_EVENT_BUFFER_ISTREAM_H
94 template <
class String_
char_t>
96 const String_char_t *compressed_buffer,
Size_t compressed_buffer_size,
97 type compression_algorithm,
Size_t default_buffer_size = 0,
101 reinterpret_cast<const
Char_t *>(compressed_buffer)),
130 template <
class String_
char_t>
132 const std::basic_string<String_char_t> &compressed_data,
133 type compression_algorithm,
Size_t default_buffer_size = 0,
136 compressed_data.data(), compressed_data.
size(),
137 compression_algorithm, default_buffer_size, memory_resource) {}
159 Size_t default_buffer_size = 0,
179 const std::shared_ptr<const Transaction_payload_event> &tple,
180 Size_t default_buffer_size = 0,
250 explicit operator bool()
const;
338 std::shared_ptr<const Transaction_payload_event>
m_tple{
nullptr};
Allocator using a Memory_resource to do the allocator.
Definition: allocator.h:54
Polymorphism-free memory resource class with custom allocator and deallocator functions.
Definition: memory_resource.h:88
Event that encloses all the events of a transaction.
Definition: control_events.h:736
Abstract base class for decompressors.
Definition: decompressor.h:57
Stream class that yields a stream of byte buffers, each holding the raw decompressed data of one even...
Definition: payload_event_buffer_istream.h:58
mysql::containers::buffers::Buffer_view< Char_t >::Size_t Size_t
Definition: payload_event_buffer_istream.h:61
std::string get_error_str() const
Return a string that describes the last error, or empty string.
Definition: payload_event_buffer_istream.cpp:102
Payload_event_buffer_istream & operator=(Payload_event_buffer_istream &&)=delete
std::string m_error_str
Error string.
Definition: payload_event_buffer_istream.h:361
void set_status(Status_t status)
Update the status.
Definition: payload_event_buffer_istream.cpp:86
bool operator!() const
Indicate if EOF or error has happened.
Definition: payload_event_buffer_istream.cpp:70
Managed_buffer_ptr_t m_managed_buffer_ptr
Shared pointer to Managed_buffer that holds the output.
Definition: payload_event_buffer_istream.h:352
const Grow_calculator_t & get_grow_calculator() const
Return Grow_calculator used for output buffers.
Definition: payload_event_buffer_istream.cpp:334
Payload_event_buffer_istream & operator>>(Buffer_ptr_t &out)
Read the next event from the stream and update the stream state.
Definition: payload_event_buffer_istream.cpp:284
void initialize()
Construct and initialize the decompressor.
Definition: payload_event_buffer_istream.cpp:115
Payload_event_buffer_istream(const String_char_t *compressed_buffer, Size_t compressed_buffer_size, type compression_algorithm, Size_t default_buffer_size=0, const Memory_resource_t &memory_resource=Memory_resource_t())
Construct the stream from the raw compressed data.
Definition: payload_event_buffer_istream.h:95
Grow_calculator_t m_grow_calculator
Grow calculator for the Managed_buffer.
Definition: payload_event_buffer_istream.h:343
Memory_resource_t m_memory_resource
Memory_resource to handle all allocations.
Definition: payload_event_buffer_istream.h:325
Status_t m_status
Error status.
Definition: payload_event_buffer_istream.h:359
void set_grow_calculator(const Grow_calculator_t &grow_calculator)
Set a new Grow_calculator to use for output buffers.
Definition: payload_event_buffer_istream.cpp:338
mysql::allocators::Memory_resource Memory_resource_t
Definition: payload_event_buffer_istream.h:70
std::shared_ptr< const Transaction_payload_event > m_tple
The event we are reading from.
Definition: payload_event_buffer_istream.h:338
Payload_event_buffer_istream(Payload_event_buffer_istream &&)=delete
Size_t m_default_buffer_size
Default buffer size for the Managed_buffer.
Definition: payload_event_buffer_istream.h:345
bool has_error() const
Return true if there was an error.
Definition: payload_event_buffer_istream.cpp:95
bool m_outstanding_error
True if a read has failed but neither get_error_str, has_error, nor get_status has been called.
Definition: payload_event_buffer_istream.h:365
std::unique_ptr< Decompressor_t > m_decompressor
Decompressor.
Definition: payload_event_buffer_istream.h:357
void set_error_str(const std::string &s)
Specify the string that subsequent calls to error_str will return.
Definition: payload_event_buffer_istream.cpp:109
type m_compression_algorithm
Compression algorithm we are using.
Definition: payload_event_buffer_istream.h:334
Payload_event_buffer_istream & operator=(Payload_event_buffer_istream &)=delete
std::shared_ptr< Buffer_view_t > Buffer_ptr_t
Definition: payload_event_buffer_istream.h:68
~Payload_event_buffer_istream()
Definition: payload_event_buffer_istream.cpp:60
void read_event()
Definition: payload_event_buffer_istream.cpp:185
Status_t get_status() const
Return the stream status.
Definition: payload_event_buffer_istream.cpp:79
std::shared_ptr< Managed_buffer_t > Managed_buffer_ptr_t
Definition: payload_event_buffer_istream.h:69
void update_buffer()
Allocate the output buffer if needed.
Definition: payload_event_buffer_istream.cpp:134
Size_t m_compressed_buffer_size
Size of the buffer we are reading from.
Definition: payload_event_buffer_istream.h:332
Payload_event_buffer_istream(Payload_event_buffer_istream &)=delete
void next()
Decompress the next event into the internal buffer.
Definition: payload_event_buffer_istream.cpp:316
unsigned char Char_t
Definition: payload_event_buffer_istream.h:60
const Char_t * m_compressed_buffer
The buffer we are reading from.
Definition: payload_event_buffer_istream.h:330
Payload_event_buffer_istream(const std::basic_string< String_char_t > &compressed_data, type compression_algorithm, Size_t default_buffer_size=0, const Memory_resource_t &memory_resource=Memory_resource_t())
Construct the stream from the raw compressed data.
Definition: payload_event_buffer_istream.h:131
std::size_t Size_t
The 'size' type.
Definition: buffer_view.h:55
Description of a heuristic to determine how much memory to allocate.
Definition: grow_calculator.h:68
Owned, growable, contiguous memory buffer.
Definition: managed_buffer.h:108
Buffer_view< Char_t > Buffer_view_t
Definition: managed_buffer.h:111
Contains the classes representing events operating in the replication stream properties.
Contains the class responsible for deserializing fields of an event previously stored in a buffer.
Container class that provides a contiguous memory buffer to the caller, which the caller can request ...
type
Definition: base.h:40
@ NONE
Definition: base.h:45
Decompress_status
Definition: decompress_status.h:32
@ success
Decompression succeeded.
size_t size(const char *const c)
Definition: base64.h:46
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61