tables

package
v0.0.0-...-887f819 Latest Latest
Warning

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

Go to latest
Published: May 4, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TablePrefix = []byte{'t'}

TablePrefix is the prefix for table record and index key.

Functions

func BoundedTableFromMeta

func BoundedTableFromMeta(alloc autoid.Allocator, tblInfo *model.TableInfo, capacity int64) table.Table

BoundedTableFromMeta creates a Table instance from model.TableInfo.

func DecodeRecordKey

func DecodeRecordKey(key kv.Key) (tableID int64, handle int64, columnID int64, err error)

DecodeRecordKey decodes the key and gets the tableID, handle and columnID.

func DecodeRecordKeyHandle

func DecodeRecordKeyHandle(key kv.Key) (int64, error)

DecodeRecordKeyHandle decodes the key and gets the record handle.

func DecodeValue

func DecodeValue(data []byte, tp *types.FieldType) (types.Datum, error)

DecodeValue implements table.Table DecodeValue interface.

func EncodeRecordKey

func EncodeRecordKey(tableID int64, h int64, columnID int64) kv.Key

EncodeRecordKey encodes the record key for a table column.

func EncodeValue

func EncodeValue(raw types.Datum) ([]byte, error)

EncodeValue encodes a go value to bytes.

func FindIndexByColName

func FindIndexByColName(t table.Table, name string) *column.IndexedCol

FindIndexByColName implements table.Table FindIndexByColName interface.

func MemoryTableFromMeta

func MemoryTableFromMeta(alloc autoid.Allocator, tblInfo *model.TableInfo) (table.Table, error)

MemoryTableFromMeta creates a Table instance from model.TableInfo.

func SetColValue

func SetColValue(rm kv.RetrieverMutator, key []byte, data types.Datum) error

SetColValue implements table.Table SetColValue interface.

func TableFromMeta

func TableFromMeta(alloc autoid.Allocator, tblInfo *model.TableInfo) (table.Table, error)

TableFromMeta creates a Table instance from model.TableInfo.

Types

type BoundedTable

type BoundedTable struct {
	ID      int64
	Name    model.CIStr
	Columns []*column.Col
	// contains filtered or unexported fields
}

BoundedTable implements table.Table interface.

func (*BoundedTable) AddRecord

func (t *BoundedTable) AddRecord(ctx context.Context, r []types.Datum) (int64, error)

AddRecord implements table.Table AddRecord interface.

func (*BoundedTable) AllocAutoID

func (t *BoundedTable) AllocAutoID() (int64, error)

AllocAutoID implements table.Table AllocAutoID interface.

func (*BoundedTable) Cols

func (t *BoundedTable) Cols() []*column.Col

Cols implements table.Table Cols interface.

func (*BoundedTable) FirstKey

func (t *BoundedTable) FirstKey() kv.Key

FirstKey implements table.Table FirstKey interface.

func (*BoundedTable) IndexPrefix

func (t *BoundedTable) IndexPrefix() kv.Key

IndexPrefix implements table.Table IndexPrefix interface.

func (*BoundedTable) Indices

func (t *BoundedTable) Indices() []*column.IndexedCol

Indices implements table.Table Indices interface.

func (*BoundedTable) IterRecords

func (t *BoundedTable) IterRecords(ctx context.Context, startKey kv.Key, cols []*column.Col,
	fn table.RecordIterFunc) error

IterRecords implements table.Table IterRecords interface.

func (*BoundedTable) LockRow

func (t *BoundedTable) LockRow(ctx context.Context, h int64, forRead bool) error

LockRow implements table.Table LockRow interface.

func (*BoundedTable) Meta

func (t *BoundedTable) Meta() *model.TableInfo

Meta implements table.Table Meta interface.

func (*BoundedTable) RebaseAutoID

func (t *BoundedTable) RebaseAutoID(newBase int64, isSetStep bool) error

RebaseAutoID implements table.Table RebaseAutoID interface.

func (*BoundedTable) RecordKey

func (t *BoundedTable) RecordKey(h int64, col *column.Col) kv.Key

RecordKey implements table.Table RecordKey interface.

func (*BoundedTable) RecordPrefix

func (t *BoundedTable) RecordPrefix() kv.Key

RecordPrefix implements table.Table RecordPrefix interface.

func (*BoundedTable) RemoveRecord

func (t *BoundedTable) RemoveRecord(ctx context.Context, h int64, r []types.Datum) error

RemoveRecord implements table.Table RemoveRecord interface.

func (*BoundedTable) Row

func (t *BoundedTable) Row(ctx context.Context, h int64) ([]types.Datum, error)

Row implements table.Table Row interface.

func (*BoundedTable) RowWithCols

func (t *BoundedTable) RowWithCols(ctx context.Context, h int64, cols []*column.Col) ([]types.Datum, error)

RowWithCols implements table.Table RowWithCols interface.

func (*BoundedTable) Seek

func (t *BoundedTable) Seek(ctx context.Context, handle int64) (int64, bool, error)

Seek seeks the handle.

func (*BoundedTable) Truncate

func (t *BoundedTable) Truncate(ctx context.Context) error

Truncate implements table.Table Truncate interface.

func (*BoundedTable) UpdateRecord

func (t *BoundedTable) UpdateRecord(ctx context.Context, h int64, oldData []types.Datum, newData []types.Datum, touched map[int]bool) error

UpdateRecord implements table.Table UpdateRecord interface.

type MemoryTable

type MemoryTable struct {
	ID      int64
	Name    model.CIStr
	Columns []*column.Col
	// contains filtered or unexported fields
}

MemoryTable implements table.Table interface.

func (*MemoryTable) AddRecord

func (t *MemoryTable) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error)

AddRecord implements table.Table AddRecord interface.

func (*MemoryTable) AllocAutoID

func (t *MemoryTable) AllocAutoID() (int64, error)

AllocAutoID implements table.Table AllocAutoID interface.

func (*MemoryTable) Cols

func (t *MemoryTable) Cols() []*column.Col

Cols implements table.Table Cols interface.

func (*MemoryTable) FirstKey

func (t *MemoryTable) FirstKey() kv.Key

FirstKey implements table.Table FirstKey interface.

func (*MemoryTable) IndexPrefix

func (t *MemoryTable) IndexPrefix() kv.Key

IndexPrefix implements table.Table IndexPrefix interface.

func (*MemoryTable) Indices

func (t *MemoryTable) Indices() []*column.IndexedCol

Indices implements table.Table Indices interface.

func (*MemoryTable) IterRecords

func (t *MemoryTable) IterRecords(ctx context.Context, startKey kv.Key, cols []*column.Col,
	fn table.RecordIterFunc) error

IterRecords implements table.Table IterRecords interface.

func (*MemoryTable) LockRow

func (t *MemoryTable) LockRow(ctx context.Context, h int64, forRead bool) error

LockRow implements table.Table LockRow interface.

func (*MemoryTable) Meta

func (t *MemoryTable) Meta() *model.TableInfo

Meta implements table.Table Meta interface.

func (*MemoryTable) RebaseAutoID

func (t *MemoryTable) RebaseAutoID(newBase int64, isSetStep bool) error

RebaseAutoID implements table.Table RebaseAutoID interface.

func (*MemoryTable) RecordKey

func (t *MemoryTable) RecordKey(h int64, col *column.Col) kv.Key

RecordKey implements table.Table RecordKey interface.

func (*MemoryTable) RecordPrefix

func (t *MemoryTable) RecordPrefix() kv.Key

RecordPrefix implements table.Table RecordPrefix interface.

func (*MemoryTable) RemoveRecord

func (t *MemoryTable) RemoveRecord(ctx context.Context, h int64, r []types.Datum) error

RemoveRecord implements table.Table RemoveRecord interface.

func (*MemoryTable) Row

func (t *MemoryTable) Row(ctx context.Context, h int64) ([]types.Datum, error)

Row implements table.Table Row interface.

func (*MemoryTable) RowWithCols

func (t *MemoryTable) RowWithCols(ctx context.Context, h int64, cols []*column.Col) ([]types.Datum, error)

RowWithCols implements table.Table RowWithCols interface.

func (*MemoryTable) Seek

func (t *MemoryTable) Seek(ctx context.Context, handle int64) (int64, bool, error)

Seek seeks the handle

func (*MemoryTable) Truncate

func (t *MemoryTable) Truncate(ctx context.Context) error

Truncate implements table.Table Truncate interface.

func (*MemoryTable) UpdateRecord

func (t *MemoryTable) UpdateRecord(ctx context.Context, h int64, oldData []types.Datum, newData []types.Datum, touched map[int]bool) error

UpdateRecord implements table.Table UpdateRecord interface.

type Table

type Table struct {
	ID      int64
	Name    model.CIStr
	Columns []*column.Col
	// contains filtered or unexported fields
}

Table implements table.Table interface.

func (*Table) AddRecord

func (t *Table) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error)

AddRecord implements table.Table AddRecord interface.

func (*Table) AllocAutoID

func (t *Table) AllocAutoID() (int64, error)

AllocAutoID implements table.Table AllocAutoID interface.

func (*Table) Cols

func (t *Table) Cols() []*column.Col

Cols implements table.Table Cols interface.

func (*Table) FirstKey

func (t *Table) FirstKey() kv.Key

FirstKey implements table.Table FirstKey interface.

func (*Table) IndexPrefix

func (t *Table) IndexPrefix() kv.Key

IndexPrefix implements table.Table IndexPrefix interface.

func (*Table) Indices

func (t *Table) Indices() []*column.IndexedCol

Indices implements table.Table Indices interface.

func (*Table) IterRecords

func (t *Table) IterRecords(ctx context.Context, startKey kv.Key, cols []*column.Col,
	fn table.RecordIterFunc) error

IterRecords implements table.Table IterRecords interface.

func (*Table) LockRow

func (t *Table) LockRow(ctx context.Context, h int64, forRead bool) error

LockRow implements table.Table LockRow interface.

func (*Table) Meta

func (t *Table) Meta() *model.TableInfo

Meta implements table.Table Meta interface.

func (*Table) RebaseAutoID

func (t *Table) RebaseAutoID(newBase int64, isSetStep bool) error

RebaseAutoID implements table.Table RebaseAutoID interface.

func (*Table) RecordKey

func (t *Table) RecordKey(h int64, col *column.Col) kv.Key

RecordKey implements table.Table RecordKey interface.

func (*Table) RecordPrefix

func (t *Table) RecordPrefix() kv.Key

RecordPrefix implements table.Table RecordPrefix interface.

func (*Table) RemoveRecord

func (t *Table) RemoveRecord(ctx context.Context, h int64, r []types.Datum) error

RemoveRecord implements table.Table RemoveRecord interface.

func (*Table) Row

func (t *Table) Row(ctx context.Context, h int64) ([]types.Datum, error)

Row implements table.Table Row interface.

func (*Table) RowWithCols

func (t *Table) RowWithCols(ctx context.Context, h int64, cols []*column.Col) ([]types.Datum, error)

RowWithCols implements table.Table RowWithCols interface.

func (*Table) Seek

func (t *Table) Seek(ctx context.Context, h int64) (int64, bool, error)

Seek implements table.Table Seek interface.

func (*Table) Truncate

func (t *Table) Truncate(ctx context.Context) error

Truncate implements table.Table Truncate interface.

func (*Table) UpdateRecord

func (t *Table) UpdateRecord(ctx context.Context, h int64, oldData []types.Datum, newData []types.Datum, touched map[int]bool) error

UpdateRecord implements table.Table UpdateRecord interface.

Jump to

Keyboard shortcuts

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