encode

package
v1.1.0-beta.0...-70f5218 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	// Close the encoder.
	Close()

	// Encode encodes a row of SQL values into a backend-friendly format.
	Encode(row []types.Datum, rowID int64, columnPermutation []int, offset int64) (Row, error)
}

Encoder encodes a row of SQL values into some opaque type which can be consumed by OpenEngine.WriteEncoded.

type EncodingBuilder

type EncodingBuilder interface {
	// NewEncoder creates an encoder of a TiDB table.
	NewEncoder(ctx context.Context, config *EncodingConfig) (Encoder, error)
	// MakeEmptyRows creates an empty collection of encoded rows.
	MakeEmptyRows() Rows
}

EncodingBuilder consists of operations to handle encoding backend row data formats from source.

type EncodingConfig

type EncodingConfig struct {
	SessionOptions
	Path   string // path of data file
	Table  table.Table
	Logger log.Logger
}

EncodingConfig is the configuration for the encoding backend.

type Row

type Row interface {
	// ClassifyAndAppend separates the data-like and index-like parts of the
	// encoded row, and appends these parts into the existing buffers and
	// checksums.
	ClassifyAndAppend(
		data *Rows,
		dataChecksum *verification.KVChecksum,
		indices *Rows,
		indexChecksum *verification.KVChecksum,
	)

	// Size represents the total kv size of this Row.
	Size() uint64
}

Row represents a single encoded row.

type Rows

type Rows interface {
	// Clear returns a new collection with empty content. It may share the
	// capacity with the current instance. The typical usage is `x = x.Clear()`.
	Clear() Rows
}

Rows represents a collection of encoded rows.

type SessionOptions

type SessionOptions struct {
	SQLMode               mysql.SQLMode
	Timestamp             int64
	SysVars               map[string]string
	LogicalImportPrepStmt bool
	// a seed used for tableKvEncoder's auto random bits value
	AutoRandomSeed int64
	// IndexID is used by the dupeDetector. Only the key range with the specified index ID is scanned.
	IndexID int64
	// MinCommitTS is used by dupeDetector. Only records that larger than commit TS are considered.
	MinCommitTS uint64
}

SessionOptions is the initial configuration of the session.

Jump to

Keyboard shortcuts

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