catalog

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Bytes2String(v []byte) string

func Bytes2Uint64

func Bytes2Uint64(v []byte) (b uint64, err error)

func DecodeIndex

func DecodeIndex(data []byte) (aoe.IndexInfo, error)

func DecodeTable

func DecodeTable(data []byte) (aoe.TableInfo, error)

func EncodeIndex

func EncodeIndex(idx aoe.IndexInfo) ([]byte, error)

func EncodeKey

func EncodeKey(ks ...interface{}) []byte

func EncodeTable

func EncodeTable(tbl aoe.TableInfo) ([]byte, error)

func String2Bytes

func String2Bytes(v string) []byte

func Uint642Bytes

func Uint642Bytes(v uint64) []byte

Types

type Catalog

type Catalog struct {
	Driver driver.CubeDriver
	// contains filtered or unexported fields
}

Catalog is for handling meta information in a query.

func NewCatalog

func NewCatalog(store driver.CubeDriver) *Catalog

NewCatalog creates a Catalog.

func (*Catalog) CreateDatabase

func (c *Catalog) CreateDatabase(epoch uint64, dbName string, typ int) (dbid uint64, err error)

CreateDatabase creates a database with db info.

func (*Catalog) CreateIndex

func (c *Catalog) CreateIndex(epoch uint64, idxInfo aoe.IndexInfo) error

CreateIndex create an index

func (*Catalog) CreateTable

func (c *Catalog) CreateTable(epoch, dbId uint64, tbl aoe.TableInfo) (tid uint64, err error)

CreateTable creates a table with tableInfo in database.

func (*Catalog) DeletePrimaryKey

func (c *Catalog) DeletePrimaryKey(epoch, dbId uint64, tableName string) (err error)

func (*Catalog) DropDatabase

func (c *Catalog) DropDatabase(epoch uint64, dbName string) (err error)

DropDatabase drops whole database. it will set schema status in meta of this database and all tables in this database to "DeleteOnly"

func (*Catalog) DropIndex

func (c *Catalog) DropIndex(epoch, tid, dbid uint64, idxName string) error

DropIndex drops an index

func (*Catalog) DropTable

func (c *Catalog) DropTable(epoch, dbId uint64, tableName string) (tid uint64, err error)

DropTable drops table in database. it will set schema status in meta of this table to "DeleteOnly"

func (*Catalog) EncodeTabletName

func (c *Catalog) EncodeTabletName(groupId, tableId uint64) string

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 (c *Catalog) GetPendingShards() (sids []uint64, err error)

func (*Catalog) GetPrimaryKey

func (c *Catalog) GetPrimaryKey(dbId uint64, tableName string) (pk *aoe.ColumnInfo, err error)

func (*Catalog) GetShardIDsByTid

func (c *Catalog) GetShardIDsByTid(tid uint64) ([]uint64, error)

for test

func (*Catalog) GetTable

func (c *Catalog) GetTable(dbId uint64, tableName string) (*aoe.TableInfo, error)

GetTable gets the table meta in database with dbId and tableName.

func (*Catalog) GetTablets

func (c *Catalog) GetTablets(dbId uint64, tableName string) (tablets []aoe.TabletInfo, err error)

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

func (c *Catalog) ListTables(dbId uint64) ([]aoe.TableInfo, error)

ListTables returns all tables meta in database.

func (*Catalog) ListTablesByName

func (c *Catalog) ListTablesByName(dbName string) ([]aoe.TableInfo, error)

ListTablesByName returns all tables meta in database.

func (*Catalog) OnDatabaseSplitted

func (c *Catalog) OnDatabaseSplitted() error

func (*Catalog) RemoveDeletedTable

func (c *Catalog) RemoveDeletedTable(epoch uint64) (cnt int, err error)

RemoveDeletedTable trigger gc TODO: handle duplicated remove

func (*Catalog) SetPrimaryKey

func (c *Catalog) SetPrimaryKey(epoch, dbId uint64, tableName, columnName string) (err error)

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)

type SplitEvent

type SplitEvent struct {
	Old  uint64
	News map[uint64][]uint64
}

Jump to

Keyboard shortcuts

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