ebl

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ebl reads bounded Enhanced Binary Log capture streams.

Index

Constants

View Source
const (
	TagVersion         = 0x01
	TagDescription     = 0x02
	TagTimeUTC         = 0x03
	TagElementType     = 0x04
	TagDirectionMarker = 0x05
	TagBSTRawFrame     = 0x07

	CurrentVersion = 1002
	MaxTagPayload  = 1800
)

Variables

View Source
var ErrUnsupportedVersion = errors.New("EBL version is newer than supported")

Functions

This section is empty.

Types

type Direction

type Direction uint8
const (
	DirectionUnknown Direction = iota
	DirectionReceived
	DirectionTransmitted
)

type Event

type Event struct {
	Timestamp    time.Time
	HasTimestamp bool
	Direction    Direction
	RawBST       bool
	Payload      []byte
}

Event is an owned raw-stream chunk or one unframed BST record.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader incrementally parses one EBL file. Retained tag and raw-stream state is bounded by MaxTagPayload and maxRawChunk.

func NewReader

func NewReader() *Reader

func (*Reader) Read

func (r *Reader) Read(input io.Reader, emit func(Event), report func(Warning)) error

Read consumes r to EOF. Recoverable corruption is reported and parsing continues; a newer declared EBL version is terminal.

type Warning

type Warning struct {
	Offset int64
	Err    error
}

func (Warning) Error

func (w Warning) Error() string

func (Warning) Unwrap

func (w Warning) Unwrap() error

type Writer added in v1.2.0

type Writer struct {
	// contains filtered or unexported fields
}

Writer serializes Enhanced Binary Log records. Each public write is one atomic event group so timestamps and direction markers cannot interleave.

func NewWriter added in v1.2.0

func NewWriter(output io.Writer, config WriterConfig) (*Writer, error)

func (*Writer) Err added in v1.2.0

func (w *Writer) Err() error

func (*Writer) Metrics added in v1.2.0

func (w *Writer) Metrics() WriterMetrics

func (*Writer) WriteDescription added in v1.2.0

func (w *Writer) WriteDescription(description string) error

func (*Writer) WriteRawBST added in v1.2.0

func (w *Writer) WriteRawBST(timestamp time.Time, direction Direction, raw []byte) error

func (*Writer) WriteRawBytes added in v1.2.0

func (w *Writer) WriteRawBytes(timestamp time.Time, direction Direction, data []byte) error

type WriterConfig added in v1.2.0

type WriterConfig struct {
	StartTime   time.Time
	Description string
}

type WriterMetrics added in v1.2.0

type WriterMetrics struct {
	Records uint64
	Bytes   uint64
	Errors  uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL