24#ifndef BINARY_LOG_TRANSACTION_COMPRESSION_PAYLOAD_EVENT_BUFFER_ISTREAM_H_
25#define BINARY_LOG_TRANSACTION_COMPRESSION_PAYLOAD_EVENT_BUFFER_ISTREAM_H_
95 template <
class String_
char_t>
97 const String_char_t *compressed_buffer,
Size_t compressed_buffer_size,
98 type compression_algorithm,
Size_t default_buffer_size = 0,
102 reinterpret_cast<const
Char_t *>(compressed_buffer)),
131 template <
class String_
char_t>
133 const std::basic_string<String_char_t> &compressed_data,
134 type compression_algorithm,
Size_t default_buffer_size = 0,
137 compressed_data.data(), compressed_data.size(),
138 compression_algorithm, default_buffer_size, memory_resource) {}
160 Size_t default_buffer_size = 0,
180 const std::shared_ptr<const Transaction_payload_event> &tple,
181 Size_t default_buffer_size = 0,
253 explicit operator bool()
const;
341 std::shared_ptr<const Transaction_payload_event>
m_tple{
nullptr};
Event that encloses all the events of a transaction.
Definition: control_events.h:727
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:59
Status_t m_status
Error status.
Definition: payload_event_buffer_istream.h:362
Grow_calculator_t m_grow_calculator
Grow calculator for the Managed_buffer.
Definition: payload_event_buffer_istream.h:346
unsigned char Char_t
Definition: payload_event_buffer_istream.h:61
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:337
void update_buffer()
Allocate the output buffer if needed.
Definition: payload_event_buffer_istream.cpp:133
std::shared_ptr< const Transaction_payload_event > m_tple
The event we are reading from.
Definition: payload_event_buffer_istream.h:341
Managed_buffer_ptr_t m_managed_buffer_ptr
Shared pointer to Managed_buffer that holds the output.
Definition: payload_event_buffer_istream.h:355
Size_t m_default_buffer_size
Default buffer size for the Managed_buffer.
Definition: payload_event_buffer_istream.h:348
void next()
Decompress the next event into the internal buffer.
Definition: payload_event_buffer_istream.cpp:315
Payload_event_buffer_istream & operator=(Payload_event_buffer_istream &)=delete
Payload_event_buffer_istream(Payload_event_buffer_istream &&)=delete
Memory_resource_t m_memory_resource
Memory_resource to handle all allocations.
Definition: payload_event_buffer_istream.h:328
bool operator!() const
Indicate if EOF or error has happened.
Definition: payload_event_buffer_istream.cpp:70
std::string get_error_str() const
Return a string that describes the last error, or empty string.
Definition: payload_event_buffer_istream.cpp:102
const Grow_calculator_t & get_grow_calculator() const
Return Grow_calculator used for output buffers.
Definition: payload_event_buffer_istream.cpp:333
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:283
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:132
std::string m_error_str
Error string.
Definition: payload_event_buffer_istream.h:364
Size_t m_compressed_buffer_size
Size of the buffer we are reading from.
Definition: payload_event_buffer_istream.h:335
void initialize()
Construct and initialize the decompressor.
Definition: payload_event_buffer_istream.cpp:115
std::shared_ptr< Managed_buffer_t > Managed_buffer_ptr_t
Definition: payload_event_buffer_istream.h:70
void read_event()
Definition: payload_event_buffer_istream.cpp:184
bool has_error() const
Return true if there was an error.
Definition: payload_event_buffer_istream.cpp:95
const Char_t * m_compressed_buffer
The buffer we are reading from.
Definition: payload_event_buffer_istream.h:333
Payload_event_buffer_istream(Payload_event_buffer_istream &)=delete
type m_compression_algorithm
Compression algorithm we are using.
Definition: payload_event_buffer_istream.h:337
void set_status(Status_t status)
Update the status.
Definition: payload_event_buffer_istream.cpp:86
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
~Payload_event_buffer_istream()
Definition: payload_event_buffer_istream.cpp:60
mysqlns::resource::Memory_resource Memory_resource_t
Definition: payload_event_buffer_istream.h:71
std::unique_ptr< Decompressor_t > m_decompressor
Decompressor.
Definition: payload_event_buffer_istream.h:360
Status_t get_status() const
Return the stream status.
Definition: payload_event_buffer_istream.cpp:79
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:368
std::shared_ptr< Buffer_view_t > Buffer_ptr_t
Definition: payload_event_buffer_istream.h:69
Payload_event_buffer_istream & operator=(Payload_event_buffer_istream &&)=delete
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:96
mysqlns::buffer::Buffer_view< Char_t >::Size_t Size_t
Definition: payload_event_buffer_istream.h:62
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:67
Owned, growable, contiguous memory buffer.
Definition: managed_buffer.h:111
Buffer_view< Char_t > Buffer_view_t
Definition: managed_buffer.h:114
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
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:33
@ NONE
Definition: base.h:38
Decompress_status
Definition: decompress_status.h:32
@ success
Decompression succeeded.
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61