diff

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffTables

func DiffTables(db1, db2 objects.Store, tbl1, tbl2 *objects.Table, tblIdx1, tblIdx2 [][]string, errChan chan<- error, logger logr.Logger, opts ...DiffOption) (<-chan *objects.Diff, progress.Tracker)

func RowToBlockAndOffset

func RowToBlockAndOffset(row uint32) (uint32, byte)

Types

type BlockBuffer

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

func BlockBufferWithSingleStore

func BlockBufferWithSingleStore(db objects.Store, tbl []*objects.Table) (*BlockBuffer, error)

func NewBlockBuffer

func NewBlockBuffer(db []objects.Store, tbl []*objects.Table) (*BlockBuffer, error)

func (*BlockBuffer) GetRow

func (buf *BlockBuffer) GetRow(table byte, offset uint32, rowOffset byte) ([]string, error)

type ColDiff

type ColDiff struct {
	Names   []string
	BasePK  []uint32
	OtherPK [][]uint32

	Added    []map[uint32]struct{}
	Removed  []map[uint32]struct{}
	Moved    []map[uint32][]int
	BaseIdx  map[uint32]uint32
	OtherIdx []map[uint32]uint32
	// contains filtered or unexported fields
}

ColDiff keep track of how column composition and order change between a base version and one or more versions

func CompareColumns

func CompareColumns(base [2][]string, others ...[2][]string) *ColDiff

func (*ColDiff) CombineRows

func (c *ColDiff) CombineRows(layer int, row, oldRow []string) (mergedRows [][]string)

func (*ColDiff) Layers

func (c *ColDiff) Layers() int

func (*ColDiff) Len

func (c *ColDiff) Len() int

func (*ColDiff) Less

func (c *ColDiff) Less(i, j int) bool

func (*ColDiff) PK

func (c *ColDiff) PK() []string

func (*ColDiff) PKIndices

func (c *ColDiff) PKIndices() []uint32

func (*ColDiff) RearrangeBaseRow

func (c *ColDiff) RearrangeBaseRow(row []string) []string

func (*ColDiff) RearrangeRow

func (c *ColDiff) RearrangeRow(layer int, row []string) []string

func (*ColDiff) Swap

func (c *ColDiff) Swap(i, j int)

type DiffOption

type DiffOption func(*Differ)

func WithEmitUnchangedRow

func WithEmitUnchangedRow() DiffOption

WithEmitUnchangedRow tells DiffTables to emit even row that stayed the same between two tables.

func WithProgressInterval

func WithProgressInterval(du time.Duration) DiffOption

WithProgressInterval tells DiffTables to emit progress event at specified interval

type Differ

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

type RowChangeReader

type RowChangeReader struct {
	ColDiff *ColDiff
	// contains filtered or unexported fields
}

func NewRowChangeReader

func NewRowChangeReader(db1, db2 objects.Store, tbl1, tbl2 *objects.Table, colDiff *ColDiff) (*RowChangeReader, error)

func (*RowChangeReader) AddRowDiff

func (r *RowChangeReader) AddRowDiff(d *objects.Diff)

func (*RowChangeReader) Len added in v0.7.7

func (r *RowChangeReader) Len() int

func (*RowChangeReader) Read

func (r *RowChangeReader) Read() ([][]string, error)

func (*RowChangeReader) ReadAt

func (r *RowChangeReader) ReadAt(offset int) (mergedRow [][]string, err error)

func (*RowChangeReader) Seek

func (r *RowChangeReader) Seek(offset int, whence int) (int, error)

type RowListReader

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

func NewRowListReader

func NewRowListReader(db objects.Store, tbl *objects.Table) (*RowListReader, error)

func (*RowListReader) Add

func (r *RowListReader) Add(row uint32)

func (*RowListReader) Len

func (r *RowListReader) Len() int

func (*RowListReader) Read

func (r *RowListReader) Read() ([]string, error)

func (*RowListReader) Seek

func (r *RowListReader) Seek(offset int, whence int) (int, error)

type RowReader

type RowReader interface {
	Read() ([]string, error)
	Seek(offset int, whence int) (int, error)
	Len() int
}

func NewTableReader

func NewTableReader(db objects.Store, tbl *objects.Table) (RowReader, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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