Documentation ¶
Index ¶
- Constants
- Variables
- func DoTxnRequest[Resp Response, Req Request](ctx context.Context, txnOperator client.TxnOperator, isRead bool, ...) (resps []Resp, err error)
- func GetClusterDetailsFromHAKeeper(ctx context.Context, client logservice.CNHAKeeperClient) (get engine.GetClusterDetailsFunc)
- type AccessInfo
- type AddTableDefReq
- type AddTableDefResp
- type BindedEngine
- func (b *BindedEngine) Commit(ctx context.Context, _ client.TxnOperator) error
- func (b *BindedEngine) Create(ctx context.Context, databaseName string, _ client.TxnOperator) error
- func (b *BindedEngine) Database(ctx context.Context, databaseName string, _ client.TxnOperator) (engine.Database, error)
- func (b *BindedEngine) Databases(ctx context.Context, _ client.TxnOperator) (databaseNames []string, err error)
- func (b *BindedEngine) Delete(ctx context.Context, databaseName string, _ client.TxnOperator) error
- func (b *BindedEngine) Hints() engine.Hints
- func (b *BindedEngine) New(ctx context.Context, _ client.TxnOperator) error
- func (b *BindedEngine) NewBlockReader(_ context.Context, _ int, _ timestamp.Timestamp, _ *plan.Expr, _ [][]byte, ...) ([]engine.Reader, error)
- func (b *BindedEngine) Nodes() (cnNodes engine.Nodes, err error)
- func (b *BindedEngine) Rollback(ctx context.Context, _ client.TxnOperator) error
- type CloseTableIterReq
- type CloseTableIterResp
- type CompilerContext
- func (*CompilerContext) Cost(obj *plan.ObjectRef, e *plan.Expr) *plan.Cost
- func (c *CompilerContext) DatabaseExists(name string) bool
- func (c *CompilerContext) DefaultDatabase() string
- func (c *CompilerContext) GetAccountId() uint32
- func (c *CompilerContext) GetHideKeyDef(dbName string, tableName string) *plan.ColDef
- func (c *CompilerContext) GetPrimaryKeyDef(dbName string, tableName string) (defs []*plan.ColDef)
- func (*CompilerContext) GetRootSql() string
- func (*CompilerContext) GetUserName() string
- func (c *CompilerContext) Resolve(schemaName string, tableName string) (objRef *plan.ObjectRef, tableDef *plan.TableDef)
- func (*CompilerContext) ResolveVariable(varName string, isSystemVar bool, isGlobalVar bool) (interface{}, error)
- type CreateDatabaseReq
- type CreateDatabaseResp
- type CreateRelationReq
- type CreateRelationResp
- type Database
- func (d *Database) Create(ctx context.Context, relName string, defs []engine.TableDef) error
- func (d *Database) Delete(ctx context.Context, relName string) error
- func (d *Database) GetDatabaseId(ctx context.Context) string
- func (d *Database) Relation(ctx context.Context, relName string) (engine.Relation, error)
- func (d *Database) Relations(ctx context.Context) ([]string, error)
- func (d *Database) Truncate(ctx context.Context, relName string) error
- type DelTableDefReq
- type DelTableDefResp
- type DeleteDatabaseReq
- type DeleteDatabaseResp
- type DeleteRelationReq
- type DeleteRelationResp
- type DeleteReq
- type DeleteResp
- type Engine
- func (e *Engine) Bind(txnOp client.TxnOperator) *BindedEngine
- func (e *Engine) Commit(_ context.Context, _ client.TxnOperator) error
- func (e *Engine) Create(ctx context.Context, dbName string, txnOperator client.TxnOperator) error
- func (e *Engine) Database(ctx context.Context, dbName string, txnOperator client.TxnOperator) (engine.Database, error)
- func (e *Engine) Databases(ctx context.Context, txnOperator client.TxnOperator) ([]string, error)
- func (e *Engine) Delete(ctx context.Context, dbName string, txnOperator client.TxnOperator) error
- func (e *Engine) Hints() (h engine.Hints)
- func (e *Engine) New(_ context.Context, _ client.TxnOperator) error
- func (e *Engine) NewBlockReader(_ context.Context, _ int, _ timestamp.Timestamp, _ *plan.Expr, _ [][]byte, ...) ([]engine.Reader, error)
- func (e *Engine) NewCompilerContext(ctx context.Context, defaultDB string, txnOp client.TxnOperator) *CompilerContext
- func (e *Engine) Nodes() (engine.Nodes, error)
- func (e *Engine) Rollback(_ context.Context, _ client.TxnOperator) error
- type FallbackShard
- type GetDatabasesReq
- type GetDatabasesResp
- type GetHiddenKeysReq
- type GetHiddenKeysResp
- type GetPrimaryKeysReq
- type GetPrimaryKeysResp
- type GetRelationsReq
- type GetRelationsResp
- type GetTableColumnsReq
- type GetTableColumnsResp
- type GetTableDefsReq
- type GetTableDefsResp
- type HakeeperIDGenerator
- type HashShard
- type ID
- type IDGenerator
- type IterInfo
- type NewTableIterReq
- type NewTableIterResp
- type NoShard
- type Nullable
- type OpenDatabaseReq
- type OpenDatabaseResp
- type OpenRelationReq
- type OpenRelationResp
- type OperationHandler
- type OperationHandlerProvider
- type ReadReq
- type ReadRequest
- type ReadResp
- type RelationType
- type Request
- type Response
- type Shard
- type ShardPolicy
- type ShardedBatch
- type ShardedVector
- type Table
- func (t *Table) AddTableDef(ctx context.Context, def engine.TableDef) error
- func (t *Table) DelTableDef(ctx context.Context, def engine.TableDef) error
- func (t *Table) Delete(ctx context.Context, bat *batch.Batch, colName string) error
- func (*Table) GetHideKey() *engine.Attribute
- func (t *Table) GetHideKeys(ctx context.Context) (attrs []*engine.Attribute, err error)
- func (t *Table) GetLogTail(ctx context.Context, from *timestamp.Timestamp, to *timestamp.Timestamp, ...) (resp *apipb.SyncLogTailResp, err error)
- func (*Table) GetPriKeyOrHideKey() ([]engine.Attribute, bool)
- func (t *Table) GetPrimaryKeys(ctx context.Context) ([]*engine.Attribute, error)
- func (t *Table) GetTableID(ctx context.Context) string
- func (t *Table) NewReader(ctx context.Context, parallel int, expr *plan.Expr, shardIDs [][]byte) (readers []engine.Reader, err error)
- func (t *Table) Ranges(ctx context.Context, _ *plan.Expr) ([][]byte, error)
- func (t *Table) Rows(ctx context.Context) (int64, error)
- func (t *Table) Size(ctx context.Context, columnName string) (int64, error)
- func (t *Table) TableColumns(ctx context.Context) ([]*engine.Attribute, error)
- func (t *Table) TableDefs(ctx context.Context) ([]engine.TableDef, error)
- func (t *Table) Update(ctx context.Context, data *batch.Batch) error
- func (t *Table) Write(ctx context.Context, data *batch.Batch) error
- type TableReader
- type TableStatsReq
- type TableStatsResp
- type TruncateRelationReq
- type TruncateRelationResp
- type UpdateReq
- type UpdateResp
- type WriteReq
- type WriteReqeust
- type WriteResp
Constants ¶
View Source
const ( OpCreateDatabase = iota + 64 OpOpenDatabase OpGetDatabases OpDeleteDatabase OpCreateRelation OpDeleteRelation OpTruncateRelation OpOpenRelation OpGetRelations OpAddTableDef OpDelTableDef OpDelete OpGetPrimaryKeys OpGetTableColumns OpGetTableDefs OpGetHiddenKeys OpUpdate OpWrite OpNewTableIter OpRead OpCloseTableIter OpTableStats OpPreCommit = uint32(apipb.OpCode_OpPreCommit) OpGetLogTail = uint32(apipb.OpCode_OpGetLogTail) )
Variables ¶
View Source
var RandomIDGenerator = new(randomIDGenerator)
Functions ¶
func DoTxnRequest ¶
func GetClusterDetailsFromHAKeeper ¶
func GetClusterDetailsFromHAKeeper( ctx context.Context, client logservice.CNHAKeeperClient, ) ( get engine.GetClusterDetailsFunc, )
Types ¶
type AccessInfo ¶
type AddTableDefReq ¶
type AddTableDefResp ¶
type AddTableDefResp struct { }
type BindedEngine ¶
type BindedEngine struct {
// contains filtered or unexported fields
}
func (*BindedEngine) Commit ¶
func (b *BindedEngine) Commit(ctx context.Context, _ client.TxnOperator) error
func (*BindedEngine) Create ¶
func (b *BindedEngine) Create(ctx context.Context, databaseName string, _ client.TxnOperator) error
func (*BindedEngine) Database ¶
func (b *BindedEngine) Database(ctx context.Context, databaseName string, _ client.TxnOperator) (engine.Database, error)
func (*BindedEngine) Databases ¶
func (b *BindedEngine) Databases(ctx context.Context, _ client.TxnOperator) (databaseNames []string, err error)
func (*BindedEngine) Delete ¶
func (b *BindedEngine) Delete(ctx context.Context, databaseName string, _ client.TxnOperator) error
func (*BindedEngine) Hints ¶
func (b *BindedEngine) Hints() engine.Hints
func (*BindedEngine) New ¶
func (b *BindedEngine) New(ctx context.Context, _ client.TxnOperator) error
func (*BindedEngine) NewBlockReader ¶
func (*BindedEngine) Rollback ¶
func (b *BindedEngine) Rollback(ctx context.Context, _ client.TxnOperator) error
type CloseTableIterReq ¶
type CloseTableIterReq struct {
IterID ID
}
type CloseTableIterResp ¶
type CloseTableIterResp struct { }
type CompilerContext ¶
type CompilerContext struct {
// contains filtered or unexported fields
}
func (*CompilerContext) DatabaseExists ¶
func (c *CompilerContext) DatabaseExists(name string) bool
func (*CompilerContext) DefaultDatabase ¶
func (c *CompilerContext) DefaultDatabase() string
func (*CompilerContext) GetAccountId ¶
func (c *CompilerContext) GetAccountId() uint32
func (*CompilerContext) GetHideKeyDef ¶
func (c *CompilerContext) GetHideKeyDef(dbName string, tableName string) *plan.ColDef
func (*CompilerContext) GetPrimaryKeyDef ¶
func (c *CompilerContext) GetPrimaryKeyDef(dbName string, tableName string) (defs []*plan.ColDef)
func (*CompilerContext) GetRootSql ¶
func (*CompilerContext) GetRootSql() string
func (*CompilerContext) GetUserName ¶
func (*CompilerContext) GetUserName() string
func (*CompilerContext) ResolveVariable ¶
func (*CompilerContext) ResolveVariable(varName string, isSystemVar bool, isGlobalVar bool) (interface{}, error)
type CreateDatabaseReq ¶
type CreateDatabaseReq struct { ID ID AccessInfo AccessInfo Name string }
type CreateDatabaseResp ¶
type CreateDatabaseResp struct {
ID ID
}
type CreateRelationReq ¶
type CreateRelationResp ¶
type CreateRelationResp struct {
ID ID
}
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
type DelTableDefReq ¶
type DelTableDefResp ¶
type DelTableDefResp struct { }
type DeleteDatabaseReq ¶
type DeleteDatabaseReq struct { AccessInfo AccessInfo Name string }
type DeleteDatabaseResp ¶
type DeleteDatabaseResp struct {
ID ID
}
type DeleteRelationReq ¶
type DeleteRelationResp ¶
type DeleteRelationResp struct {
ID ID
}
type DeleteResp ¶
type DeleteResp struct { }
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is an engine.Engine impl
func New ¶
func New( ctx context.Context, shardPolicy ShardPolicy, getClusterDetails engine.GetClusterDetailsFunc, idGenerator IDGenerator, ) *Engine
func (*Engine) Bind ¶
func (e *Engine) Bind(txnOp client.TxnOperator) *BindedEngine
func (*Engine) NewBlockReader ¶
func (*Engine) NewCompilerContext ¶
func (e *Engine) NewCompilerContext( ctx context.Context, defaultDB string, txnOp client.TxnOperator, ) *CompilerContext
type FallbackShard ¶
type FallbackShard []ShardPolicy
type GetDatabasesReq ¶
type GetDatabasesReq struct {
AccessInfo AccessInfo
}
type GetDatabasesResp ¶
type GetDatabasesResp struct {
Names []string
}
type GetHiddenKeysReq ¶
type GetHiddenKeysReq struct {
TableID ID
}
type GetHiddenKeysResp ¶
type GetPrimaryKeysReq ¶
type GetPrimaryKeysReq struct {
TableID ID
}
type GetPrimaryKeysResp ¶
type GetRelationsReq ¶
type GetRelationsReq struct {
DatabaseID ID
}
type GetRelationsResp ¶
type GetRelationsResp struct {
Names []string
}
type GetTableColumnsReq ¶
type GetTableColumnsReq struct {
TableID ID
}
type GetTableColumnsResp ¶
type GetTableDefsReq ¶
type GetTableDefsReq struct {
TableID ID
}
type GetTableDefsResp ¶
type HakeeperIDGenerator ¶
type HakeeperIDGenerator struct {
// contains filtered or unexported fields
}
func NewHakeeperIDGenerator ¶
func NewHakeeperIDGenerator( generator hakeeperIDGenerator, ) *HakeeperIDGenerator
type HashShard ¶
type HashShard struct {
// contains filtered or unexported fields
}
func NewHashShard ¶
type NewTableIterReq ¶
type NewTableIterResp ¶
type NewTableIterResp struct {
IterID ID
}
type NoShard ¶
type NoShard struct {
// contains filtered or unexported fields
}
NoShard doesn't do sharding at all
type OpenDatabaseReq ¶
type OpenDatabaseReq struct { AccessInfo AccessInfo Name string }
type OpenDatabaseResp ¶
type OpenRelationReq ¶
type OpenRelationResp ¶
type OpenRelationResp struct { ID ID Type RelationType DatabaseName string RelationName string }
type OperationHandler ¶
type OperationHandler interface { HandleOpenDatabase( ctx context.Context, meta txn.TxnMeta, req OpenDatabaseReq, resp *OpenDatabaseResp, ) error HandleGetDatabases( ctx context.Context, meta txn.TxnMeta, req GetDatabasesReq, resp *GetDatabasesResp, ) error HandleOpenRelation( ctx context.Context, meta txn.TxnMeta, req OpenRelationReq, resp *OpenRelationResp, ) error HandleGetRelations( ctx context.Context, meta txn.TxnMeta, req GetRelationsReq, resp *GetRelationsResp, ) error HandleGetPrimaryKeys( ctx context.Context, meta txn.TxnMeta, req GetPrimaryKeysReq, resp *GetPrimaryKeysResp, ) error HandleGetTableColumns( ctx context.Context, meta txn.TxnMeta, req GetTableColumnsReq, resp *GetTableColumnsResp, ) error HandleGetTableDefs( ctx context.Context, meta txn.TxnMeta, req GetTableDefsReq, resp *GetTableDefsResp, ) error HandleGetHiddenKeys( ctx context.Context, meta txn.TxnMeta, req GetHiddenKeysReq, resp *GetHiddenKeysResp, ) error HandleNewTableIter( ctx context.Context, meta txn.TxnMeta, req NewTableIterReq, resp *NewTableIterResp, ) error HandleRead( ctx context.Context, meta txn.TxnMeta, req ReadReq, resp *ReadResp, ) error HandleCloseTableIter( ctx context.Context, meta txn.TxnMeta, req CloseTableIterReq, resp *CloseTableIterResp, ) error HandleCreateDatabase( ctx context.Context, meta txn.TxnMeta, req CreateDatabaseReq, resp *CreateDatabaseResp, ) error HandleDeleteDatabase( ctx context.Context, meta txn.TxnMeta, req DeleteDatabaseReq, resp *DeleteDatabaseResp, ) error HandleCreateRelation( ctx context.Context, meta txn.TxnMeta, req CreateRelationReq, resp *CreateRelationResp, ) error HandleDeleteRelation( ctx context.Context, meta txn.TxnMeta, req DeleteRelationReq, resp *DeleteRelationResp, ) error HandleTruncateRelation( ctx context.Context, meta txn.TxnMeta, req TruncateRelationReq, resp *TruncateRelationResp, ) error HandleAddTableDef( ctx context.Context, meta txn.TxnMeta, req AddTableDefReq, resp *AddTableDefResp, ) error HandleDelTableDef( ctx context.Context, meta txn.TxnMeta, req DelTableDefReq, resp *DelTableDefResp, ) error HandleDelete( ctx context.Context, meta txn.TxnMeta, req DeleteReq, resp *DeleteResp, ) error HandleUpdate( ctx context.Context, meta txn.TxnMeta, req UpdateReq, resp *UpdateResp, ) error HandleWrite( ctx context.Context, meta txn.TxnMeta, req WriteReq, resp *WriteResp, ) error HandleTableStats( ctx context.Context, meta txn.TxnMeta, req TableStatsReq, resp *TableStatsResp, ) error HandleGetLogTail( ctx context.Context, meta txn.TxnMeta, req apipb.SyncLogTailReq, resp *apipb.SyncLogTailResp, ) error HandlePreCommit( ctx context.Context, meta txn.TxnMeta, req apipb.PrecommitWriteCmd, resp *apipb.SyncLogTailResp, ) error }
type OperationHandlerProvider ¶
type OperationHandlerProvider interface {
GetOperationHandler(shard Shard) (OperationHandler, txn.TxnMeta)
}
type ReadRequest ¶
type ReadRequest interface { OpenDatabaseReq | GetDatabasesReq | OpenRelationReq | GetRelationsReq | GetPrimaryKeysReq | GetTableColumnsReq | GetTableDefsReq | GetHiddenKeysReq | NewTableIterReq | ReadReq | CloseTableIterReq | TableStatsReq | apipb.SyncLogTailReq }
type RelationType ¶
type RelationType uint8
const ( RelationTable RelationType = iota + 1 RelationView )
type Request ¶
type Request interface { ReadRequest | WriteReqeust }
type Response ¶
type Response interface { CreateDatabaseResp | OpenDatabaseResp | GetDatabasesResp | DeleteDatabaseResp | CreateRelationResp | DeleteRelationResp | TruncateRelationResp | OpenRelationResp | GetRelationsResp | AddTableDefResp | DelTableDefResp | DeleteResp | GetPrimaryKeysResp | GetTableColumnsResp | GetTableDefsResp | GetHiddenKeysResp | UpdateResp | WriteResp | NewTableIterResp | ReadResp | CloseTableIterResp | TableStatsResp | apipb.SyncLogTailResp }
type ShardPolicy ¶
type ShardPolicy interface { Vector( ctx context.Context, tableID ID, getDefs getDefsFunc, colName string, vec *vector.Vector, nodes []logservicepb.DNStore, ) ( sharded []*ShardedVector, err error, ) Batch( ctx context.Context, tableID ID, getDefs getDefsFunc, batch *batch.Batch, nodes []logservicepb.DNStore, ) ( sharded []*ShardedBatch, err error, ) }
func NewDefaultShardPolicy ¶
func NewDefaultShardPolicy(mp *mpool.MPool) ShardPolicy
type ShardedBatch ¶
type ShardedVector ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) AddTableDef ¶
func (*Table) DelTableDef ¶
func (*Table) GetHideKey ¶
func (*Table) GetHideKeys ¶
func (*Table) GetLogTail ¶
func (*Table) GetPrimaryKeys ¶
func (*Table) TableColumns ¶
type TableReader ¶
type TableReader struct {
// contains filtered or unexported fields
}
func (*TableReader) Close ¶
func (t *TableReader) Close() error
type TableStatsReq ¶
type TableStatsReq struct {
TableID ID
}
type TableStatsResp ¶
type TableStatsResp struct {
Rows int
}
type TruncateRelationReq ¶
type TruncateRelationResp ¶
type TruncateRelationResp struct {
ID ID
}
type UpdateResp ¶
type UpdateResp struct { }
type WriteReqeust ¶
type WriteReqeust interface { CreateDatabaseReq | DeleteDatabaseReq | CreateRelationReq | DeleteRelationReq | TruncateRelationReq | AddTableDefReq | DelTableDefReq | DeleteReq | UpdateReq | WriteReq }
Click to show internal directories.
Click to hide internal directories.