kv

package
v0.0.0-...-8586071 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TableHasAutoRowID

func TableHasAutoRowID(info *model.TableInfo) bool

TableHasAutoRowID return whether table has auto generated row id.

Types

type Checksum

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

Checksum represents the field needs checksum.

func MakeKVChecksum

func MakeKVChecksum(bytes uint64, kvs uint64, checksum uint64) Checksum

MakeKVChecksum creates Checksum.

func NewKVChecksum

func NewKVChecksum(checksum uint64) *Checksum

NewKVChecksum creates Checksum.

func (*Checksum) Add

func (c *Checksum) Add(other *Checksum)

Add other checksum.

func (Checksum) MarshalJSON

func (c Checksum) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Checksum) MarshalLogObject

func (c *Checksum) MarshalLogObject(encoder zapcore.ObjectEncoder) error

MarshalLogObject implements the zapcore.ObjectMarshaler interface.

func (*Checksum) Sum

func (c *Checksum) Sum() uint64

Sum returns the checksum.

func (*Checksum) SumKVS

func (c *Checksum) SumKVS() uint64

SumKVS returns the kv count.

func (*Checksum) SumSize

func (c *Checksum) SumSize() uint64

SumSize returns the bytes.

func (*Checksum) Update

func (c *Checksum) Update(kvs []Pair)

Update add batch of kvs with their values.

func (*Checksum) UpdateOne

func (c *Checksum) UpdateOne(kv Pair)

UpdateOne add kv with its values.

type Encoder

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

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

	// RemoveRecord encode encodes a row of SQL delete values into a backend-friendly format.
	RemoveRecord(
		row []types.Datum,
		rowID int64,
		columnPermutation []int,
	) (Row, int, 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

NewTableKVEncoder creates the Encoder.

type Pair

type Pair struct {
	// Key is the key of the KV pair
	Key []byte
	// Val is the value of the KV pair
	Val []byte
	// IsDelete represents whether we should remove this KV pair.
	IsDelete bool
}

Pair is a pair of key and value.

type Pairs

type Pairs []Pair

Pairs represents the slice of Pair.

func (Pairs) ClassifyAndAppend

func (kvs Pairs) ClassifyAndAppend(
	data *Pairs,
	dataChecksum *Checksum,
	indices *Pairs,
	indexChecksum *Checksum,
)

ClassifyAndAppend split Pairs to data rows and index rows.

func (Pairs) Clear

func (kvs Pairs) Clear() Pairs

Clear resets the Pairs.

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 *Pairs,
		dataChecksum *Checksum,
		indices *Pairs,
		indexChecksum *Checksum,
	)
}

Row represents a single encoded row.

type SessionOptions

type SessionOptions struct {
	SQLMode          mysql.SQLMode
	Timestamp        int64
	RowFormatVersion string
}

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