model

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemoTreeVersion1 uint16 = iota
	MemoTreeVersion2
	MemoTreeVersion3
)

Variables

This section is empty.

Functions

func PreparePhyAddrData added in v0.6.0

func PreparePhyAddrData(
	id *objectio.Blockid, startRow, length uint32, pool *containers.VectorPool,
) (col containers.Vector, err error)

Types

type AOT added in v0.7.0

type AOT[B BlockT[R], R RowsT[R]] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

AOT stands for append-only-table append-only is the most common form of data organization. A basic data structure is abstracted here, which can cover most scenarios, such as logtail data and checkpoint data

func NewAOT added in v0.7.0

func NewAOT[B BlockT[R], R RowsT[R]](
	blockSize int,
	blockFactory func(R) B,
	lessFn func(_, _ B) bool) *AOT[B, R]

func (*AOT[B, R]) Append added in v0.7.0

func (aot *AOT[B, R]) Append(rows R) (err error)

One appender

func (*AOT[B, R]) BlockCount added in v0.7.0

func (aot *AOT[B, R]) BlockCount() int

func (*AOT[B, R]) Close added in v0.7.0

func (aot *AOT[B, R]) Close()

func (*AOT[B, R]) GetBlocks added in v1.0.0

func (aot *AOT[B, R]) GetBlocks() *btree.BTreeG[B]

func (*AOT[B, R]) Max added in v0.7.0

func (aot *AOT[B, R]) Max() (b B)

func (*AOT[B, R]) Min added in v0.7.0

func (aot *AOT[B, R]) Min() (b B)

func (*AOT[B, R]) Scan added in v0.7.0

func (aot *AOT[B, R]) Scan(fn func(_ B) bool)

func (*AOT[B, R]) Snapshot added in v0.7.0

func (aot *AOT[B, R]) Snapshot() AOTSnapshot[B, R]

func (*AOT[B, R]) String added in v0.7.0

func (aot *AOT[B, R]) String() string

func (*AOT[B, R]) Truncate added in v0.7.0

func (aot *AOT[B, R]) Truncate(stopFn func(_ B) bool) (cnt int)

Truncate prunes the blocks. Deletable blocks are those have all txns prepared before the given timestamp For example: truncate the table by timestamp blocks: (Page1[bornTs=1], Page2[bornTs=10], Page3[bornTs=20]) Call Remain Delete Truncate(ts=5): (Page1,Page2,Page3), () Truncate(ts=12): (Page2,Page3), (Page1) Truncate(ts=30): (Page3), (Page1,Page2)

type AOTSnapshot added in v0.7.0

type AOTSnapshot[B BlockT[R], R RowsT[R]] interface {
	// Ascend the table within the range [pivot, last]
	Ascend(pivot B, iter func(blk B) bool)

	// Descend the table within the range [pivot, first]
	Descend(pivot B, iter func(blk B) bool)
}

AOTSnapshot represents the snapshot of a AOT

type BaseTreeVisitor added in v0.8.0

type BaseTreeVisitor struct {
	TableFn  func(uint64, uint64) error
	ObjectFn func(uint64, uint64, *objectio.ObjectId) error
	BlockFn  func(uint64, uint64, *objectio.ObjectId, uint16) error
}

func (*BaseTreeVisitor) String added in v0.8.0

func (visitor *BaseTreeVisitor) String() string

func (*BaseTreeVisitor) VisitBlock added in v0.8.0

func (visitor *BaseTreeVisitor) VisitBlock(
	dbID, tableID uint64, ObjectID *objectio.ObjectId, Seq uint16) (err error)

func (*BaseTreeVisitor) VisitObject added in v1.1.0

func (visitor *BaseTreeVisitor) VisitObject(dbID, tableID uint64, ObjectID *objectio.ObjectId) (err error)

func (*BaseTreeVisitor) VisitTable added in v0.8.0

func (visitor *BaseTreeVisitor) VisitTable(dbID, tableID uint64) (err error)

type BatchBlock added in v0.7.0

type BatchBlock struct {
	*containers.Batch
	ID uint64
}

func NewBatchBlock added in v0.7.0

func NewBatchBlock(id uint64, attrs []string, colTypes []types.Type, opts containers.Options) *BatchBlock

func (*BatchBlock) IsAppendable added in v0.7.0

func (blk *BatchBlock) IsAppendable() bool

type BlockT added in v0.7.0

type BlockT[R RowsT[R]] interface {
	// Append appends a group of rows into the block
	Append(R) error

	// IsAppendable specifies wether the block is appendable
	IsAppendable() bool

	// Length specifies the row count of the block
	Length() int

	String() string

	// Close release the block bound resources
	// It should be called when the block is not used
	Close()
}

BlockT represents a block of rows

type HashPageTable added in v0.6.0

type HashPageTable = TransferTable[*TransferHashPage]

type ObjectTree added in v1.1.0

type ObjectTree struct {
	ID *objectio.ObjectId
}

func NewObjectTree added in v1.1.0

func NewObjectTree(id *objectio.ObjectId) *ObjectTree

func ReadObjectTreesV1 added in v1.1.0

func ReadObjectTreesV1(r io.Reader) (strees []*ObjectTree, n int64, err error)

func (*ObjectTree) Equal added in v1.1.0

func (stree *ObjectTree) Equal(o *ObjectTree) bool

func (*ObjectTree) Merge added in v1.1.0

func (stree *ObjectTree) Merge(ot *ObjectTree)

func (*ObjectTree) ReadFromV2 added in v1.1.0

func (stree *ObjectTree) ReadFromV2(r io.Reader) (n int64, err error)

func (*ObjectTree) ReadFromV3 added in v1.2.0

func (stree *ObjectTree) ReadFromV3(r io.Reader) (n int64, err error)

func (*ObjectTree) WriteTo added in v1.1.0

func (stree *ObjectTree) WriteTo(w io.Writer) (n int64, err error)

type PageT added in v0.6.0

type PageT[T common.IRef] interface {
	common.IRef
	Pin() *common.PinnedItem[T]
	TTL(time.Time, time.Duration) bool
	ID() *common.ID
	Length() int
}

type PreparedCompactedBlockData

type PreparedCompactedBlockData struct {
	Columns       *containers.Batch
	SortKey       containers.Vector
	SchemaVersion uint32
	Seqnums       []uint16
}

func NewPreparedCompactedBlockData

func NewPreparedCompactedBlockData() *PreparedCompactedBlockData

func (*PreparedCompactedBlockData) Close

func (preparer *PreparedCompactedBlockData) Close()

type RowsT added in v0.7.0

type RowsT[T any] interface {
	// row count
	Length() int

	// returns a window of the group of rows
	Window(offset, length int) T
}

RowsT represents a group of rows

type TableTree added in v0.8.0

type TableTree struct {
	DbID uint64
	ID   uint64
	Objs map[objectio.ObjectId]*ObjectTree
}

func NewTableTree added in v0.8.0

func NewTableTree(dbID, id uint64) *TableTree

func (*TableTree) AddObject added in v1.1.0

func (ttree *TableTree) AddObject(sid *objectio.ObjectId)

func (*TableTree) Compact added in v0.8.0

func (ttree *TableTree) Compact() (empty bool)

func (*TableTree) Equal added in v0.8.0

func (ttree *TableTree) Equal(o *TableTree) bool

func (*TableTree) GetObject added in v1.1.0

func (ttree *TableTree) GetObject(id types.Objectid) *ObjectTree

func (*TableTree) IsEmpty added in v0.8.0

func (ttree *TableTree) IsEmpty() bool

func (*TableTree) Merge added in v0.8.0

func (ttree *TableTree) Merge(ot *TableTree)

func (*TableTree) ReadFromWithVersion added in v1.1.0

func (ttree *TableTree) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

func (*TableTree) ShortBlocksString added in v1.0.0

func (ttree *TableTree) ShortBlocksString() string

func (*TableTree) Shrink added in v0.8.0

func (ttree *TableTree) Shrink(objID types.Objectid) (empty bool)

func (*TableTree) WriteTo added in v0.8.0

func (ttree *TableTree) WriteTo(w io.Writer) (n int64, err error)

type TimedSliceBlock added in v0.7.0

type TimedSliceBlock[R any] struct {
	BornTS types.TS
	Rows   []R
}

func NewTimedSliceBlock added in v0.7.0

func NewTimedSliceBlock[R any](ts types.TS) *TimedSliceBlock[R]

func (*TimedSliceBlock[R]) Append added in v0.7.0

func (blk *TimedSliceBlock[R]) Append(rows R) (err error)

func (*TimedSliceBlock[R]) Close added in v0.7.0

func (blk *TimedSliceBlock[R]) Close()

func (*TimedSliceBlock[R]) IsAppendable added in v0.7.0

func (blk *TimedSliceBlock[R]) IsAppendable() bool

func (*TimedSliceBlock[R]) Length added in v0.7.0

func (blk *TimedSliceBlock[R]) Length() int

func (*TimedSliceBlock[R]) String added in v0.7.0

func (blk *TimedSliceBlock[R]) String() string

type TransDels added in v1.0.0

type TransDels struct {

	// row -> commit ts
	Mapping map[int]types.TS
	// contains filtered or unexported fields
}

func NewTransDels added in v1.0.0

func NewTransDels(endts types.TS) *TransDels

func (*TransDels) PPString added in v1.0.0

func (t *TransDels) PPString() string

type TransDelsForBlks added in v1.0.0

type TransDelsForBlks struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTransDelsForBlks added in v1.0.0

func NewTransDelsForBlks() *TransDelsForBlks

func (*TransDelsForBlks) Delete added in v1.2.3

func (t *TransDelsForBlks) Delete(blkID types.Blockid)

func (*TransDelsForBlks) GetDelsForBlk added in v1.0.0

func (t *TransDelsForBlks) GetDelsForBlk(blkid types.Blockid) *TransDels

func (*TransDelsForBlks) Prune added in v1.0.0

func (t *TransDelsForBlks) Prune(gap time.Duration)

func (*TransDelsForBlks) SetDelsForBlk added in v1.0.0

func (t *TransDelsForBlks) SetDelsForBlk(blkid types.Blockid, dels *TransDels)

type TransferHashPage added in v0.6.0

type TransferHashPage struct {
	common.RefHelper
	// contains filtered or unexported fields
}

func NewTransferHashPage added in v0.6.0

func NewTransferHashPage(id *common.ID, ts time.Time, pageSize int, isTransient bool) *TransferHashPage

func (*TransferHashPage) BornTS added in v0.6.0

func (page *TransferHashPage) BornTS() time.Time

func (*TransferHashPage) Close added in v0.6.0

func (page *TransferHashPage) Close()

func (*TransferHashPage) ID added in v0.6.0

func (page *TransferHashPage) ID() *common.ID

func (*TransferHashPage) Length added in v1.0.0

func (page *TransferHashPage) Length() int

func (*TransferHashPage) Pin added in v0.6.0

func (*TransferHashPage) String added in v0.6.0

func (page *TransferHashPage) String() string

func (*TransferHashPage) TTL added in v0.6.0

func (page *TransferHashPage) TTL(now time.Time, ttl time.Duration) bool

func (*TransferHashPage) Train added in v0.6.0

func (page *TransferHashPage) Train(from uint32, to types.Rowid)

func (*TransferHashPage) Transfer added in v0.6.0

func (page *TransferHashPage) Transfer(from uint32) (dest types.Rowid, ok bool)

type TransferTable added in v0.6.0

type TransferTable[T PageT[T]] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTransferTable added in v0.6.0

func NewTransferTable[T PageT[T]](ttl time.Duration) *TransferTable[T]

func (*TransferTable[T]) AddPage added in v0.6.0

func (table *TransferTable[T]) AddPage(page T) (dup bool)

func (*TransferTable[T]) Close added in v0.6.0

func (table *TransferTable[T]) Close()

func (*TransferTable[T]) DeletePage added in v0.6.0

func (table *TransferTable[T]) DeletePage(id *common.ID)

func (*TransferTable[T]) Len added in v0.6.0

func (table *TransferTable[T]) Len() int

func (*TransferTable[T]) Pin added in v0.6.0

func (table *TransferTable[T]) Pin(id common.ID) (pinned *common.PinnedItem[T], err error)

func (*TransferTable[T]) RunTTL added in v0.6.0

func (table *TransferTable[T]) RunTTL(now time.Time)

type Tree added in v0.8.0

type Tree struct {
	Tables map[uint64]*TableTree
}

func NewTree added in v0.8.0

func NewTree() *Tree

func (*Tree) AddObject added in v1.1.0

func (tree *Tree) AddObject(dbID, tableID uint64, id *objectio.ObjectId)

func (*Tree) AddTable added in v0.8.0

func (tree *Tree) AddTable(dbID, id uint64)

func (*Tree) Compact added in v0.8.0

func (tree *Tree) Compact() (empty bool)

func (*Tree) Equal added in v0.8.0

func (tree *Tree) Equal(o *Tree) bool

func (*Tree) GetObject added in v1.1.0

func (tree *Tree) GetObject(tableID uint64, objID types.Objectid) *ObjectTree

func (*Tree) GetTable added in v0.8.0

func (tree *Tree) GetTable(id uint64) *TableTree

func (*Tree) HasTable added in v0.8.0

func (tree *Tree) HasTable(id uint64) bool

func (*Tree) IsEmpty added in v0.8.0

func (tree *Tree) IsEmpty() bool

func (*Tree) Merge added in v0.8.0

func (tree *Tree) Merge(ot *Tree)

func (*Tree) ReadFromWithVersion added in v1.1.0

func (tree *Tree) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)

func (*Tree) Reset added in v0.8.0

func (tree *Tree) Reset()

func (*Tree) Shrink added in v0.8.0

func (tree *Tree) Shrink(tableID uint64) (empty bool)

func (*Tree) String added in v0.8.0

func (tree *Tree) String() string

func (*Tree) TableCount added in v0.8.0

func (tree *Tree) TableCount() int

func (*Tree) Visit added in v0.8.0

func (tree *Tree) Visit(visitor TreeVisitor) (err error)

func (*Tree) WriteTo added in v0.8.0

func (tree *Tree) WriteTo(w io.Writer) (n int64, err error)

type TreeVisitor added in v0.8.0

type TreeVisitor interface {
	VisitTable(dbID, id uint64) error
	VisitObject(uint64, uint64, *objectio.ObjectId) error
	VisitBlock(uint64, uint64, *objectio.ObjectId, uint16) error
	String() string
}

Jump to

Keyboard shortcuts

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