Exemple #1
0
// Events are encoded in the following byte format:
// [int32:length][bytes(length):data]
func (e *Event) push(buf *bytes.Buffer) (int, error) {
	data := e.encode()
	binary.WriteInt32(buf, len(data))
	buf.Write(data)

	return len(data) + 4, nil
}
Exemple #2
0
// Events are encoded in the following byte format:
// [Uvarint:length][int32:timestamp][bytes(length):data]
func (e *Event) push(out io.Writer) {
	binary.WriteUvarint(out, len(e.Data))
	binary.WriteInt32(out, e.Timestamp)
	out.Write(e.Data)
	e.Data = nil
}