handle

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 9 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 Block

type Block interface {
	BlockReader
	BlockWriter
}

type BlockIt

type BlockIt interface {
	Iterator
	GetBlock() Block
}

type BlockReader

type BlockReader interface {
	io.Closer
	ID() types.Blockid
	String() string
	IsUncommitted() bool
	GetByFilter(ctx context.Context, filter *Filter) (uint32, error)
	GetColumnDataByNames(ctx context.Context, attrs []string) (*containers.BlockView, error)
	GetColumnDataByIds(ctx context.Context, colIdxes []int) (*containers.BlockView, error)
	GetColumnDataByName(context.Context, string) (*containers.ColumnView, error)
	GetColumnDataById(context.Context, int) (*containers.ColumnView, error)
	GetMeta() any
	GetDeltaPersistedTS() types.TS
	GetMetaLoc() objectio.Location
	GetDeltaLoc() objectio.Location
	Fingerprint() *common.ID
	Rows() int
	Prefetch(idxes []int) error

	IsAppendableBlock() bool

	GetSegment() Segment

	GetTotalChanges() int
}

type BlockWriter

type BlockWriter interface {
	io.Closer
	Append(data *containers.Batch, offset uint32) (uint32, error)
	Update(row uint32, col uint16, v any) error
	RangeDelete(start, end uint32, dt DeleteType) error
	UpdateMetaLoc(metaLoc objectio.Location) error
	UpdateDeltaLoc(deltaLoc objectio.Location) error

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

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 MetaUpdateNode added in v0.6.0

type MetaUpdateNode interface{}

type Relation

type Relation interface {
	io.Closer
	ID() uint64
	Rows() int64
	String() string
	SimplePPString(common.PPLevel) string
	GetCardinality(attr string) int64
	Schema() any
	AlterTable(ctx context.Context, req *apipb.AlterTableReq) error
	MakeSegmentIt() SegmentIt
	MakeSegmentItOnSnap() SegmentIt
	MakeBlockIt() BlockIt

	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
	AddBlksWithMetaLoc(ctx context.Context, metaLcos []objectio.Location) error

	GetMeta() any
	CreateSegment(bool) (Segment, error)
	CreateNonAppendableSegment(is1PC bool) (Segment, error)
	GetSegment(id *types.Segmentid) (Segment, error)
	SoftDeleteSegment(id *types.Segmentid) (err error)

	GetDB() (Database, error)
}

type RelationIt

type RelationIt interface {
	Iterator
	GetRelation() Relation
}

type Segment

type Segment interface {
	SegmentReader
	SegmentWriter
}

type SegmentIt

type SegmentIt interface {
	Iterator
	GetSegment() Segment
}

type SegmentReader

type SegmentReader interface {
	io.Closer
	GetID() *types.Segmentid
	IsUncommitted() bool
	IsAppendable() bool
	MakeBlockIt() BlockIt
	// GetByFilter(filter Filter, offsetOnly bool) (map[uint64]*batch.Batch, error)
	String() string
	GetMeta() any

	GetBlock(id types.Blockid) (Block, error)
	GetRelation() Relation

	BatchDedup(pks containers.Vector) error
}

type SegmentWriter

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

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

	// create a appendable block, its id will be <segid>-<nextObjectid>-0
	CreateBlock(bool) (Block, error)
	// create a non-appendable block, instructed by CreateBlockOpt.
	// CreateBlockOpt can be nil, and the created block's id
	// will be <segid>-<nextObjectid>-0
	CreateNonAppendableBlock(*objectio.CreateBlockOpt) (Block, error)

	SoftDeleteBlock(id types.Blockid) (err error)
}

Jump to

Keyboard shortcuts

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