From 0cf0217ed5bb646a47c3d15cc49f72b45a721ae3 Mon Sep 17 00:00:00 2001 From: godchen Date: Sat, 18 Sep 2021 18:37:56 +0800 Subject: [PATCH] [skip ci]Add event data comment (#8232) Signed-off-by: godchen --- internal/storage/event_data.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/storage/event_data.go b/internal/storage/event_data.go index 92eaedaf85..66fdfe6918 100644 --- a/internal/storage/event_data.go +++ b/internal/storage/event_data.go @@ -25,6 +25,7 @@ type descriptorEventData struct { PostHeaderLengths []uint8 } +// DescriptorEventDataFixPart is a memorty struct saves events' DescriptorEventData. type DescriptorEventDataFixPart struct { BinlogVersion int16 ServerVersion int64 @@ -39,19 +40,23 @@ type DescriptorEventDataFixPart struct { PayloadDataType schemapb.DataType } +// SetEventTimeStamp set the timestamp value of DescriptorEventDataFixPart. func (data *descriptorEventData) SetEventTimeStamp(start typeutil.Timestamp, end typeutil.Timestamp) { data.StartTimestamp = start data.EndTimestamp = end } +// SetEventTimeStamp returns the memory size of DescriptorEventDataFixPart. func (data *descriptorEventData) GetEventDataFixPartSize() int32 { return int32(binary.Size(data.DescriptorEventDataFixPart)) } +// SetEventTimeStamp returns the memory size of DescriptorEventDataFixPart. func (data *descriptorEventData) GetMemoryUsageInBytes() int32 { return data.GetEventDataFixPartSize() + int32(binary.Size(data.PostHeaderLengths)) } +// Write transfer DescriptorEventDataFixPart to binary buffer. func (data *descriptorEventData) Write(buffer io.Writer) error { if err := binary.Write(buffer, binary.LittleEndian, data.DescriptorEventDataFixPart); err != nil { return err