[skip ci]Add event data comment (#8232)

Signed-off-by: godchen <qingxiang.chen@zilliz.com>
This commit is contained in:
godchen 2021-09-18 18:37:56 +08:00 committed by GitHub
parent ac2aade0e4
commit 0cf0217ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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