コード例 #1
0
ファイル: memory_tables.go プロジェクト: pingcap/tidb
// newMemoryTable constructs a MemoryTable instance.
func newMemoryTable(tableID int64, tableName string, cols []*table.Column, alloc autoid.Allocator) *MemoryTable {
	name := model.NewCIStr(tableName)
	t := &MemoryTable{
		ID:           tableID,
		Name:         name,
		alloc:        alloc,
		Columns:      cols,
		recordPrefix: tablecodec.GenTableRecordPrefix(tableID),
		tree:         llrb.New(),
	}
	return t
}
コード例 #2
0
ファイル: tables.go プロジェクト: pingcap/tidb
// newTable constructs a Table instance.
func newTable(tableID int64, cols []*table.Column, alloc autoid.Allocator) *Table {
	t := &Table{
		ID:           tableID,
		recordPrefix: tablecodec.GenTableRecordPrefix(tableID),
		indexPrefix:  tablecodec.GenTableIndexPrefix(tableID),
		alloc:        alloc,
		Columns:      cols,
	}

	t.publicColumns = t.Cols()
	t.writableColumns = t.WritableCols()
	return t
}
コード例 #3
0
ファイル: bounded_tables.go プロジェクト: jmptrader/tidb
// newBoundedTable constructs a BoundedTable instance.
func newBoundedTable(tableID int64, tableName string, cols []*table.Column, alloc autoid.Allocator, capacity int64) *BoundedTable {
	name := model.NewCIStr(tableName)
	t := &BoundedTable{
		ID:           tableID,
		Name:         name,
		alloc:        alloc,
		Columns:      cols,
		recordPrefix: tablecodec.GenTableRecordPrefix(tableID),
		records:      make([]unsafe.Pointer, capacity),
		capacity:     capacity,
		cursor:       0,
	}
	return t
}