handle

package
v1.2.3-hotfix-20241010 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIteratorEnd = moerr.NewInternalErrorNoCtx("end of interator")
)

Functions

This section is empty.

Types

type Database

type Database interface {
	io.Closer

	GetID() uint64
	GetName() string
	IsSubscription() bool
	GetCreateSql() string
	CreateRelation(def any) (Relation, error)
	CreateRelationWithID(def any, id uint64) (Relation, error)
	DropRelationByName(name string) (Relation, error)
	DropRelationByID(id uint64) (Relation, error)
	TruncateByName(name string) (Relation, error)
	TruncateWithID(name string, newTableId uint64) (Relation, error)
	TruncateByID(id uint64, newTableId uint64) (Relation, error)

	UnsafeGetRelation(id uint64) (Relation, error)
	GetRelationByName(name string) (Relation, error)
	GetRelationByID(id uint64) (Relation, error)
	RelationCnt() int64
	Relations() []Relation

	MakeRelationIt() RelationIt
	String() string
	GetMeta() any
}

type DeleteType

type DeleteType int8
const (
	DT_Normal DeleteType = iota
	DT_MergeCompact
)

type Filter

type Filter struct {
	Op  FilterOp
	Val any
}

func NewEQFilter

func NewEQFilter(v any) *Filter

type FilterOp

type FilterOp int16
const (
	FilterEq FilterOp = iota
	FilterBatchEq
	FilterBtw
)

type Iterator

type Iterator interface {
	sync.Locker
	RLock()
	RUnlock()
	io.Closer
	Valid() bool
	Next()
	GetError() error
}

Iterator TODO: this is not thread-safe

type Object added in v1.1.0

type Object interface {
	ObjectReader
	ObjectWriter
}

type ObjectIt added in v1.1.0

type ObjectIt interface {
	Iterator
	GetObject() Object
}

type ObjectReader added in v1.1.0

type ObjectReader interface {
	io.Closer
	GetID() *types.Objectid
	IsUncommitted() bool
	IsAppendable() bool
	Fingerprint() *common.ID
	// GetByFilter(filter Filter, offsetOnly bool) (map[uint64]*batch.Batch, error)
	String() string
	GetMeta() any
	GetByFilter(ctx context.Context, filter *Filter, mp *mpool.MPool) (uint16, uint32, error)
	GetColumnDataByNames(ctx context.Context, blkID uint16, attrs []string, mp *mpool.MPool) (*containers.BlockView, error)
	GetColumnDataByIds(ctx context.Context, blkID uint16, colIdxes []int, mp *mpool.MPool) (*containers.BlockView, error)
	GetColumnDataByName(context.Context, uint16, string, *mpool.MPool) (*containers.ColumnView, error)
	GetColumnDataById(context.Context, uint16, int, *mpool.MPool) (*containers.ColumnView, error)

	GetRelation() Relation

	BatchDedup(pks containers.Vector) error
	Prefetch(idxes []int) error
	BlkCnt() int
}

type ObjectWriter added in v1.1.0

type ObjectWriter interface {
	io.Closer
	String() string
	Update(blk uint64, row uint32, col uint16, v any) error
	RangeDelete(blk uint16, start, end uint32, dt DeleteType, mp *mpool.MPool) error

	PushDeleteOp(filter Filter) error
	PushUpdateOp(filter Filter, attr string, val any) error

	UpdateStats(objectio.ObjectStats) error
	UpdateDeltaLoc(blkID uint16, deltaLoc objectio.Location) error
}

type Relation

type Relation interface {
	io.Closer
	ID() uint64
	String() string
	SimplePPString(common.PPLevel) string
	GetCardinality(attr string) int64
	Schema() any
	AlterTable(ctx context.Context, req *apipb.AlterTableReq) error
	MakeObjectIt() ObjectIt
	MakeObjectItOnSnap() ObjectIt

	DeleteByPhyAddrKey(key any) error
	GetValueByPhyAddrKey(key any, col int) (any, bool, error)
	DeleteByPhyAddrKeys(keys containers.Vector, pkVec containers.Vector) error
	RangeDelete(id *common.ID, start, end uint32, dt DeleteType) error
	TryDeleteByDeltaloc(id *common.ID, deltaloc objectio.Location) (ok bool, err error)
	Update(id *common.ID, row uint32, col uint16, v any, isNull bool) error
	GetByFilter(ctx context.Context, filter *Filter) (id *common.ID, offset uint32, err error)
	GetValue(id *common.ID, row uint32, col uint16) (any, bool, error)
	GetValueByFilter(ctx context.Context, filter *Filter, col int) (any, bool, error)
	UpdateByFilter(ctx context.Context, filter *Filter, col uint16, v any, isNull bool) error
	DeleteByFilter(ctx context.Context, filter *Filter) error

	BatchDedup(col containers.Vector) error
	Append(ctx context.Context, data *containers.Batch) error
	AddObjsWithMetaLoc(ctx context.Context, stats containers.Vector) error

	GetMeta() any
	CreateObject(bool) (Object, error)
	CreateNonAppendableObject(is1PC bool, opt *objectio.CreateObjOpt) (Object, error)
	GetObject(id *types.Objectid) (Object, error)
	SoftDeleteObject(id *types.Objectid) (err error)

	GetDB() (Database, error)
}

type RelationIt

type RelationIt interface {
	Iterator
	GetRelation() Relation
}

Jump to

Keyboard shortcuts

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