func (ts *testBoundedTableSuite) SetUpSuite(c *C) { driver := localstore.Driver{Driver: goleveldb.MemoryDriver{}} store, err := driver.Open("memory") c.Check(err, IsNil) ts.store = store ts.se, err = tidb.CreateSession(ts.store) c.Assert(err, IsNil) // create table tp1 := types.NewFieldType(mysql.TypeLong) col1 := &model.ColumnInfo{ ID: 1, Name: model.NewCIStr("a"), Offset: 0, FieldType: *tp1, } tp2 := types.NewFieldType(mysql.TypeVarchar) tp2.Flen = 255 col2 := &model.ColumnInfo{ ID: 2, Name: model.NewCIStr("b"), Offset: 1, FieldType: *tp2, } tblInfo := &model.TableInfo{ ID: 100, Name: model.NewCIStr("t"), Columns: []*model.ColumnInfo{col1, col2}, } alloc := autoid.NewMemoryAllocator(int64(10)) ts.tbl = tables.BoundedTableFromMeta(alloc, tblInfo, 1024) }
func createBoundedTable(meta *model.TableInfo, alloc autoid.Allocator, capacity int64) table.Table { return tables.BoundedTableFromMeta(alloc, meta, capacity) }