Help us shape the future of Go! Take the 2026 Go Developer Survey

cascadebaseline

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cascadebaseline implements cascade.BaselineProvider over internal/reconstruct — the Phase-2 fallback that lets cascade recovery recover a child row that has no binlog event in the lookback window by reading it out of a `bintrail baseline` Parquet snapshot.

It is a LEAF package on purpose: the CLI (internal/cli) and the console (internal/console) each used to carry a private near-identical copy of this provider, and the copies drifted (#1101, #1102). Hosting the single implementation here — rather than having the console import internal/cli, or folding it into internal/cascade — keeps the console binary free of the whole CLI command layer and keeps the pure cascade engine free of the DuckDB/S3 dependencies that baseline reads pull in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FindBaselineFunc

type FindBaselineFunc func(ctx context.Context, schema, table string, at time.Time) (string, time.Time, reconstruct.StaleWarning, error)

FindBaselineFunc locates the baseline snapshot covering schema.table at-or-before at, returning its path, the snapshot's timestamp and any stale-fallback warning — the shape of reconstruct.FindBaseline with the source already bound.

It is injected rather than called directly so each surface composes with its own baseline-resolution policy: the CLI binds a single --baseline-dir/--baseline-s3 source (see Source), while the console passes its bundle's findBaseline, which retries the durable S3 copy when the local dir has no baseline for the table (#766). Before this was injectable the console's copy called reconstruct.FindBaseline directly and silently lost that fallback (#1102).

func Source

func Source(src string) FindBaselineFunc

Source binds a single baseline source (a local directory or an s3:// prefix) to reconstruct.FindBaseline — the no-fallback lookup the CLI uses.

type Provider

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

Provider implements cascade.BaselineProvider: it finds the child table's baseline snapshot, scans it for rows referencing the deleted parent, and encodes each row's PK to match binlog_events.pk_values so the cascade engine can dedup against Phase-1.

func New

func New(find FindBaselineFunc, resolver *metadata.Resolver) *Provider

New builds a Provider from a baseline lookup and the schema resolver used to encode each baseline row's PK. It never returns nil: callers assign the result to a cascade.BaselineProvider interface variable and test that variable for nil to decide whether Phase-2 ran, so a typed-nil would report an active baseline that does not exist.

func (*Provider) BaselineChildren

func (p *Provider) BaselineChildren(ctx context.Context, schema, table, fkCol, parentPK string, at time.Time, limit int) (cascade.BaselineLookup, bool, error)

BaselineChildren implements cascade.BaselineProvider.

Jump to

Keyboard shortcuts

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