engine

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTempTableName added in v0.7.0

func GetTempTableName(DbName string, TblName string) string

Types

type Attribute

type Attribute struct {
	// IsHide whether the attribute is hidden or not
	IsHidden bool
	// IsRowId whether the attribute is rowid or not
	IsRowId bool
	// Column ID
	ID uint64
	// Name name of attribute
	Name string
	// Alg compression algorithm
	Alg compress.T
	// Type attribute's type
	Type types.Type
	// DefaultExpr default value of this attribute
	Default *plan.Default
	// to update col when define in create table
	OnUpdate *plan.OnUpdate
	// Primary is primary key or not
	Primary bool
	// Clusterby means sort by this column
	ClusterBy bool
	// Comment of attribute
	Comment string
	// AutoIncrement is auto incr or not
	AutoIncrement bool
}

Attribute is a column

func (*Attribute) Format

func (node *Attribute) Format(buf *bytes.Buffer)

type AttributeDef

type AttributeDef struct {
	Attr Attribute
}

func (*AttributeDef) Format

func (node *AttributeDef) Format(buf *bytes.Buffer)

type ClusterByDef added in v0.7.0

type ClusterByDef struct {
	Name string
}

type CommentDef

type CommentDef struct {
	Comment string
}

type Constraint added in v0.7.0

type Constraint interface {
	// contains filtered or unexported methods
}

type ConstraintDef added in v0.7.0

type ConstraintDef struct {
	Cts []Constraint
}

func (*ConstraintDef) GetPrimaryKeyDef added in v0.7.0

func (c *ConstraintDef) GetPrimaryKeyDef() *PrimaryKeyDef

get the primary key definition in the constraint, and return null if there is no primary key

func (*ConstraintDef) MarshalBinary added in v0.7.0

func (c *ConstraintDef) MarshalBinary() (data []byte, err error)

func (*ConstraintDef) UnmarshalBinary added in v0.7.0

func (c *ConstraintDef) UnmarshalBinary(data []byte) error

type ConstraintType added in v0.7.0

type ConstraintType int8
const (
	Index ConstraintType = iota
	RefChildTable
	ForeignKey
	PrimaryKey
)

type Database

type Database interface {
	Relations(context.Context) ([]string, error)
	Relation(context.Context, string) (Relation, error)

	Delete(context.Context, string) error
	Create(context.Context, string, []TableDef) error // Create Table - (name, table define)
	Truncate(context.Context, string) (uint64, error)
	GetDatabaseId(context.Context) string
}

type Engine

type Engine interface {
	// transaction interface
	New(ctx context.Context, op client.TxnOperator) error
	Commit(ctx context.Context, op client.TxnOperator) error
	Rollback(ctx context.Context, op client.TxnOperator) error

	// Delete deletes a database
	Delete(ctx context.Context, databaseName string, op client.TxnOperator) error

	// Create creates a database
	Create(ctx context.Context, databaseName string, op client.TxnOperator) error

	// Databases returns all database names
	Databases(ctx context.Context, op client.TxnOperator) (databaseNames []string, err error)

	// Database creates a handle for a database
	Database(ctx context.Context, databaseName string, op client.TxnOperator) (Database, error)

	// Nodes returns all nodes for worker jobs
	Nodes() (cnNodes Nodes, err error)

	// Hints returns hints of engine features
	// return value should not be cached
	// since implementations may update hints after engine had initialized
	Hints() Hints

	NewBlockReader(ctx context.Context, num int, ts timestamp.Timestamp,
		expr *plan.Expr, ranges [][]byte, tblDef *plan.TableDef) ([]Reader, error)

	// Get database name & table name by table id
	GetNameById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName string, tblName string, err error)

	// Get relation by table id
	GetRelationById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName string, tblName string, rel Relation, err error)
}

type EntireEngine added in v0.7.0

type EntireEngine struct {
	Engine     Engine // original engine
	TempEngine Engine // new engine for temporarily table
}

EntireEngine is a wrapper for Engine to support temporary table

func (*EntireEngine) Commit added in v0.7.0

func (e *EntireEngine) Commit(ctx context.Context, op client.TxnOperator) error

func (*EntireEngine) Create added in v0.7.0

func (e *EntireEngine) Create(ctx context.Context, databaseName string, op client.TxnOperator) error

func (*EntireEngine) Database added in v0.7.0

func (e *EntireEngine) Database(ctx context.Context, databaseName string, op client.TxnOperator) (Database, error)

func (*EntireEngine) Databases added in v0.7.0

func (e *EntireEngine) Databases(ctx context.Context, op client.TxnOperator) (databaseNames []string, err error)

func (*EntireEngine) Delete added in v0.7.0

func (e *EntireEngine) Delete(ctx context.Context, databaseName string, op client.TxnOperator) error

func (*EntireEngine) GetNameById added in v0.7.0

func (e *EntireEngine) GetNameById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName string, tblName string, err error)

func (*EntireEngine) GetRelationById added in v0.7.0

func (e *EntireEngine) GetRelationById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName string, tblName string, rel Relation, err error)

func (*EntireEngine) Hints added in v0.7.0

func (e *EntireEngine) Hints() Hints

func (*EntireEngine) New added in v0.7.0

func (*EntireEngine) NewBlockReader added in v0.7.0

func (e *EntireEngine) NewBlockReader(ctx context.Context, num int, ts timestamp.Timestamp,
	expr *plan.Expr, ranges [][]byte, tblDef *plan.TableDef) ([]Reader, error)

func (*EntireEngine) Nodes added in v0.7.0

func (e *EntireEngine) Nodes() (cnNodes Nodes, err error)

func (*EntireEngine) Rollback added in v0.7.0

func (e *EntireEngine) Rollback(ctx context.Context, op client.TxnOperator) error

type ForeignKeyDef added in v0.7.0

type ForeignKeyDef struct {
	Fkeys []*plan.ForeignKeyDef
}

type GetClusterDetailsFunc added in v0.6.0

type GetClusterDetailsFunc = func() (logservicepb.ClusterDetails, error)

type Hints added in v0.6.0

type Hints struct {
	CommitOrRollbackTimeout time.Duration
}

type IndexDef added in v0.7.0

type IndexDef struct {
	Indexes []*plan.IndexDef
}

type IndexT

type IndexT int
const (
	Invalid IndexT = iota
	ZoneMap
	BsiIndex
)

func (IndexT) ToString

func (node IndexT) ToString() string

type IndexTableDef

type IndexTableDef struct {
	Typ      IndexT
	ColNames []string
	Name     string
}

func (*IndexTableDef) Format

func (node *IndexTableDef) Format(buf *bytes.Buffer)

type Node

type Node struct {
	Mcpu int
	Id   string   `json:"id"`
	Addr string   `json:"address"`
	Data [][]byte `json:"payload"`
	Rel  Relation // local relation
}

type Nodes

type Nodes []Node

type PartitionDef added in v0.6.0

type PartitionDef struct {
	Partition string
}

type PrimaryKeyDef added in v0.7.0

type PrimaryKeyDef struct {
	Pkey *plan.PrimaryKeyDef
}

type PropertiesDef

type PropertiesDef struct {
	Properties []Property
}

type Property

type Property struct {
	Key   string
	Value string
}

type Reader

type Reader interface {
	Close() error
	Read(context.Context, []string, *plan.Expr, *mpool.MPool) (*batch.Batch, error)
}

type RefChildTableDef added in v0.7.0

type RefChildTableDef struct {
	Tables []uint64
}

type Relation

type Relation interface {
	Statistics

	Ranges(context.Context, *plan.Expr) ([][]byte, error)

	TableDefs(context.Context) ([]TableDef, error)

	GetPrimaryKeys(context.Context) ([]*Attribute, error)

	GetHideKeys(context.Context) ([]*Attribute, error)

	Write(context.Context, *batch.Batch) error

	Update(context.Context, *batch.Batch) error

	// Delete(context.Context, *vector.Vector, string) error
	Delete(context.Context, *batch.Batch, string) error

	AddTableDef(context.Context, TableDef) error
	DelTableDef(context.Context, TableDef) error

	// only ConstraintDef can be modified
	UpdateConstraint(context.Context, *ConstraintDef) error

	GetTableID(context.Context) uint64

	// second argument is the number of reader, third argument is the filter extend, foruth parameter is the payload required by the engine
	NewReader(context.Context, int, *plan.Expr, [][]byte) ([]Reader, error)

	TableColumns(ctx context.Context) ([]*Attribute, error)

	//max and min values
	MaxAndMinValues(ctx context.Context) ([][2]any, []uint8, error)
}

type Statistics

type Statistics interface {
	Stats(ctx context.Context, expr *plan.Expr) (*plan.Stats, error)
	Rows(ctx context.Context) (int64, error)
	Size(ctx context.Context, columnName string) (int64, error)
}

type TableDef

type TableDef interface {
	// contains filtered or unexported methods
}

type ViewDef added in v0.6.0

type ViewDef struct {
	View string
}

Directories

Path Synopsis
tae
common
A few allocators for TAE
A few allocators for TAE
db
gc
logtail/service
This package implements client and server for logtail push model.
This package implements client and server for logtail push model.
mergesort/bools
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/decimal128s
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/decimal64s
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/numerics
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/rowid
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/txnts
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/uuids
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
mergesort/varchar
Package heap provides heap operations for any type that implements heap.Interface.
Package heap provides heap operations for any type that implements heap.Interface.
rpc
stl
wal

Jump to

Keyboard shortcuts

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