ClickHouse/src/IO/MySQLPacketPayloadReadBuffer.h

34 lines
679 B
C++
Raw Normal View History

2020-08-13 08:17:33 +00:00
#pragma once
#include <IO/ReadBuffer.h>
namespace DB
{
/** Reading packets.
* Internally, it calls (if no more data) next() method of the underlying ReadBufferFromPocoSocket, and sets the working buffer to the rest part of the current packet payload.
*/
2020-08-13 12:41:36 +00:00
class MySQLPacketPayloadReadBuffer : public ReadBuffer
2020-08-13 08:17:33 +00:00
{
private:
ReadBuffer & in;
uint8_t & sequence_id;
bool has_read_header = false;
// Size of packet which is being read now.
size_t payload_length = 0;
// Offset in packet payload.
size_t offset = 0;
protected:
bool nextImpl() override;
public:
2020-08-13 12:41:36 +00:00
MySQLPacketPayloadReadBuffer(ReadBuffer & in_, uint8_t & sequence_id_);
2020-08-13 08:17:33 +00:00
};
}