Documentation
¶
Index ¶
- Variables
- func Bytes2String(v []byte) string
- func Bytes2Uint64(v []byte) (b uint64, err error)
- func DecodeIndex(data []byte) (aoe.IndexInfo, error)
- func DecodeTable(data []byte) (aoe.TableInfo, error)
- func EncodeIndex(idx aoe.IndexInfo) ([]byte, error)
- func EncodeKey(ks ...interface{}) []byte
- func EncodeTable(tbl aoe.TableInfo) ([]byte, error)
- func String2Bytes(v string) []byte
- func Uint642Bytes(v uint64) []byte
- type Catalog
- func (c *Catalog) CreateDatabase(epoch uint64, dbName string, typ int) (dbid uint64, err error)
- func (c *Catalog) CreateIndex(epoch uint64, idxInfo aoe.IndexInfo) error
- func (c *Catalog) CreateTable(epoch, dbId uint64, tbl aoe.TableInfo) (tid uint64, err error)
- func (c *Catalog) DeletePrimaryKey(epoch, dbId uint64, tableName string) (err error)
- func (c *Catalog) DropDatabase(epoch uint64, dbName string) (err error)
- func (c *Catalog) DropIndex(epoch, tid, dbid uint64, idxName string) error
- func (c *Catalog) DropTable(epoch, dbId uint64, tableName string) (tid uint64, err error)
- func (c *Catalog) EncodeTabletName(groupId, tableId uint64) string
- func (c *Catalog) GetDatabase(dbName string) (*aoe.SchemaInfo, error)
- func (c *Catalog) GetPendingShards() (sids []uint64, err error)
- func (c *Catalog) GetPrimaryKey(dbId uint64, tableName string) (pk *aoe.ColumnInfo, err error)
- func (c *Catalog) GetShardIDsByTid(tid uint64) ([]uint64, error)
- func (c *Catalog) GetTable(dbId uint64, tableName string) (*aoe.TableInfo, error)
- func (c *Catalog) GetTablets(dbId uint64, tableName string) (tablets []aoe.TabletInfo, err error)
- func (c *Catalog) ListDatabases() ([]aoe.SchemaInfo, error)
- func (c *Catalog) ListTables(dbId uint64) ([]aoe.TableInfo, error)
- func (c *Catalog) ListTablesByName(dbName string) ([]aoe.TableInfo, error)
- func (c *Catalog) OnDatabaseSplitted() error
- func (c *Catalog) RemoveDeletedTable(epoch uint64) (cnt int, err error)
- func (c *Catalog) SetPrimaryKey(epoch, dbId uint64, tableName, columnName string) (err error)
- type CatalogListener
- type SplitEvent
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDBCreate is the err ErrDBCreate = errors.New("db create failed") // ErrDBCreateExists is the error for db exists. ErrDBCreateExists = errors.New("db already exists") // ErrDBNotExists is the error for db not exists. ErrDBNotExists = errors.New("db not exist") // ErrTableCreateExists is the error for table exists. ErrTableCreateExists = errors.New("table already exists") // ErrTableNotExists is the error for table not exists. ErrTableNotExists = errors.New("table not exist") //ErrTableCreateFailed is the error for fail in creating table. ErrTableCreateFailed = errors.New("create table failed") //ErrTooMuchTableExists is the error for the number of tables exceeds the limit. ErrTooMuchTableExists = errors.New("the maximum limit of tables has been exceeded") //ErrNoAvailableShard is the error for fail in fetching a shard. ErrNoAvailableShard = errors.New("no available raft group") //ErrTableCreateTimeout is the error for timeout when creating a table. ErrTableCreateTimeout = errors.New("create table timeout") //ErrShardidTimeout is the error for timeout when creating a shard id. ErrShardidTimeout = errors.New("create table timeout") //ErrTableCreateFailed is the error for fail in creating tablet. ErrTabletCreateFailed = errors.New("create tablet failed") //ErrInvalidIndexType is the error for invalid index type. ErrInvalidIndexType = errors.New("index type invalid") //ErrColumnNotExist is the error that the column required by index or primary key doesn't exist in the table. ErrColumnNotExist = errors.New("column not exist") //ErrPrimaryKeyNotExist is the error for primary key not exist. ErrPrimaryKeyNotExist = errors.New("primary key not exist") //ErrIndexExist is the error for duplicated index name. ErrIndexExist = errors.New("index already exist") //ErrIndexNotExist is the error for trying to drop an index that doesn't exit. ErrIndexNotExist = errors.New("index not exist") //ErrShardPending is for pending shards ErrShardPending = errors.New("shard is pending") )
Functions ¶
func Bytes2String ¶
func Bytes2Uint64 ¶
func String2Bytes ¶
func Uint642Bytes ¶
Types ¶
type Catalog ¶
type Catalog struct {
Driver driver.CubeDriver
// contains filtered or unexported fields
}
Catalog is for handling meta information in a query.
func (*Catalog) CreateDatabase ¶
CreateDatabase creates a database with db info.
func (*Catalog) CreateIndex ¶
CreateIndex create an index
func (*Catalog) CreateTable ¶
CreateTable creates a table with tableInfo in database.
func (*Catalog) DeletePrimaryKey ¶
func (*Catalog) DropDatabase ¶
DropDatabase drops whole database. it will set schema status in meta of this database and all tables in this database to "DeleteOnly"
func (*Catalog) DropTable ¶
DropTable drops table in database. it will set schema status in meta of this table to "DeleteOnly"
func (*Catalog) EncodeTabletName ¶
for test
func (*Catalog) GetDatabase ¶
func (c *Catalog) GetDatabase(dbName string) (*aoe.SchemaInfo, error)
GetDatabase gets the database meta with Name.
func (*Catalog) GetPendingShards ¶
func (*Catalog) GetPrimaryKey ¶
func (*Catalog) GetShardIDsByTid ¶
for test
func (*Catalog) GetTablets ¶
GetTablets gets all the tablets of the table in database with dbId and tableName.
func (*Catalog) ListDatabases ¶
func (c *Catalog) ListDatabases() ([]aoe.SchemaInfo, error)
ListDatabases returns all databases.
func (*Catalog) ListTables ¶
ListTables returns all tables meta in database.
func (*Catalog) ListTablesByName ¶
ListTablesByName returns all tables meta in database.
func (*Catalog) OnDatabaseSplitted ¶
func (*Catalog) RemoveDeletedTable ¶
RemoveDeletedTable trigger gc TODO: handle duplicated remove
type CatalogListener ¶
type CatalogListener struct {
event.NoopListener
// contains filtered or unexported fields
}
func NewCatalogListener ¶
func NewCatalogListener() *CatalogListener
func (*CatalogListener) OnPostSplit ¶
func (l *CatalogListener) OnPostSplit(res error, event *event.SplitEvent) error
OnPostSplit update route info and delete presplit key.
func (*CatalogListener) OnPreSplit ¶
func (l *CatalogListener) OnPreSplit(event *event.SplitEvent) error
OnPreSplit set presplit key.
func (*CatalogListener) UpdateCatalog ¶
func (l *CatalogListener) UpdateCatalog(catalog *Catalog)