diff options
Diffstat (limited to 'tddb/td/db/binlog/BinlogEvent.cpp')
| -rw-r--r-- | tddb/td/db/binlog/BinlogEvent.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tddb/td/db/binlog/BinlogEvent.cpp b/tddb/td/db/binlog/BinlogEvent.cpp index 213d2e4d8..ffb1a71a4 100644 --- a/tddb/td/db/binlog/BinlogEvent.cpp +++ b/tddb/td/db/binlog/BinlogEvent.cpp @@ -23,8 +23,7 @@ Status BinlogEvent::init(BufferSlice &&raw_event, bool check_crc) { flags_ = parser.fetch_int(); extra_ = parser.fetch_long(); CHECK(size_ >= MIN_SIZE); - auto slice_data = parser.fetch_string_raw<Slice>(size_ - MIN_SIZE); - data_ = MutableSlice(const_cast<char *>(slice_data.begin()), slice_data.size()); + parser.fetch_string_raw<Slice>(size_ - MIN_SIZE); // skip data crc32_ = static_cast<uint32>(parser.fetch_int()); if (check_crc) { auto calculated_crc = crc32(raw_event.as_slice().substr(0, size_ - TAIL_SIZE)); @@ -37,6 +36,10 @@ Status BinlogEvent::init(BufferSlice &&raw_event, bool check_crc) { return Status::OK(); } +Slice BinlogEvent::get_data() const { + return Slice(raw_event_.as_slice().data() + HEADER_SIZE, size_ - MIN_SIZE); +} + Status BinlogEvent::validate() const { BinlogEvent event; if (raw_event_.size() < 4) { @@ -69,10 +72,7 @@ BufferSlice BinlogEvent::create_raw(uint64 id, int32 type, int32 flags, const St } void BinlogEvent::realloc() { - auto data_offset = data_.begin() - raw_event_.as_slice().begin(); - auto data_size = data_.size(); raw_event_ = raw_event_.copy(); - data_ = raw_event_.as_slice().substr(data_offset, data_size); } } // namespace td |
