verification

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConcurrency = 8
View Source
const DefaultRowBatchSize = 1000
View Source
const DefaultTableSplits = 8
View Source
const DefaultWriteBatchSize = 10000

Variables

This section is empty.

Functions

func CompareRows

func CompareRows(
	ctx context.Context, conns []dbconn.Conn, table TableShard, rowBatchSize int, reporter Reporter,
) error

func Verify

func Verify(
	ctx context.Context, conns []dbconn.Conn, reporter Reporter, inOpts ...VerifyOpt,
) error

Verify verifies the given connections have matching tables and contents.

Types

type CombinedReporter

type CombinedReporter struct {
	Reporters []Reporter
}

func (CombinedReporter) Close

func (c CombinedReporter) Close()

func (CombinedReporter) Report

func (c CombinedReporter) Report(obj ReportableObject)

type ExtraneousRow

type ExtraneousRow struct {
	ConnID dbconn.ID
	Schema tree.Name
	Table  tree.Name

	PrimaryKeyColumns []tree.Name
	PrimaryKeyValues  tree.Datums
}

type ExtraneousTable

type ExtraneousTable struct {
	ConnID dbconn.ID
	TableMetadata
}

type FixReporter

type FixReporter struct {
	Conn   dbconn.Conn
	Logger zerolog.Logger
}

func (FixReporter) Close

func (l FixReporter) Close()

func (FixReporter) Report

func (l FixReporter) Report(obj ReportableObject)

type LogReporter

type LogReporter struct {
	zerolog.Logger
}

LogReporter reports to `log`.

func (LogReporter) Close

func (l LogReporter) Close()

func (LogReporter) Report

func (l LogReporter) Report(obj ReportableObject)

type MismatchingRow

type MismatchingRow struct {
	ConnID dbconn.ID
	Schema tree.Name
	Table  tree.Name

	PrimaryKeyColumns []tree.Name
	PrimaryKeyValues  tree.Datums

	MismatchingColumns []tree.Name
	TruthVals          tree.Datums
	TargetVals         tree.Datums
}

type MismatchingTableDefinition

type MismatchingTableDefinition struct {
	ConnID dbconn.ID
	TableMetadata
	Info string
}

type MissingRow

type MissingRow struct {
	ConnID dbconn.ID
	Schema tree.Name
	Table  tree.Name

	PrimaryKeyColumns []tree.Name
	PrimaryKeyValues  tree.Datums
	Columns           []tree.Name
	Values            tree.Datums
}

type MissingTable

type MissingTable struct {
	ConnID dbconn.ID
	TableMetadata
}

type ReportableObject

type ReportableObject interface{}

type Reporter

type Reporter interface {
	Report(obj ReportableObject)
	Close()
}

type SnapshotOpt

type SnapshotOpt func(opts *snapshotOpts)

func WithWriteBatchSize

func WithWriteBatchSize(c int) SnapshotOpt

type StatusReport

type StatusReport struct {
	Info string
}

type TableMetadata

type TableMetadata struct {
	OID    oid.Oid
	Schema tree.Name
	Table  tree.Name
}

func (TableMetadata) Compare

func (tm TableMetadata) Compare(o TableMetadata) int

func (TableMetadata) Less

func (tm TableMetadata) Less(o TableMetadata) bool

type TableShard

type TableShard struct {
	Schema                 tree.Name
	Table                  tree.Name
	MatchingColumns        []tree.Name
	MatchingColumnTypeOIDs [][]oid.Oid
	PrimaryKeyColumns      []tree.Name
	StartPKVals            []tree.Datum
	EndPKVals              []tree.Datum

	ShardNum    int
	TotalShards int
}

type VerifyOpt

type VerifyOpt func(*verifyOpts)

func WithConcurrency

func WithConcurrency(c int) VerifyOpt

func WithContinuous

func WithContinuous(c bool) VerifyOpt

func WithRowBatchSize

func WithRowBatchSize(c int) VerifyOpt

func WithTableSplits

func WithTableSplits(c int) VerifyOpt

func WithWorkFunc

func WithWorkFunc(c WorkFunc) VerifyOpt

type WorkFunc

type WorkFunc func(
	ctx context.Context,
	conns []dbconn.Conn,
	table TableShard,
	rowBatchSize int,
	reporter Reporter,
) error

func Snapshot

func Snapshot(inOpts ...SnapshotOpt) WorkFunc

Jump to

Keyboard shortcuts

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