moengine

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: 27 Imported by: 0

Documentation

Index

Constants

View Source
const ADDR = "localhost:20000"

Variables

View Source
var ErrReadOnly = moerr.NewInternalErrorNoCtx("tae moengine: read only")

Functions

func AttrFromColDef added in v0.7.0

func AttrFromColDef(col *catalog.ColDef) (attrs *engine.Attribute, err error)

func ColDefsToAttrs added in v0.6.0

func ColDefsToAttrs(colDefs []*catalog.ColDef) (attrs []*engine.Attribute, err error)

func DefsToSchema

func DefsToSchema(name string, defs []engine.TableDef) (schema *catalog.Schema, err error)

func EngineToTxnClient added in v0.6.0

func EngineToTxnClient(engine TxnEngine) client.TxnClient

func NewEngine

func NewEngine(impl *db.DB) *txnEngine

func SchemaToDefs

func SchemaToDefs(schema *catalog.Schema) (defs []engine.TableDef, err error)

func TxnToTxnOperator added in v0.6.0

func TxnToTxnOperator(tx Txn) client.TxnOperator

Types

type Database added in v0.6.0

type Database interface {
	RelationNames(context.Context) ([]string, error)
	GetRelation(context.Context, string) (Relation, error)
	GetRelationByID(context.Context, uint64) (Relation, error)

	DropRelation(context.Context, string) error
	DropRelationByID(context.Context, uint64) error
	TruncateRelationWithID(context.Context, string, uint64) error
	TruncateRelationByID(context.Context, uint64, uint64) error

	CreateRelation(context.Context, string, []engine.TableDef) error               // Create Table - (name, table define)
	CreateRelationWithID(context.Context, string, uint64, []engine.TableDef) error // Create Table - (name, table define)

	GetDatabaseID(ctx context.Context) uint64
}

Database is only used by taeStorage

type Engine added in v0.6.0

type Engine interface {
	DropDatabase(ctx context.Context, databaseName string, txn Txn) error
	DropDatabaseByID(ctx context.Context, id uint64, txn Txn) error

	CreateDatabase(ctx context.Context, databaseName string, txn Txn) error
	CreateDatabaseWithID(ctx context.Context, databaseName, createSql string, id uint64, txn Txn) error

	// DatabaseNames returns all database names
	DatabaseNames(ctx context.Context, txn Txn) (databaseNames []string, err error)

	// GetDatabase returns a handle for a database
	GetDatabase(ctx context.Context, databaseName string, txn Txn) (Database, error)
	GetDatabaseByID(ctx context.Context, id uint64, txn Txn) (Database, error)

	// GetTAE returns tae db struct
	GetTAE(ctx context.Context) *db.DB

	FlushTable(ctx context.Context, tenantID uint32, databaseId, tableId uint64, ts types.TS) error
	ForceCheckpoint(ctx context.Context, ts types.TS, flushDuration time.Duration) error
}

moengine.Engine is only used by taeStorage

type Relation added in v0.6.0

type Relation interface {
	GetPrimaryKeys(context.Context) ([]*engine.Attribute, error)
	GetHideKeys(context.Context) ([]*engine.Attribute, error)
	GetSchema(ctx context.Context) *catalog.Schema

	UpdateConstraintWithBin(context.Context, []byte) error
	//Write just append data into txn's workspace, instead of applying data into state machine.
	//TODO::Add flag parameter to indicate whether tae need to
	//      do deduplication check with transaction's workspace and snapshot data.
	Write(context.Context, *batch.Batch) error

	//AddBlksWithMetaLoc just add  non-appendable blocks into txn's workspace.
	AddBlksWithMetaLoc(ctx context.Context, pks []containers.Vector,
		file string, metaloc []string, flag int32) error

	//Delete by primary key or physical addr.
	Delete(context.Context, *batch.Batch, string) error

	DeleteByPhyAddrKeys(context.Context, *vector.Vector) error

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

	GetRelationID(context.Context) uint64
	//just for test
	// 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) ([]engine.Reader, error)
}

Relation is only used by taeStorage

type Txn

type Txn interface {
	GetCtx() []byte
	GetID() string
	Is2PC() bool
	SetCommitTS(cts types.TS) error
	SetParticipants(ids []uint64) error
	Prepare() (types.TS, error)
	Committing() error
	Commit() error
	Rollback() error
	String() string
	Repr() string
	GetError() error
}

type TxnEngine

type TxnEngine interface {
	engine.Engine
	Engine
	StartTxn(info []byte) (txn Txn, err error)
	GetOrCreateTxnWithMeta(info []byte, id []byte, ts types.TS) (txn Txn, err error)
	GetTxnByID(id []byte) (txn Txn, err error)
	Close() error
	Destroy() error
}

Jump to

Keyboard shortcuts

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