kv

package
v5.1.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 34 Imported by: 63

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExtraHandleColumnInfo = model.NewExtraHandleColInfo()

Functions

func KvPairsFromRows

func KvPairsFromRows(rows Rows) []common.KvPair

KvPairsFromRows converts a Rows instance constructed from MakeRowsFromKvPairs back into a slice of KvPair. This method panics if the Rows is not constructed in such way. nolint:golint // kv.KvPairsFromRows sounds good.

func NewPanickingAllocators

func NewPanickingAllocators(base int64) autoid.Allocators

NewPanickingAllocator creates a PanickingAllocator shared by all allocation types.

func NewSession

func NewSession(options *SessionOptions) sessionctx.Context

NewSession creates a new trimmed down Session matching the options.

Types

type Encoder

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

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

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

func NewTableKVEncoder

func NewTableKVEncoder(tbl table.Table, options *SessionOptions) (Encoder, error)

type KvPairs

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

func (*KvPairs) ClassifyAndAppend

func (kvs *KvPairs) ClassifyAndAppend(
	data *Rows,
	dataChecksum *verification.KVChecksum,
	indices *Rows,
	indexChecksum *verification.KVChecksum,
)

func (*KvPairs) Clear

func (kvs *KvPairs) Clear() Rows

func (*KvPairs) Size

func (kvs *KvPairs) Size() uint64

func (*KvPairs) SplitIntoChunks

func (kvs *KvPairs) SplitIntoChunks(splitSize int) []Rows

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.

func MakeRowFromKvPairs

func MakeRowFromKvPairs(pairs []common.KvPair) Row

MakeRowFromKvPairs converts a KvPair slice into a Row instance. This is mainly used for testing only. The resulting Row instance should only be used for the importer backend.

type RowArrayMarshaler

type RowArrayMarshaler []types.Datum

RowArrayMarshaler wraps a slice of types.Datum for logging the content into zap.

func (RowArrayMarshaler) MarshalLogArray

func (row RowArrayMarshaler) MarshalLogArray(encoder zapcore.ArrayEncoder) error

MarshalLogArray implements the zapcore.ArrayMarshaler interface

type Rows

type Rows interface {
	// SplitIntoChunks splits the rows into multiple consecutive parts, each
	// part having total byte size less than `splitSize`. The meaning of "byte
	// size" should be consistent with the value used in `Row.ClassifyAndAppend`.
	SplitIntoChunks(splitSize int) []Rows

	// 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.

func MakeRowsFromKvPairs

func MakeRowsFromKvPairs(pairs []common.KvPair) Rows

MakeRowsFromKvPairs converts a KvPair slice into a Rows instance. This is mainly used for testing only. The resulting Rows instance should only be used for the importer backend.

type SessionOptions

type SessionOptions struct {
	SQLMode   mysql.SQLMode
	Timestamp int64
	SysVars   map[string]string
	// a seed used for tableKvEncoder's auto random bits value
	AutoRandomSeed int64
}

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