const walPageBytes … type encoder … func newEncoder(w io.Writer, prevCrc uint32, pageOffset int) *encoder { … } // newFileEncoder creates a new encoder with current file offset for the page writer. func newFileEncoder(f *os.File, prevCrc uint32) (*encoder, error) { … } func (e *encoder) encode(rec *walpb.Record) error { … } func encodeFrameSize(dataBytes int) (lenField uint64, padBytes int) { … } func (e *encoder) flush() error { … } func prepareDataWithPadding(data []byte) ([]byte, uint64) { … } func write(w io.Writer, uint64buf, data []byte, lenField uint64) error { … }