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