Documentation
¶
Overview ¶
Package buffer provides an in-memory event buffer for BYOS mode. It stores recent binlog events so the agent can answer resolve_pk and recover commands without hitting S3 for recent data. The buffer is safe for concurrent use: one goroutine (stream) writes via Insert, while another (agent handler) reads via Fetch and ResolvePK.
Index ¶
- func WriteParquet(rows []query.ResultRow, outputPath, compression string) (int64, error)
- type Buffer
- func (b *Buffer) ApproxBytes() int64
- func (b *Buffer) Evict() int
- func (b *Buffer) Fetch(_ context.Context, opts query.Options) []query.ResultRow
- func (b *Buffer) Insert(events []event.Event)
- func (b *Buffer) Len() int
- func (b *Buffer) ResolvePK(hash, schema, table string) (string, bool)
- func (b *Buffer) SizeEvictions() int64
- func (b *Buffer) Snapshot() []query.ResultRow
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteParquet ¶
WriteParquet writes result rows to a Parquet file at outputPath using the same 15-column schema as archive.ArchivePartition. The output files are compatible with parquetquery.Fetch for querying.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a thread-safe, in-memory event store for recent binlog events.
func New ¶
New creates a Buffer with the given configuration. Zero values for MaxEvents and MaxBytes mean unlimited (no cap).
func (*Buffer) ApproxBytes ¶
ApproxBytes returns the approximate in-memory byte usage of all buffered events.
func (*Buffer) Fetch ¶
Fetch returns events matching the query options. The returned rows are compatible with query.MergeResults for merging with MySQL/Parquet results.
func (*Buffer) Insert ¶
Insert converts parser events to result rows and appends them to the buffer.
func (*Buffer) ResolvePK ¶
ResolvePK looks up pk_values for the given pk_hash, schema, and table. Returns the pk_values string and true if found.
Deliberately NOT wired with the #1137 CanonicalPKValues compat fallback: the buffer is in-memory and process-lifetime, fed only by the live (post-#1132) parser via Insert, and is never rehydrated from Parquet — so no entry can carry the pre-fix raw spelling of a binary PK. The durable pre-fix spellings live in payload/archive Parquet, which the agent handler's archive path covers.
func (*Buffer) SizeEvictions ¶
SizeEvictions returns the cumulative count of events evicted due to size caps (maxEvents or maxBytes) since the buffer was created.