checkpoint

package
v0.0.0-...-9e054ec Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package checkpoint contains a utility for persisting checkpoint (fka resolved) timestamps.

Index

Constants

This section is empty.

Variables

Set is used by Wire.

Functions

This section is empty.

Types

type Checkpoints

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

Checkpoints is a factory for Group instances, which manage checkpoint timestamps associated with a group of tables.

func ProvideCheckpoints

func ProvideCheckpoints(
	ctx context.Context, pool *types.StagingPool, meta ident.StagingSchema,
) (*Checkpoints, error)

ProvideCheckpoints is called by Wire.

func (*Checkpoints) ScanForTargetSchemas

func (r *Checkpoints) ScanForTargetSchemas(ctx context.Context) ([]ident.Schema, error)

ScanForTargetSchemas reports any group names that have unresolved timestamps.

func (*Checkpoints) Start

func (r *Checkpoints) Start(
	ctx *stopper.Context, group *types.TableGroup, bounds *notify.Var[hlc.Range],
) (*Group, error)

Start a background goroutine to update the provided bounds variable. The returned Group facade allows the bounds to be modified in conjunction with updating the checkpoint timestamp staging table. The returned Group is not memoized.

type Group

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

Group provides durable storage of the checkpoint (FKA resolved) timestamps associated with a types.TableGroup. Timestamps to be processed are recorded with Group.Advance and their completion is recorded via Group.Commit. This Group type will collaborate with other components by driving a notify.Var containing an hlc.Range. This range represents a window of eligible checkpoints that require processing, where the minimum is called "committed" and the maximum is called "proposed".

func (*Group) Advance

func (r *Group) Advance(ctx context.Context, ts hlc.Time) error

Advance extends the proposed checkpoint timestamp associated with the Group. It is an error if the timestamp does not advance beyond its current point, as this will indicate a violation of changefeed invariants. If successful, this method will asynchronously refresh the Group.

func (*Group) Commit

func (r *Group) Commit(ctx context.Context, rng hlc.Range) error

Commit updates the applied-at timestamp associated with the checkpoints in the open range [min,max). This will asynchronously refresh the Group.

func (*Group) Refresh

func (r *Group) Refresh()

Refresh the Group asynchronously. This is intended for testing.

func (*Group) TableGroup

func (r *Group) TableGroup() *types.TableGroup

TableGroup returns the types.TableGroup whose checkpoints are being persisted.

Jump to

Keyboard shortcuts

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